/* QuizCBT — palet "Lembar Jawaban": kertas ujian, tinta biru, stempel merah koreksi */
:root {
  --paper: #fbfaf6;
  --sheet: #ffffff;
  --ink: #1d2b50;          /* tinta biru tua */
  --ink-soft: #55618a;
  --line: #d9d7cc;         /* garis lembar jawaban */
  --mark: #1f6f54;         /* hijau "benar" */
  --wrong: #b3372f;        /* merah koreksi */
  --accent: #2547c9;       /* bolpoin biru */
  --radius: 6px;
  font-size: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  background-image: repeating-linear-gradient(transparent 0 31px, rgba(37,71,201,.045) 31px 32px);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.55;
}
h1, h2, h3, .brand, th, .btn, nav, .tag, .timer, .qnav, label, .topbar, .muted, .flash, .inline-form, input, select, textarea, button, .foot {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
h1 { font-size: 1.5rem; border-bottom: 3px double var(--line); padding-bottom: .4rem; }
h2 { font-size: 1.1rem; }
a { color: var(--accent); }
.container { max-width: 1080px; margin: 1.2rem auto 3rem; padding: 0 1rem; }
.topbar { background: var(--ink); color: #fff; }
.topbar-inner { max-width: 1080px; margin: auto; display: flex; align-items: center; justify-content: space-between; padding: .55rem 1rem; flex-wrap: wrap; gap: .5rem; }
.brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .5px; }
.brand-mark { color: #ffd166; }
.topbar nav { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.topbar nav a { color: #dfe4ff; text-decoration: none; }
.topbar nav a:hover { color: #fff; }
.who { color: #aab4e8; font-size: .85rem; }
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0; box-shadow: 0 1px 0 rgba(29,43,80,.06); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
label { display: block; margin: .55rem 0; font-size: .92rem; }
input, select, textarea { width: 100%; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 4px; font-size: .95rem; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 100px; }
.inline-form { display: inline-flex; gap: .35rem; align-items: center; margin: .15rem 0; }
.inline-form input, .inline-form select { width: auto; }
.btn { display: inline-block; padding: .45rem .9rem; border: 1px solid var(--ink); background: #fff; color: var(--ink); border-radius: 4px; cursor: pointer; font-size: .9rem; text-decoration: none; }
.btn:hover { background: #eef1ff; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1c38a3; }
.btn-danger { border-color: var(--wrong); color: var(--wrong); }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: .2rem .55rem; font-size: .8rem; }
table { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: .92rem; }
th { text-align: left; border-bottom: 2px solid var(--ink); padding: .4rem .5rem; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
td { border-bottom: 1px solid var(--line); padding: .45rem .5rem; vertical-align: top; }
.muted { color: var(--ink-soft); font-size: .9rem; }
.flash { padding: .6rem .9rem; border-radius: 4px; margin: .8rem 0; font-size: .92rem; }
.flash-ok { background: #e8f4ee; border: 1px solid var(--mark); color: var(--mark); }
.flash-err { background: #fdecea; border: 1px solid var(--wrong); color: var(--wrong); }
.tag { display: inline-block; font-size: .72rem; padding: .1rem .5rem; border-radius: 99px; border: 1px solid currentColor; }
.tag-user { color: var(--ink-soft); }
.tag-manager { color: var(--accent); }
.tag-superadmin { color: var(--wrong); }
.auth-card { max-width: 420px; margin: 8vh auto; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: 0 8px 24px rgba(29,43,80,.08); }
.foot { text-align: center; color: var(--ink-soft); font-size: .8rem; padding: 1rem; }
code { background: #eef1ff; padding: 0 .3rem; border-radius: 3px; font-size: .85em; }

/* ==== halaman ujian ==== */
.exam-head { position: sticky; top: 0; z-index: 5; background: var(--ink); color: #fff; padding: .5rem .9rem; display: flex; justify-content: space-between; align-items: center; border-radius: 0 0 var(--radius) var(--radius); }
.timer { font-variant-numeric: tabular-nums; font-size: 1.25rem; font-weight: 700; color: #ffd166; }
.timer.danger { color: #ff8f87; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .timer.danger { animation: none; } }
.q-card { background: var(--sheet); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0; }
.q-num { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.q-media { display: block; max-width: 100%; margin: .6rem 0; border: 1px solid var(--line); border-radius: 4px; }
.opt { display: flex; gap: .55rem; align-items: flex-start; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 4px; margin: .35rem 0; cursor: pointer; background: #fff; }
.opt:hover { border-color: var(--accent); }
.opt input { width: auto; margin-top: .25rem; }
.qnav { display: flex; flex-wrap: wrap; gap: .3rem; margin: .8rem 0; }
.qnav a { display: inline-flex; width: 2.1rem; height: 2.1rem; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; color: var(--ink); font-size: .85rem; }
.qnav a.done { background: var(--mark); border-color: var(--mark); color: #fff; }
.score-big { font-size: 2.6rem; font-weight: 800; color: var(--accent); }
.correct { color: var(--mark); font-weight: 600; }
.incorrect { color: var(--wrong); font-weight: 600; }
.match-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; align-items: center; margin: .35rem 0; }
.bar { background: #eef1ff; border-radius: 3px; height: 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* ==== v3: tombol & navigasi yang lebih "proper" ==== */
.btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  box-shadow: 0 1px 2px rgba(29,43,80,.12); transition: background .15s, transform .06s; }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 32px; }
.btn-back { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.btn-back::before { content: "←"; font-weight: 700; }
.btn-back:hover { background: #33406b; color: #fff; }
.btn-topbar { border-color: #fff; color: #fff; background: transparent; box-shadow: none; }
.btn-topbar:hover { background: rgba(255,255,255,.15); }
.backbar { margin: .2rem 0 .8rem; }

/* ==== v3: banner peringatan pindah tab (tanpa rekam) ==== */
.tab-notice { position: fixed; left: 50%; bottom: 1rem; transform: translate(-50%, 130%);
  background: var(--wrong); color: #fff; padding: .7rem 1.1rem; border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 99; max-width: 92vw; font-family: 'Segoe UI', sans-serif;
  transition: transform .25s ease; }
.tab-notice.show { transform: translate(-50%, 0); }

/* ==== v3: responsive smartphone ==== */
img, video, iframe { max-width: 100%; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) {
  :root { font-size: 15px; }
  .container { padding: 0 .7rem; margin-top: .8rem; }
  h1 { font-size: 1.25rem; }
  .card, .q-card { padding: .8rem .8rem; }
  /* tabel bisa digeser horizontal */
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  table td, table th { white-space: normal; min-width: 90px; }
  /* form & tombol nyaman disentuh */
  .inline-form { flex-wrap: wrap; }
  .inline-form input, .inline-form select { min-width: 0; }
  .btn { padding: .5rem .8rem; }
  input, select, textarea, .btn { font-size: 16px; } /* cegah zoom otomatis iOS */
  .topbar-inner { padding: .5rem .7rem; }
  .topbar nav { gap: .55rem; font-size: .9rem; }
  .who { width: 100%; order: 9; }
  .match-row { grid-template-columns: 1fr; gap: .2rem; }
  .exam-head { flex-wrap: wrap; gap: .3rem; }
  .score-big { font-size: 2rem; }
  .auth-card { margin: 4vh auto; padding: 1.1rem; }
  .qnav a { width: 2.4rem; height: 2.4rem; }
  .opt { padding: .6rem .6rem; }
}
@media (max-width: 420px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar nav a { padding: .15rem .1rem; }
}

/* ==== v4: logo & navigasi tombol responsif ==== */
.brand { display: inline-flex; align-items: center; gap: .5rem; }
.brand { min-width: 0; max-width: 62%; overflow: hidden; }
.brand-logo { display: block; height: auto; width: auto;
  max-height: 34px; max-width: min(130px, 30vw);
  object-fit: contain; border-radius: 4px; background: #fff; padding: 2px; flex: 0 1 auto; }
.nav-btns { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.nav-btn { display: inline-flex; align-items: center; gap: .3rem; padding: .38rem .75rem;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px; color: #eef1ff !important;
  text-decoration: none; font-size: .86rem; background: rgba(255,255,255,.07); transition: background .15s; }
.nav-btn:hover { background: rgba(255,255,255,.2); color: #fff !important; }
.nav-btn-out { border-color: #ffb4ac; color: #ffd7d3 !important; }
.nav-btn-out:hover { background: rgba(255,120,110,.25); }
.impersonate-bar { background: #ffd166; color: var(--ink); display: flex; gap: .8rem; align-items: center;
  justify-content: center; flex-wrap: wrap; padding: .45rem .8rem; font-family: 'Segoe UI', sans-serif;
  font-size: .9rem; border-bottom: 1px solid #e3b64e; }
@media (max-width: 760px) {
  .nav-btn { padding: .32rem .6rem; font-size: .8rem; }
  .brand-logo { max-height: 26px; max-width: min(96px, 26vw); }
  .brand { max-width: 58%; font-size: .95rem; }
}

/* ==== v5: modal konfirmasi di dalam halaman ==== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,28,55,.55); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal-box { background: var(--sheet); border-radius: 12px; padding: 1.3rem 1.5rem; max-width: 420px;
  width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  font-family: 'Segoe UI', system-ui, sans-serif; animation: pop .16s ease; }
@keyframes pop { from { transform: scale(.94); opacity: .4; } to { transform: scale(1); opacity: 1; } }

/* ==== v6: logo pada halaman masuk ==== */
.auth-logo { display: inline-block; height: auto; width: auto; max-height: 76px; max-width: min(220px, 62vw);
  object-fit: contain; }

/* ==== v6: modal kumpulkan jawaban ==== */
.modal-box .modal-ico { font-size: 2rem; line-height: 1; margin-bottom: .4rem; }
.modal-box h3 { margin: 0 0 .5rem; font-size: 1.15rem; }
.modal-box p { margin: .2rem 0; font-size: .92rem; }
.modal-box .modal-stat { margin-top: .5rem; }
.modal-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.1rem; }
.modal-actions .btn { flex: 1 1 auto; min-width: 150px; justify-content: center; }
@media (max-width: 420px) { .modal-actions .btn { flex: 1 1 100%; } }
