/* ============================================================
   MPA Exam Platform v3.0 — ESSLCE Style
   Merciful Paradise Academy
   ============================================================ */

:root {
  --primary:      #1d9e6f;
  --primary-dark: #158a5e;
  --primary-soft: #e8f7f1;
  --accent:       #2563eb;
  --accent-soft:  #eff6ff;
  --navy:         #0a1639;
  --navy-soft:    #1e2f5c;
  --warning:      #d97706;
  --warning-soft: #fef3c7;
  --danger:       #dc2626;
  --danger-soft:  #fee2e2;
  --success:      #16a34a;
  --success-soft: #dcfce7;
  --info:         #0891b2;
  --info-soft:    #e0f2fe;
  --panel:        #ffffff;
  --bg:           #f0f4fb;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-light:   #94a3b8;
  --shadow:       0 2px 8px rgba(0,0,0,.07);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.12);
  --radius:       10px;
  --radius-lg:    16px;
  --sidebar-w:    240px;
  --topbar-h:     60px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; }

/* ── Shell layout ───────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; position: relative; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
  transition: transform .28s cubic-bezier(.4,0,.2,1), width .28s cubic-bezier(.4,0,.2,1);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* ── Sidebar Brand ──────────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 76px;
  cursor: pointer;
}
.sidebar-logo {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 2.5px solid rgba(255,255,255,.3);
  flex-shrink: 0;
  transition: width .28s, height .28s;
  overflow: hidden;
  background: rgba(255,255,255,.1);
}
.sidebar-school { color: #fff; font-size: 13px; font-weight: 700; line-height: 1.3; }
.sidebar-role   { color: rgba(255,255,255,.5); font-size: 11px; margin-top: 1px; }
.sidebar-brand-text { overflow: hidden; transition: opacity .2s, max-width .28s; max-width: 200px; }

/* Collapsed sidebar */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-brand-text { opacity: 0; max-width: 0; }
.sidebar.collapsed .sidebar-logo { width: 36px; height: 36px; min-width: 36px; }
.sidebar.collapsed .nav-label { opacity: 0; max-width: 0; overflow: hidden; }
.sidebar.collapsed .sidebar-footer-text { opacity: 0; max-width: 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .nav-icon { margin: 0; }
.sidebar.collapsed .sidebar-footer { padding: 12px 0; justify-content: center; }
.sidebar.collapsed .sidebar-user { display: none; }

/* ── Nav items ──────────────────────────────────────────── */
.sidebar-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.72);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item.nav-logout { color: rgba(255,100,100,.8); margin-top: 4px; }
.nav-item.nav-logout:hover { background: rgba(220,50,50,.15); color: #ff8080; }
.nav-icon { font-size: 17px; flex-shrink: 0; width: 22px; text-align: center; }
.nav-label { transition: opacity .2s, max-width .28s; max-width: 160px; overflow: hidden; }
.nav-badge { background: var(--danger); color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 6px; font-weight: 700; margin-left: auto; }

/* ── Sidebar footer ─────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 14px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}
.sidebar-user-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sidebar-username { color: #fff; font-size: 12.5px; font-weight: 600; }
.sidebar-userrole { color: rgba(255,255,255,.45); font-size: 11px; }
.sidebar-footer-text { overflow: hidden; transition: opacity .2s, max-width .28s; max-width: 160px; }

/* Sidebar toggle button */
.sidebar-toggle-btn {
  display: none;
  position: absolute;
  top: 18px;
  right: -14px;
  width: 28px;
  height: 28px;
  background: var(--navy);
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.7);
  font-size: 13px;
  z-index: 210;
  transition: transform .2s;
}
.sidebar:not(.collapsed) .sidebar-toggle-btn { transform: rotate(180deg); }

/* ── Main content ───────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}
.main-content.expanded { margin-left: 64px; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.topbar-brand { font-size: 14px; font-weight: 600; color: var(--navy); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.topbar-time { color: var(--text-muted); font-size: 13px; }
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  font-size: 18px;
  border-radius: 6px;
  line-height: 1;
  display: none;
}
.hamburger:hover { background: var(--bg); color: var(--text); }
.desktop-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 18px;
  border-radius: 6px;
  line-height: 1;
  transition: background .15s;
}
.desktop-toggle:hover { background: var(--bg); color: var(--text); }

/* ── Page wrap ──────────────────────────────────────────── */
.page-wrap { flex: 1; padding: 24px; max-width: 1400px; width: 100%; }
.page-header { margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--navy); }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.section { margin-bottom: 24px; }

/* ── Stats grid ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--stat-color, var(--primary));
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { font-size: 26px; line-height: 1; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--stat-color, var(--primary)); line-height: 1; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-sub { font-size: 11.5px; color: var(--text-light); }

/* ── Cards ──────────────────────────────────────────────── */
.card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 14px; }

/* ── Grids ──────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ── Filters bar ────────────────────────────────────────── */
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  background: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--primary); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1.4;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-navy      { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-soft); }
.btn-sm  { padding: 5px 11px; font-size: 12.5px; border-radius: 6px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; border-radius: 10px; }
.btn-xl  { padding: 14px 32px; font-size: 16px; border-radius: 12px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: var(--danger); }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,158,111,.12); }
.form-control[readonly] { background: var(--bg); color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.form-check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  background: var(--bg);
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--primary); }
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(29,158,111,.04); }
.table-empty { text-align: center; color: var(--text-muted); padding: 40px !important; font-size: 14px; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fw-600 { font-weight: 600; }
.fw-bold { font-weight: 700; }
.fs-sm { font-size: 13px; }
.fs-xs { font-size: 11.5px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2px;
}
.badge-primary { background: var(--accent-soft);   color: var(--accent); }
.badge-success { background: var(--success-soft);  color: var(--success); }
.badge-warning { background: var(--warning-soft);  color: var(--warning); }
.badge-danger  { background: var(--danger-soft);   color: var(--danger); }
.badge-muted   { background: var(--bg);             color: var(--text-muted); }
.badge-accent  { background: var(--accent-soft);   color: var(--accent); }
.badge-info    { background: var(--info-soft);      color: var(--info); }
.badge-navy    { background: rgba(10,22,57,.08);    color: var(--navy); }

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 16px;
  border-left: 4px solid;
  animation: slideDown .25s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }
.alert-success { background: var(--success-soft); color: #15803d; border-color: var(--success); }
.alert-error   { background: var(--danger-soft);  color: #b91c1c; border-color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: var(--warning); }
.alert-info    { background: var(--info-soft);    color: #0e7490; border-color: var(--info); }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  /* Use flex column so header+footer are sticky, only body scrolls */
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp .22s ease;
  overflow: hidden; /* clip at border-radius */
}
@keyframes slideUp { from { transform:translateY(20px); opacity:0; } to { transform:none; opacity:1; } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; /* never compress header */
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); padding: 4px; border-radius: 6px; line-height: 1; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body   {
  padding: 20px 22px;
  overflow-y: auto;  /* only the body scrolls */
  flex: 1 1 auto;
}
.modal-footer {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
  flex-shrink: 0; /* always visible at bottom */
  background: #fff;
}

/* ── Sidebar overlay (mobile) ───────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pagination-info { font-size: 13px; color: var(--text-muted); }

/* ── Progress bar ───────────────────────────────────────── */
.progress { background: var(--border); border-radius: 10px; height: 8px; overflow: hidden; }
.progress-bar { background: var(--primary); height: 100%; border-radius: 10px; transition: width .4s; }

/* ── LOGIN PAGE ─────────────────────────────────────────── */
.login-page {
  background: linear-gradient(135deg, var(--navy) 0%, #1a2f5a 50%, #0d2040 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-container { width: 100%; max-width: 500px; }
.login-card {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-header {
  background: var(--navy);
  padding: 32px 32px 24px;
  text-align: center;
}
.login-logo {
  width: 90px;
  height: 90px;
  min-width: 90px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 3px solid rgba(255,255,255,.35);
  margin: 0 auto 14px;
  display: block;
  overflow: hidden;
  background: rgba(255,255,255,.1);
}
.login-school { color: #fff; font-size: 18px; font-weight: 800; line-height: 1.3; }
.login-tagline { color: rgba(255,255,255,.6); font-size: 13px; margin-top: 4px; }
.login-body { padding: 28px 32px; }

/* Login tabs */
.login-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 22px; }
.login-tab {
  flex: 1;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PENDING APPROVALS badge on dashboard ───────────────── */
.pending-badge {
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-left: 6px;
}

/* ── Question image upload ───────────────────────────────── */
.img-preview { margin-top: 8px; border-radius: 8px; max-height: 200px; border: 1px solid var(--border); }
.option-img-preview { max-height: 60px; border-radius: 6px; border: 1px solid var(--border); margin-top: 4px; }

/* ── EXAM SHELL (ESSLCE style) ──────────────────────────── */
body.exam-page {
  background: #f0f4fb;
  min-height: 100vh;
}

.exam-topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.exam-school-logo {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 2px solid rgba(255,255,255,.3);
  overflow: hidden;
  background: rgba(255,255,255,.1);
}
.exam-topbar-left { display: flex; align-items: center; gap: 12px; }
.exam-title-main { font-size: 15px; font-weight: 700; }
.exam-subject-label { font-size: 12px; color: rgba(255,255,255,.6); }
.exam-topbar-right { display: flex; align-items: center; gap: 18px; }

/* Timer — ESSLCE style */
.timer-box {
  background: rgba(255,255,255,.12);
  border: 2px solid rgba(255,255,255,.2);
  border-radius: 10px;
  padding: 7px 18px;
  font-size: 22px;
  font-weight: 800;
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
  min-width: 110px;
  text-align: center;
  transition: background .3s, border-color .3s;
}
.timer-box.warning  { background: rgba(217,119,6,.4);  border-color: var(--warning); animation: timerPulse 2s infinite; }
.timer-box.critical { background: rgba(220,38,38,.5);  border-color: var(--danger);  animation: timerPulse .7s infinite; }
@keyframes timerPulse { 50% { opacity: .7; } }

.exam-student-info { font-size: 12.5px; color: rgba(255,255,255,.7); text-align: right; }
.exam-student-name { color: #fff; font-weight: 600; }

/* Exam body layout — 2-column like ESSLCE */
.exam-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px 24px;
  align-items: start;
}

/* Question card */
.question-card {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.question-num {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}
.question-marks {
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 20px;
}
.question-text {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 18px;
}
.question-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* Options — ESSLCE style (A B C D boxes) */
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.option-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.option-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.option-item.flagged  { border-color: var(--warning); background: var(--warning-soft); }
.option-item input[type=radio] { display: none; }
.option-letter {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.option-item.selected .option-letter { background: var(--primary); border-color: var(--primary); color: #fff; }
.option-item.flagged .option-letter  { background: var(--warning); border-color: var(--warning); color: #fff; }
.option-text-wrap { flex: 1; }
.option-text-content { font-size: 14.5px; color: var(--text); line-height: 1.5; }
.option-img-wrap img { max-height: 80px; border-radius: 6px; margin-top: 6px; }
.flag-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1.5px solid var(--border) !important;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  transition: all .15s;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
}
.flag-btn:hover {
  border-color: var(--warning) !important;
  color: var(--warning);
  background: var(--warning-soft);
}
.flag-btn.flagged {
  border-color: var(--warning) !important;
  color: var(--warning);
  background: var(--warning-soft);
  font-weight: 700;
}

/* ── Exam sidebar panel ──────────────────────────────────── */
.exam-sidebar-panel {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 80px;
}
.exam-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.q-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 14px;
}
.q-nav-btn {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.q-nav-btn:hover   { border-color: var(--primary); color: var(--primary); }
.q-nav-btn.answered{ background: var(--primary); border-color: var(--primary); color: #fff; }
.q-nav-btn.flagged { background: var(--warning);  border-color: var(--warning);  color: #fff; }
.q-nav-btn.current { border-color: var(--navy); color: var(--navy); box-shadow: 0 0 0 2px rgba(10,22,57,.15); }
.nav-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; font-size: 11px; color: var(--text-muted); }
.nav-legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid currentColor; }
.legend-dot.answered { background: var(--primary); border-color: var(--primary); }
.legend-dot.flagged  { background: var(--warning);  border-color: var(--warning); }
.legend-dot.unanswered{ background: #fff; border-color: var(--border); }

/* ── Summary bar before submit ───────────────────────────── */
.exam-summary-bar {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.exam-summary-stat { text-align: center; }
.exam-summary-num  { font-size: 24px; font-weight: 800; color: var(--navy); }
.exam-summary-lbl  { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }

/* ── General direction / instructions box ─────────────────── */
.exam-instructions {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1.5px solid var(--warning);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.7;
}
.exam-instructions h4 { color: var(--warning); margin-bottom: 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; }

/* ── Completion page ─────────────────────────────────────── */
.exam-complete-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.exam-complete-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
}
.complete-icon { font-size: 64px; margin-bottom: 16px; }

/* ── Login page extra ────────────────────────────────────── */
.student-id-preview {
  background: var(--primary-soft);
  border: 1.5px solid var(--primary);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13.5px;
  margin-top: 10px;
  display: none;
}
.student-id-preview .preview-name { font-size: 16px; font-weight: 700; color: var(--navy); }
.student-id-preview .preview-meta { color: var(--text-muted); font-size: 12.5px; margin-top: 3px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar.collapsed { width: var(--sidebar-w) !important; transform: translateX(-100%); }
  .sidebar-overlay.open { display: block; }
  .sidebar-brand-text, .nav-label, .sidebar-footer-text { opacity: 1 !important; max-width: 200px !important; }
  .nav-item { justify-content: flex-start !important; padding: 10px 12px !important; }
  .nav-icon { margin: 0 !important; }
  .sidebar-user { display: flex !important; }
  .sidebar-footer { padding: 14px 10px 10px !important; justify-content: flex-start !important; }
  .main-content { margin-left: 0 !important; }
  .hamburger { display: flex !important; }
  .desktop-toggle { display: none !important; }
  .exam-layout { grid-template-columns: 1fr; }
  .exam-sidebar-panel { position: static; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page-wrap { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .exam-topbar { padding: 0 14px; }
  .exam-layout { padding: 14px; }
  .login-body { padding: 20px; }
  .login-header { padding: 24px 20px 18px; }
}
