/* ===================================================
   test.css – Premium TMUA Exam Interface Styling
   EduQuest TMUA Platform
   =================================================== */

:root {
  --bg: #0d0d14;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(5, 150, 105, 0.5);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.5);
  --accent: #059669;
  --accent-light: #34d399;
  --accent-glow: rgba(5, 150, 105, 0.25);
  --danger: #dc2626;
  --warn: #d97706;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────── */
.hdr {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(13, 13, 20, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.hdr-brand {
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hdr-pill {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'IBM Plex Sans', sans-serif;
}

.hdr-module {
  color: var(--accent-light);
  font-size: 0.9rem;
  font-weight: 600;
}

.timer {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: 100px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-light);
  box-shadow: 0 0 15px rgba(5, 150, 105, 0.15);
  transition: all 0.3s ease;
}

.timer.warn {
  border-color: var(--danger);
  color: #f87171;
  background: rgba(220, 38, 38, 0.15);
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

/* ── Pages ──────────────────────────────────── */
.page { display: none; flex: 1; }
.page.active { display: flex; flex-direction: column; }

/* ── Registration / Start Screen ────────────── */
.reg-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.reg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  max-width: 580px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
}

.reg-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #059669, #34d399);
}

.reg-top {
  padding: 36px 36px 24px;
  text-align: center;
}

.reg-top .icon { font-size: 3rem; display: block; margin-bottom: 12px; }
.reg-top h2 { font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.reg-top p { color: var(--muted); font-size: 0.95rem; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-strip .s {
  padding: 16px 10px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stat-strip .s:last-child { border-right: none; }
.stat-strip .val { font-family: 'Syne', sans-serif; font-size: 1.25rem; font-weight: 800; color: var(--accent-light); }
.stat-strip .lbl { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; margin-top: 2px; }

.reg-body { padding: 32px 36px 36px; }

.field { margin-bottom: 20px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.field input, .field select {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus { border-color: var(--accent); }

.phone-row { display: flex; gap: 10px; }
.phone-row select { width: 150px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  box-shadow: 0 8px 20px rgba(5, 150, 105, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 25px rgba(5, 150, 105, 0.4); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-outline:hover { border-color: var(--accent); color: #fff; background: rgba(5, 150, 105, 0.1); }

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(220, 38, 38, 0.3); }

/* ── Test Arena Layout ──────────────────────── */
.test-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  gap: 28px;
  padding: 28px;
}

main { display: flex; flex-direction: column; gap: 20px; }

.mod-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mod-name { font-family: 'Syne', sans-serif; font-size: 1.15rem; font-weight: 700; color: #fff; }
.mod-info { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

.q-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.q-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.q-badge { background: var(--accent-glow); color: var(--accent-light); border: 1px solid rgba(5, 150, 105, 0.4); font-size: 0.8rem; font-weight: 700; padding: 4px 12px; border-radius: 100px; }
.q-topic-tag { font-size: 0.82rem; color: var(--muted); background: rgba(255, 255, 255, 0.05); padding: 4px 12px; border-radius: 6px; }

.q-text { font-size: 1.1rem; line-height: 1.7; color: rgba(255, 255, 255, 0.95); margin-bottom: 28px; }

.opts { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; }

.opt {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.opt:hover { background: var(--surface-hover); border-color: rgba(255, 255, 255, 0.2); transform: translateX(4px); }
.opt.selected { background: rgba(5, 150, 105, 0.15); border-color: var(--accent); }

.opt-letter {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 700; font-size: 0.95rem;
  flex-shrink: 0;
  transition: background 0.2s;
}
.opt.selected .opt-letter { background: var(--accent); color: #fff; }
.opt-text { font-size: 0.98rem; line-height: 1.5; flex: 1; }

.q-nav {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ── Sidebar Palette ────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.palette-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.palette-card h3 { font-family: 'Syne', sans-serif; font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }

.pal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 24px;
  overflow-y: auto;
  max-height: 380px;
  padding-right: 4px;
}

.pb {
  aspect-ratio: 1;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.pb:hover { border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.pb.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.pb.cur { border: 2px solid #60a5fa; color: #60a5fa; box-shadow: 0 0 10px rgba(96, 165, 250, 0.3); }
.pb.done.cur { border-color: #fff; box-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }

.legend { display: flex; justify-content: space-around; font-size: 0.8rem; color: var(--muted); margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.leg { display: flex; align-items: center; gap: 8px; }
.leg-dot { width: 12px; height: 12px; border-radius: 50%; }

.prog-wrap { margin-top: auto; }
.prog-bg { height: 8px; background: rgba(255, 255, 255, 0.06); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.prog-fill { height: 100%; background: linear-gradient(90deg, #059669, #34d399); transition: width 0.3s ease; }
.prog-lbl { font-size: 0.82rem; color: var(--muted); text-align: right; }

/* ── Modals & Saving Overlays ───────────────── */
.saving-overlay {
  position: fixed; inset: 0;
  background: rgba(13, 13, 20, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center; justify-content: center; flex-direction: column; gap: 16px;
}
.saving-overlay.show { display: flex; }
.spin { width: 44px; height: 44px; border: 4px solid rgba(5, 150, 105, 0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 900;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: #151522;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 32px;
  max-width: 440px; width: 100%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.modal h3 { font-family: 'Syne', sans-serif; font-size: 1.4rem; margin-bottom: 12px; }
.modal p { color: var(--muted); font-size: 0.95rem; line-height: 1.6; margin-bottom: 24px; }
.modal-btns { display: flex; gap: 12px; justify-content: center; }

/* ── Results Page ───────────────────────────── */
.res-wrap { max-width: 1100px; width: 100%; margin: 0 auto; padding: 40px 24px 80px; }
.res-hero { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 40px; text-align: center; margin-bottom: 32px; position: relative; overflow: hidden; }
.res-hero::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, #059669, #34d399); }
.sat-score { font-family: 'Syne', sans-serif; font-size: 4.5rem; font-weight: 800; margin: 12px 0 8px; line-height: 1; }
.score-line { font-size: 1.25rem; font-weight: 600; color: #fff; margin-bottom: 8px; }
.score-sub { color: var(--muted); font-size: 0.95rem; }
.saved-badge { display: inline-block; margin-top: 20px; padding: 6px 16px; border-radius: 100px; font-size: 0.82rem; font-weight: 600; background: rgba(5, 150, 105, 0.15); border: 1px solid rgba(5, 150, 105, 0.3); color: #6ee7b7; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; text-align: center; }
.stat-card .num { font-family: 'Syne', sans-serif; font-size: 2.2rem; font-weight: 800; }
.stat-card.c .num { color: #6ee7b7; }
.stat-card.w .num { color: #f87171; }
.stat-card.s .num { color: #fbbf24; }
.stat-card .lbl { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; margin-top: 6px; }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 32px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px; }
.chart-card h3 { font-family: 'Syne', sans-serif; font-size: 1.15rem; margin-bottom: 20px; }

.grade-table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px; margin-bottom: 32px; }
.grade-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.grade-table th { text-align: left; padding: 12px; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.grade-table td { padding: 14px 12px; font-size: 0.95rem; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.grade-table tr.active-grade { background: rgba(5, 150, 105, 0.15); font-weight: 700; color: #6ee7b7; }

.review-sec h3 { font-family: 'Syne', sans-serif; font-size: 1.4rem; margin-bottom: 20px; }
.rev-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; margin-bottom: 16px; }
.rev-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.rev-qnum { font-weight: 700; font-size: 1.05rem; }
.rev-status { padding: 4px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; }
.rev-status.correct { background: rgba(5, 150, 105, 0.2); color: #6ee7b7; }
.rev-status.wrong { background: rgba(220, 38, 38, 0.2); color: #f87171; }
.rev-status.unattempted { background: rgba(217, 119, 6, 0.2); color: #fbbf24; }
.rev-text { font-size: 1rem; line-height: 1.6; margin-bottom: 16px; }
.rev-ans { font-size: 0.9rem; color: var(--muted); margin-bottom: 16px; }
.rev-exp { background: rgba(5, 150, 105, 0.08); border-left: 3px solid var(--accent); padding: 14px 18px; border-radius: 0 10px 10px 0; font-size: 0.9rem; line-height: 1.6; color: #a7f3d0; }

@media (max-width: 900px) {
  .test-wrap { grid-template-columns: 1fr; }
  .charts-row, .stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .charts-row, .stats-row { grid-template-columns: 1fr; }
  .sat-score { font-size: 3.5rem; }
}
