/* =============== THEME TOKENS (Blue & White seperti gambar 1–3) =============== */
:root {
  /* brand */
  --brand-600: #2563eb; /* tombol utama */
  --brand-700: #1d4ed8;
  --brand-200: #bfdbfe;
  --brand-50:  #eff6ff;

  /* base light */
  --bg:        #f5f8ff;      /* latar app (sangat muda kebiruan) */
  --bg-soft:   #ecf2ff;      /* chip/pill lembut */
  --surface:   #ffffff;      /* kartu/nav/section */
  --surface-2: #f3f6ff;      /* input, badge, area sekunder */
  --text:      #0f172a;      /* teks utama (slate-900) */
  --muted:     #475569;      /* teks sekunder */
  --border:    #e5e7eb;      /* garis halus */
  --shadow:    0 8px 28px rgba(15,23,42,.08);

  /* states */
  --ok:        #10b981;
  --warn:      #f59e0b;
  --danger:    #ef4444;

  /* radii */
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 10px;

  /* spacing */
  --px: 16px;
}

/* ====== Kalau TIDAK ada data-theme, ikuti sistem: ====== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:       #0b1220;
    --bg-soft:  #0e1729;
    --surface:  #0f172a;
    --surface-2:#111b2c;
    --text:     #e7edf7;
    --muted:    #a8b3c7;
    --border:   #1f2a3a;
    --shadow:   0 10px 30px rgba(0,0,0,.25);

    --brand-600:#3b82f6;
    --brand-700:#2563eb;
    --brand-200:#1e3a8a;
    --brand-50: #0b1730;
  }
}

/* ====== Override manual pakai <html data-theme="light|dark"> ====== */
:root[data-theme="dark"] {
  --bg:       #0b1220;
  --bg-soft:  #0e1729;
  --surface:  #0f172a;
  --surface-2:#111b2c;
  --text:     #e7edf7;
  --muted:    #a8b3c7;
  --border:   #1f2a3a;
  --shadow:   0 10px 30px rgba(0,0,0,.25);

  --brand-600:#3b82f6;
  --brand-700:#2563eb;
  --brand-200:#1e3a8a;
  --brand-50: #0b1730;
}

/* =============== RESET + BASE =============== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
hr { border: none; border-top: 1px solid var(--border); }

/* =============== LAYOUT PIECES (header/section/kartu) =============== */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.container { width: min(1080px, 100%); margin: 0 auto; padding: 0 var(--px); }

.section {
  background: transparent;
  padding: 18px var(--px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--r-lg);
  padding: 16px;
}
.card.soft {
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.7));
  border-color: rgba(0,0,0,.04);
}

/* =============== BADGE / CHIP / PILL =============== */
.badge, .chip, .pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}

/* =============== BUTTONS =============== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px; padding: 12px 18px;
  border-radius: var(--r-sm);
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .04s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  box-shadow: 0 4px 14px rgba(37,99,235,.18);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  border-color: rgba(37,99,235,.18);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(37,99,235,.28); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow);
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-soft); }

/* =============== INPUTS =============== */
.input, .select, .textarea, input[type="text"], input[type="search"], input[type="email"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 16px;
  outline: none;
  box-shadow: inset 0 0 0 1px transparent, var(--shadow);
}
.textarea, textarea { border-radius: var(--r-md); min-height: 120px; resize: vertical; }
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(37,99,235,.20);
}

/* =============== CARDS SPESIFIK (hero, list, item) =============== */
.hero {
  background: radial-gradient(1200px 600px at 50% -100px, var(--brand-50), transparent 70%), var(--bg);
  padding: 28px var(--px);
  border-bottom: 1px solid var(--border);
}

.list { display: grid; gap: 14px; }
.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}

/* =============== UTILITIES (tipikal dipakai di banyak halaman) =============== */
.text-muted { color: var(--muted); }
.surface     { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.surface-2   { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.bg-soft     { background: var(--bg-soft); }
.border      { border: 1px solid var(--border); }
.round       { border-radius: var(--r-lg); }
.shadow      { box-shadow: var(--shadow); }

/* =============== NAVBAR MINI (ikon bel, avatar, dll) =============== */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px var(--px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  position: sticky; top: 0; z-index: 50;
}

/* =============== TABLES (results.php dll) =============== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table th, .table td { padding: 12px 14px; }
.table thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-weight: 700;
}
.table tr + tr td { border-top: 1px solid var(--border); }

/* =============== TAGS STATUS =============== */
.tag { display:inline-flex; align-items:center; padding:6px 10px; border-radius:999px; border:1px solid var(--border); font-weight:600; }
.tag.ok    { background: color-mix(in srgb, var(--ok) 12%, transparent);    color: var(--text); }
.tag.warn  { background: color-mix(in srgb, var(--warn) 16%, transparent);  color: var(--text); }
.tag.dang  { background: color-mix(in srgb, var(--danger) 14%, transparent);color: var(--text); }

/* =============== RESPONSIVE HELPERS =============== */
@media (min-width: 768px) {
  .grid-2 { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
  .grid-3 { display:grid; grid-template-columns: repeat(3,1fr); gap:16px; }
}

/* =============== OVERRIDES KHUSUS HALAMAN "nakal" =============== */
/* Banyak halaman lama menaruh hard-coded gelap seperti #0b1b39, #0f172a di BODY. Pastikan override: */
body[style*="background:#0b1b39"],
body[style*="background: #0b1b39"],
body.forced-dark {
  background: var(--bg) !important;
  color: var(--text) !important;
}
