/* =========================================================
   CBT Bahasa Inggris — Stylesheet siswa
   Ringan: murni CSS custom, tanpa framework/compiler runtime.
   Palet: ink navy (#12213D), aksen biru (#2F6FED), ragu-ragu
   amber (#E0A100), kertas (#F7F8FA).
   ========================================================= */

:root {
  --ink: #12213D;
  --ink-soft: #24365B;
  --bg: #F7F8FA;
  --line: #E4E7EE;
  --accent: #2F6FED;
  --accent-soft: #EAF1FE;
  --doubt: #E0A100;
  --doubt-soft: #FBF1D6;
  --danger: #D64545;
  --danger-soft: #FCEAEA;
  --success: #2E9E5B;
  --success-soft: #E9F7EF;
  --text: #1C2431;
  --text-mute: #6B7385;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(18, 33, 61, 0.08);

  /* Aksen khusus "Kartu Peserta Ujian" di halaman login */
  --seal: #9B3A44;
  --brass: #B8933E;
  --paper: #F6F4EE;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; }
button { font-family: inherit; }

/* ================= Halaman Login — "Kartu Peserta Ujian" ================= */
.examcard-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background:
    radial-gradient(circle at 15% 0%, rgba(255,255,255,0.05), transparent 45%),
    linear-gradient(160deg, var(--ink), #0A1730);
}

.examcard-shell {
  width: 100%;
  max-width: 880px;
  display: flex;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(6, 12, 28, 0.45);
}

/* ---- Panel kiri: "sampul" kartu ujian ---- */
.examcard-brand {
  position: relative;
  flex: 0 0 40%;
  background: linear-gradient(165deg, var(--ink) 0%, #0B1730 100%);
  color: #EAF0FF;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.examcard-watermark {
  position: absolute; inset: 0; opacity: 0.35; pointer-events: none;
  background-image:
    repeating-linear-gradient(115deg, rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 13px),
    repeating-linear-gradient(25deg, rgba(255,255,255,0.04) 0px, rgba(255,255,255,0.04) 1px, transparent 1px, transparent 17px);
}
.examcard-seal {
  position: relative;
  width: 52px; height: 52px; margin-bottom: 20px;
  color: var(--brass);
}
.examcard-kicker {
  position: relative;
  text-transform: uppercase; letter-spacing: .16em; font-size: 10.5px; font-weight: 700;
  color: var(--brass); margin: 0 0 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.examcard-title {
  position: relative;
  font-family: 'Source Serif 4', Georgia, serif; font-weight: 600;
  font-size: 25px; line-height: 1.3; margin: 0 0 8px; color: #fff;
}
.examcard-meta {
  position: relative;
  font-size: 13px; color: #B4C1DE; margin: 0 0 26px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.examcard-security {
  position: relative;
  list-style: none; margin: auto 0 0; padding: 16px 0 0;
  border-top: 1px dashed rgba(184, 147, 62, 0.4);
  display: flex; flex-direction: column; gap: 9px;
}
.examcard-security li {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: #9FB0D0; letter-spacing: .01em;
}
.examcard-security i { color: var(--brass); font-size: 11px; width: 14px; text-align: center; }

/* ---- Garis perforasi ala sobekan tiket, di antara dua panel ---- */
.examcard-perforation {
  flex: 0 0 1px;
  background-image: radial-gradient(circle, rgba(18,33,61,0.18) 1.6px, transparent 1.8px);
  background-size: 100% 13px;
  background-repeat: repeat-y;
  background-position: center;
}

/* ---- Panel kanan: form isi data (ala "belakang" kartu ujian) ---- */
.examcard-form-panel {
  flex: 1;
  background: var(--paper);
  padding: 34px 34px 30px;
  min-width: 0;
}
.examcard-form-kicker {
  text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 700;
  color: var(--seal); margin: 0 0 18px;
}

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  border-radius: 10px; padding: 11px 13px; font-size: 13.5px; margin-bottom: 18px; line-height: 1.5;
}
.alert-error { background: var(--danger-soft); color: #A32E2E; border: 1px solid #F1C7C7; }
.alert-success { background: var(--success-soft); color: #1F7A45; border: 1px solid #C9EBD7; }

.examcard-field { display: flex; gap: 12px; margin-bottom: 16px; }
.examcard-field-no {
  flex-shrink: 0; width: 24px; padding-top: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; font-weight: 700;
  color: var(--seal); opacity: 0.75;
}
.examcard-field-row { display: flex; gap: 12px; flex: 1; }

.field { display: block; margin-bottom: 0; flex: 1; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-mute); margin-bottom: 6px; }
.input-icon { position: relative; }
.input-icon i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: #A5ABBC; font-size: 14px;
}
.input-icon input {
  width: 100%; padding: 11px 12px 11px 38px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 9px; color: var(--text); background: #fff;
}
.input-icon input:focus { outline: none; border-color: var(--seal); }

.examcard-submit-row { display: flex; gap: 12px; margin-top: 22px; padding-left: 36px; }
.examcard-submit-row .btn { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 9px; font-weight: 700; font-size: 14.5px; cursor: pointer;
  padding: 12px 18px; transition: filter .12s ease, background .12s ease;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: #fff; border: 1.5px solid var(--line); color: var(--text); }
.btn-secondary:hover { border-color: var(--ink); }
.btn-secondary:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }

.login-foot { text-align: center; font-size: 12px; color: var(--text-mute); margin-top: 14px; }

/* ---------------- Info / blocked pages ---------------- */
.info-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--ink); padding: 24px;
}
.info-card {
  max-width: 460px; width: 100%; background: #fff; border-radius: 16px; padding: 34px 30px;
  text-align: center; box-shadow: var(--shadow);
}
.info-icon { font-size: 44px; margin-bottom: 14px; }
.info-icon.danger { color: var(--danger); }
.info-icon.success { color: var(--success); }
.info-card h1 { font-size: 20px; margin: 0 0 10px; }
.info-card p { font-size: 14.5px; color: var(--text-mute); line-height: 1.65; margin: 0 0 16px; }
.info-steps { text-align: left; background: var(--bg); border-radius: 10px; padding: 14px 16px 14px 34px; font-size: 13.5px; line-height: 1.9; margin: 0 0 16px; }

/* ---------------- Exam layout ---------------- */
.exam-page { background: var(--bg); }
.exam-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--ink); color: #fff; padding: 12px 20px; flex-wrap: wrap;
}
.exam-brand { display: flex; align-items: center; gap: 10px; }
.exam-brand i { font-size: 18px; color: #9AACD1; }
.exam-brand .title { font-weight: 700; font-size: 14.5px; line-height: 1.2; }
.exam-brand .subtitle { font-size: 11.5px; color: #9AACD1; }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,0.1); color: #DCE6FF;
}
.sync-pill.saving { background: var(--doubt); color: #3A2A00; }
.sync-pill.saved { background: var(--success); color: #fff; }
.sync-pill.error { background: var(--danger); color: #fff; }

.timer-pill {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; letter-spacing: .02em;
  background: rgba(255,255,255,0.1); padding: 7px 14px; border-radius: 999px; display: flex; align-items: center; gap: 8px;
}
.timer-pill.warn { background: var(--doubt); color: #3A2A00; }
.timer-pill.danger { background: var(--danger); color: #fff; }

.student-chip { text-align: right; line-height: 1.3; }
.student-chip .name { display: block; font-size: 13.5px; font-weight: 700; }
.student-chip .meta { display: block; font-size: 11px; color: #9AACD1; }

.exam-layout { display: flex; align-items: flex-start; min-height: calc(100vh - 58px); }

.exam-nav {
  width: 280px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  padding: 18px 16px 22px; position: sticky; top: 58px; height: calc(100vh - 58px);
  display: flex; flex-direction: column; overflow-y: auto;
}
.exam-nav h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800;
  color: var(--text-mute); margin: 0 0 12px;
}
.nav-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.nav-cell {
  aspect-ratio: 1; border-radius: 8px; border: 1.5px solid var(--line); background: #fff;
  font-weight: 700; font-size: 13px; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.nav-cell i { position: absolute; top: 2px; right: 2px; font-size: 8px; }
.nav-cell.answered { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.nav-cell.doubt { background: var(--doubt-soft); border-color: var(--doubt); color: #8A6300; }
.nav-cell.current { outline: 2.5px solid var(--ink); outline-offset: 2px; }

.nav-legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--text-mute); margin-bottom: auto; }
.nav-legend span { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-dot.answered { background: var(--accent); }
.legend-dot.doubt { background: var(--doubt); }
.legend-dot.empty { background: #D9DEE8; }

.exam-main { flex: 1; padding: 26px 32px 60px; max-width: 780px; margin: 0 auto; width: 100%; }

.question-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 26px 28px; box-shadow: var(--shadow); }
.question-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.question-head .qnum { font-size: 18px; font-weight: 800; color: var(--ink); }

.btn-doubt {
  display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--line); background: #fff;
  color: var(--text-mute); font-size: 12.5px; font-weight: 700; padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.btn-doubt:hover { border-color: var(--doubt); color: #8A6300; }
.btn-doubt.active { background: var(--doubt-soft); border-color: var(--doubt); color: #8A6300; }

.question-text { font-size: 16.5px; line-height: 1.75; margin: 0 0 20px; }
.question-text img { max-width: 100%; border-radius: 8px; }
.question-text table { max-width: 100%; }
.question-text .quill-better-table-wrapper { overflow-x: auto; max-width: 100%; margin-bottom: 12px; }

/* ---- Kontrol pemilihan jawaban (soal + pilihan sudah menyatu di teks,
   jadi siswa memilih lewat badge huruf / tombol Benar-Salah di bawahnya) ---- */
.answer-picker-wrap { border-top: 1px dashed var(--line); padding-top: 16px; }
.answer-picker-label { font-size: 12.5px; font-weight: 700; color: var(--text-mute); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 10px; }
.answer-picker { display: flex; gap: 10px; flex-wrap: wrap; }

.letter-badge {
  width: 46px; height: 46px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff;
  font-size: 16px; font-weight: 800; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.letter-badge:hover { border-color: var(--accent); }
.letter-badge.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

.tf-btn {
  min-width: 120px; padding: 13px 20px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff;
  font-size: 14.5px; font-weight: 700; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.tf-btn:hover { border-color: var(--accent); }
.tf-btn.selected.tf-true { background: var(--success-soft); border-color: var(--success); color: #1F7A45; }
.tf-btn.selected.tf-false { background: var(--danger-soft); border-color: var(--danger); color: #A32E2E; }

.question-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; gap: 12px; }
.save-status { font-size: 12px; color: var(--text-mute); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10,18,38,0.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 14px; padding: 26px; max-width: 400px; width: 100%; }
.modal-card h2 { font-size: 18.5px; margin: 0 0 10px; }
.modal-card p { font-size: 14px; color: var(--text-mute); line-height: 1.65; margin: 0 0 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 780px) {
  .exam-layout { flex-direction: column; }
  .exam-nav { width: 100%; position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .nav-grid { grid-template-columns: repeat(8, 1fr); }
  .exam-main { padding: 18px 16px 40px; }
}

@media (max-width: 720px) {
  .examcard-page { align-items: flex-start; padding-top: 32px; }
  .examcard-shell { flex-direction: column; max-width: 440px; border-radius: 16px; }
  .examcard-brand { padding: 24px 22px; }
  .examcard-security { border-top: none; margin-top: 18px; padding-top: 0; }
  .examcard-perforation {
    flex: 0 0 1px;
    background-image: radial-gradient(circle, rgba(255,255,255,0.25) 1.6px, transparent 1.8px);
    background-size: 13px 100%;
    background-repeat: repeat-x;
    background-position: center;
  }
  .examcard-form-panel { padding: 26px 22px 24px; }
  .examcard-field { flex-direction: column; gap: 6px; }
  .examcard-field-no { width: auto; padding-top: 0; }
  .examcard-field-row { flex-direction: column; }
  .examcard-submit-row { padding-left: 0; flex-direction: column; }
}