/* =============================================================
   DESIGN SYSTEM — ML Checker / neru
   Custom CSS — no Tailwind compile output here
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:             #ffffff;
  --bg-subtle:      #f4f4f5;
  --bg-muted:       #fafafa;
  --border:         #e4e4e7;
  --border-strong:  #d4d4d8;
  --text:           #0a0a0a;
  --text-muted:     #71717a;
  --text-subtle:    #a1a1aa;
  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-subtle:  #eff6ff;
  --accent-border:  #bfdbfe;
  --destructive:    #dc2626;
  --success:        #16a34a;
  --success-subtle: #f0fdf4;
  --warning:        #d97706;
  --warning-subtle: #fffbeb;
  --radius:         8px;
  --radius-sm:      6px;
  --radius-xs:      4px;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-subtle); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--bg-subtle); }

/* ── Utility: Hidden ───────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Spinner ───────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: spin 0.65s linear infinite;
}

/* ── Marquee Banner ────────────────────────────────────────── */
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.marquee-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--text);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 7px 0;
  z-index: 100;
}

.marquee-content {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: marquee 30s linear infinite;
  gap: 24px;
}

.marquee-content span { padding-right: 80px; }

/* ── Modal Base ────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.45);
}

@media (min-width: 640px) {
  .modal { align-items: center; }
}

.modal-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: slideUp 0.22s ease;
}

@media (min-width: 640px) {
  .modal-panel { border-radius: 12px; }
}

.modal-animate {
  animation: slideUp 0.22s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.modal-body {
  overflow-y: auto;
  flex: 1;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-subtle); color: var(--text); border-color: var(--border-strong); }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 12px;
}
.btn-icon:hover:not(:disabled) { background: var(--bg-subtle); color: var(--text); border-color: var(--border-strong); }

.btn-icon-danger:hover:not(:disabled) { background: #fef2f2; color: var(--destructive); border-color: #fecaca; }
.btn-icon-accent:hover:not(:disabled) { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent-border); }

/* ── Inputs ────────────────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.input::placeholder { color: var(--text-subtle); }
.input:focus { border-color: var(--accent); background: var(--bg); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid;
  line-height: 1.4;
  flex-shrink: 0;
}

/* Role badges */
.role-free    { background: var(--bg-subtle); color: var(--text-muted); border-color: var(--border); }
.role-vip     { background: #fefce8;          color: #854d0e;           border-color: #fde047; }
.role-vvip    { background: #fff7ed;          color: #9a3412;           border-color: #fdba74; }
.role-admin   { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent-border); }
.role-reseller { background: var(--success-subtle); color: var(--success); border-color: #bbf7d0; }

/* Status badges */
.badge-paid    { background: var(--success-subtle); color: var(--success);  border-color: #bbf7d0; }
.badge-pending { background: var(--warning-subtle); color: var(--warning);  border-color: #fde68a; }
.badge-expired { background: var(--bg-subtle);      color: var(--text-muted); border-color: var(--border); }

/* ── Feature list items (Checker & Bengkel menus) ──────────── */
.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}

.feature-item:last-child { border-bottom: none; }
.feature-item:hover { background: var(--bg-subtle); }

.feature-item.selected {
  background: var(--accent-subtle);
  border-left: 2px solid var(--accent);
  padding-left: 12px;
}

.feature-item.selected:last-child { border-bottom: none; }

.feature-item input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.feature-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.feature-item.selected .feature-icon {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--accent);
}

.feature-label { flex: 1; min-width: 0; }
.feature-label p { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.feature-label span { font-size: 11px; color: var(--text-muted); }

.feature-price {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid;
  flex-shrink: 0;
  line-height: 1.5;
}

.price-free    { background: var(--success-subtle); color: var(--success);  border-color: #bbf7d0; }
.price-paid    { background: var(--bg-subtle);       color: var(--text-muted); border-color: var(--border); }

/* ── Tabs ──────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-btn:hover:not(.active) { color: var(--text); }

/* ── History tabs (smaller, inside modal) ──────────────────── */
.htab-bar {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.htab-btn {
  flex: 1;
  padding: 7px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
  text-align: center;
}

.htab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.htab-btn:hover:not(.active) { color: var(--text); }

/* ── Chat bubbles ──────────────────────────────────────────── */
.chat-bubble {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.chat-bubble.user { align-items: flex-end; align-self: flex-end; }
.chat-bubble.admin { align-items: flex-start; align-self: flex-start; }

.chat-bubble-text {
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 13px;
  border-radius: var(--radius);
  word-break: break-word;
}

.chat-bubble.user .chat-bubble-text {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: var(--radius-xs);
}

.chat-bubble.admin .chat-bubble-text {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-xs);
}

.chat-time {
  font-size: 10px;
  color: var(--text-subtle);
  margin-top: 3px;
  padding: 0 2px;
}

/* ── Profile card in result modal ──────────────────────────── */
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-muted);
}

.profile-info h2 { font-size: 16px; font-weight: 700; }
.profile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.rank-text { font-size: 12px; color: var(--text-muted); }

/* ── Data viewer (result rows) ──────────────────────────────── */
.data-viewer {}

.data-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.data-row:last-child { border-bottom: none; }

.data-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  min-width: 100px;
  padding-top: 1px;
}

.data-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

/* ── Accordion ──────────────────────────────────────────────── */
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
  text-align: left;
}

.accordion-header:hover { background: var(--bg-subtle); }

.accordion-header .acc-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.acc-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.accordion-chevron {
  font-size: 11px;
  color: var(--text-subtle);
  transition: transform 0.25s;
  flex-shrink: 0;
}

.accordion-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-muted);
}

/* ── Inline states ──────────────────────────────────────────── */
#loadingIndicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--accent);
  margin-top: 12px;
}

#errorMsg {
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--destructive);
  margin-top: 12px;
}

/* ── Section / card ─────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Balance card (sticky) ──────────────────────────────────── */
.balance-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Fixed bottom bar ───────────────────────────────────────── */
.bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

/* ── Checkbox ───────────────────────────────────────────────── */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.checkbox-label:last-child { border-bottom: none; }

.checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.checkbox-label .check-text p {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.checkbox-label .check-text span {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Notice block ───────────────────────────────────────────── */
.notice {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 11px;
  line-height: 1.6;
}

.notice-info    { background: var(--accent-subtle); border-color: var(--accent-border); color: #1e40af; }
.notice-warning { background: var(--warning-subtle); border-color: #fde68a;             color: #92400e; }
.notice-success { background: var(--success-subtle); border-color: #bbf7d0;             color: #14532d; }

/* ── Animate fade-in ────────────────────────────────────────── */
.animate-fade-in { animation: fadeIn 0.18s ease; }

/* ── Chat locked overlay ────────────────────────────────────── */
#chatLockedOverlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.96);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

/* ── Notification pulse badge ───────────────────────────────── */
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity: 0.4; } }
.pulse-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--destructive);
  border-radius: 50%;
  border: 2px solid var(--bg);
  animation: pulse 1.4s ease-in-out infinite;
  position: absolute;
  top: -3px; right: -3px;
}
