/* public/css/style.css */
/* ============================================================
   TAMPILAN WEBSITE PRETEST  (tema terang & gelap)
   - Warna tema ada di blok ":root" (terang) dan
     ':root[data-theme="dark"]' (gelap) di bawah ini.
   - Nama situs & logo diatur di public/js/theme.js
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;600;700&family=Poppins:wght@500;600;700;800&display=swap");

/* ---------- Tema TERANG ---------- */
:root {
  color-scheme: light;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Poppins", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --header-bg: rgba(255, 255, 255, 0.9);
  --input-bg: #ffffff;
  --dot: #d3d9ea;

  --text: #0f2142;          /* judul: navy */
  --body: #2b3d66;          /* teks biasa */
  --muted: #5a6b92;
  --accent: #3b4f8c;        /* biru keabuan untuk label */

  --border: #e1e6f2;
  --border-strong: #c3cbe4;
  --ghost-border: #b9c1dd;
  --focus-ring: rgba(15, 33, 66, 0.15);

  --primary: #0f2142;       /* tombol utama */
  --primary-dark: #1d3466;  /* saat disorot */
  --primary-soft: #eef1fa;
  --primary-border: #c3cbe4;
  --on-primary: #ffffff;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --ok-soft: #ecfdf5;
  --ok-border: #86efac;
  --ok-badge-bg: #dcfce7;
  --ok-badge-text: #166534;
  --off-bg: #eceff6;
  --off-text: #4b5675;

  --radius: 20px;
  --radius-sm: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 33, 66, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 33, 66, 0.14);
}

/* ---------- Tema GELAP ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #071226;
  --surface: #0d1c3a;
  --surface-2: #0a1830;
  --header-bg: rgba(7, 18, 38, 0.9);
  --input-bg: #0a1830;
  --dot: #15244a;

  --text: #ffffff;
  --body: #c3cce3;
  --muted: #8c99ba;
  --accent: #8fa3e8;

  --border: #1a2a4d;
  --border-strong: #2a3d6b;
  --ghost-border: #3a4d7d;
  --focus-ring: rgba(255, 255, 255, 0.2);

  --primary: #ffffff;
  --primary-dark: #dbe3f7;
  --primary-soft: #12254a;
  --primary-border: #2f4478;
  --on-primary: #071226;

  --danger: #f87171;
  --danger-soft: #2a1317;
  --danger-border: #6b2a30;
  --ok-soft: #0e2b22;
  --ok-border: #1f6b4f;
  --ok-badge-bg: #123d2d;
  --ok-badge-text: #86efac;
  --off-bg: #1a2a4d;
  --off-text: #9aa8c9;

  --shadow-sm: none;
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- Dasar ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--body);
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1.3px, transparent 1.5px);
  background-size: 26px 26px;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
a { color: var(--accent); }
::selection { background: var(--primary-border); }
::placeholder { color: var(--muted); opacity: 0.7; }
:focus-visible { outline: 3px solid var(--primary-border); outline-offset: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--text);
  letter-spacing: -0.02em;
}
h1 { font-size: 1.75rem; font-weight: 800; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 1.08rem; font-weight: 700; margin: 0; word-break: break-word; }
h4 { font-size: 1rem; font-weight: 700; margin: 0; }
.muted { color: var(--muted); margin: 4px 0; font-size: 0.92rem; }

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 24px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}
.brand-logo { width: 46px; height: 46px; object-fit: contain; flex: none; }
.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 800;
  font-size: 1.2rem;
}
:root[data-theme="dark"] img.brand-logo {
  background: #fff;
  border-radius: 12px;
  padding: 4px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand-sub {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.theme-toggle {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--ghost-border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.theme-toggle:hover { background: var(--primary-soft); }
.theme-toggle-floating { position: fixed; top: 14px; right: 14px; z-index: 30; }

/* ---------- Kerangka halaman ---------- */
.container { max-width: 960px; margin: 28px auto; padding: 0 16px; }
.container-narrow { max-width: 440px; margin-top: 48px; }
.container-play { max-width: 660px; }
.container-board { max-width: 740px; }
.center { text-align: center; }

.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  animation: fade-up 0.25s ease both;
}

/* ---------- Formulir ---------- */
label {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
  font-size: 0.92rem;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
textarea { resize: vertical; }

/* Warna isian otomatis browser disesuaikan dengan tema (isinya tetap terlihat) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
  caret-color: var(--text);
}

input[type="checkbox"],
input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }

.option-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.option-row label.radio {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 56px;
  font-weight: 700;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
  font-size: 1.2rem;
}

.form-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 12px 0;
}

/* ---------- Tombol (bentuk kapsul) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-secondary { background: transparent; color: var(--text); border-color: var(--ghost-border); }
.btn-secondary:hover:not(:disabled) { background: var(--primary-soft); }

.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }

.btn-small { padding: 6px 16px; min-height: 36px; font-size: 0.85rem; }
.btn-block { display: flex; width: 100%; margin-top: 16px; }

/* ---------- Kartu kuis & soal ---------- */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.actions-center { justify-content: center; }
.code-line { margin: 8px 0; }

.quiz-card { border-left: 5px solid var(--primary); }
.quiz-card.is-off { border-left-color: var(--border-strong); background: var(--surface-2); }
.quiz-card.is-off h3 { color: var(--muted); }
.question-card { border-left: 5px solid var(--border-strong); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--primary-soft);
  color: var(--accent);
}
.badge-ok { background: var(--ok-badge-bg); color: var(--ok-badge-text); }
.badge-off { background: var(--off-bg); color: var(--off-text); }

.code {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 3px;
  background: var(--primary-soft);
  color: var(--text);
  padding: 2px 12px;
  border-radius: 10px;
  border: 1.5px dashed var(--primary-border);
}
.link-text { word-break: break-all; font-size: 0.9rem; }

.question-text { white-space: pre-wrap; margin: 6px 0; color: var(--text); }
.options { list-style: none; padding: 0; margin: 10px 0; }
.options li {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.options li.correct { background: var(--ok-soft); border-color: var(--ok-border); }

/* ---------- Statistik & tabel ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}
.stat .muted {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.stat .num { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; line-height: 1.2; color: var(--text); }

.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.me-row, .me-row:hover { background: var(--primary-soft); font-weight: 600; color: var(--text); }

.my-position {
  background: var(--primary-soft);
  border: 1.5px solid var(--primary-border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

/* ---------- Halaman praktikan ---------- */
.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text);
}
.progress {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
}

.question-big {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  margin: 4px 0 18px;
}

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}
.choice:hover { border-color: var(--primary-border); background: var(--surface-2); }
.choice:active { transform: scale(0.995); }
.choice.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.choice-letter {
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
}
.choice.selected .choice-letter { background: var(--primary); color: var(--on-primary); }
.choice-text { flex: 1; white-space: pre-wrap; word-break: break-word; }

#screen-result { padding: 28px 22px; animation: pop 0.4s ease both; }
.result-score {
  font-family: var(--font-mono);
  font-size: 3.6rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 10px 0;
  color: var(--text);
}
.result-score small { font-size: 1.5rem; font-weight: 600; color: var(--muted); }

/* ---------- Pesan pop-up kecil ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 12px);
  max-width: 90%;
  padding: 12px 22px;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ok { background: #166534; }
.toast-error { background: #b91c1c; }

/* ---------- Animasi ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { opacity: 0; transform: scale(0.95); }
  60% { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- Layar kecil (HP) ---------- */
@media (max-width: 600px) {
  .container { margin-top: 18px; }
  .container-narrow { margin-top: 28px; }
  .card { padding: 16px; }
  h1 { font-size: 1.45rem; }
  .topbar { padding: 10px 14px; }
  .brand-logo { width: 38px; height: 38px; }
  .brand-sub { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .actions .btn { flex: 1 1 auto; }
  .result-score { font-size: 3rem; }
}

/* ---------- Pengguna yang memilih "kurangi animasi" ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Saat dicetak: selalu terang ---------- */
@media print {
  :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --surface-2: #f4f4f4;
    --text: #000; --body: #222; --muted: #555; --accent: #333;
    --border: #ccc; --primary-soft: #eee;
  }
  body { background-image: none; }
  .topbar, .toolbar, .actions, .form-actions, .btn, .toast, .theme-toggle { display: none !important; }
  .card, .stat { box-shadow: none; animation: none; }
}