/* ================================================================
   HỆ THỐNG THI GPLX - Admin & Exam CSS v2.1
   Kết hợp thiết kế nội bộ + chuẩn từ mẫu tham chiếu
   ================================================================ */

/* Google Fonts đã load trong header */
:root {
  /* Brand */
  --primary:        #1d4ed8;
  --primary-light:  #3b82f6;
  --primary-hover:  #1e40af;
  --primary-soft:   #eff6ff;

  /* Status */
  --success:  #16a34a;
  --danger:   #dc2626;
  --warning:  #d97706;
  --info:     #0891b2;

  /* Greys */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);

  /* Layout */
  --sidebar-w:    220px;
  --topbar-h:     60px;
  --radius:       8px;
  --radius-lg:    12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-100);
  line-height: 1.5;
  font-size: 15px;
}
a  { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #aab; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #778; }

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.4rem;  font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-muted    { color: var(--gray-500); }
.text-sm       { font-size: 0.875rem; }
.text-xs       { font-size: 0.75rem; }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* Spacing utils */
.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}
.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}
.mr-2{margin-right:.5rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}
.d-flex{display:flex}.align-center{align-items:center}.justify-between{justify-content:space-between}
.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}
.w-full{width:100%}.d-none{display:none}

/* ── Loading Spinner ── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal animation ── */
.modal-enter { animation: modalIn 0.2s ease-out; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ======= MODAL ======= */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: all 0.2s;
}
.modal.active { opacity: 1; pointer-events: auto; }
.modal-content {
  background: #fff; width: 90%; max-width: 500px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  transform: scale(0.95) translateY(10px);
  transition: all 0.2s;
  overflow: hidden;
}
.modal.active .modal-content { transform: scale(1) translateY(0); }
.modal-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--gray-800); margin: 0; }
.modal-close {
  background: none; border: none; font-size: 1.5rem; line-height: 1;
  color: var(--gray-500); cursor: pointer; padding: 0.25rem;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 1.25rem; max-height: 70vh; overflow-y: auto; }
.modal-footer {
  padding: 1rem 1.25rem; border-top: 1px solid var(--gray-100);
  background: var(--gray-50); display: flex; justify-content: flex-end; gap: 10px;
}

/* ────────────────────────────────────────────────────────────────
   ADMIN SIDEBAR LAYOUT
──────────────────────────────────────────────────────────────── */
.admin-body {
  display: flex;
  min-height: 100vh;
  background: var(--gray-100);
}

/* ── Sidebar ── */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  color: white;
}
.sidebar-brand-text { color: white; font-weight: 700; font-size: .95rem; line-height: 1.2; }
.sidebar-brand-sub  { color: var(--gray-400); font-size: 0.7rem; }

.sidebar-section-label {
  color: var(--gray-500);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 14px 18px 5px;
}

.sidebar-menu    { list-style: none; padding: 4px 0; }
.sidebar-menu li { padding: 1px 10px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: #94a3b8;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.15s;
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: white; text-decoration: none; }
.sidebar-link.active { background: var(--primary); color: white; }
.sidebar-link-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-user {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user-name { color: var(--gray-300); font-size: 0.83rem; font-weight: 600; margin-bottom: 2px; }
.sidebar-user-role { font-size: 0.72rem; }
.sidebar-logout {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px;
  color: #fca5a5;
  font-size: 0.82rem;
  font-weight: 500;
}
.sidebar-logout:hover { color: #f87171; text-decoration: none; }

/* ── Topbar ── */
.admin-topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.topbar-greeting { font-size: 0.875rem; color: var(--gray-600); }
.topbar-greeting strong { color: var(--gray-800); }
.topbar-role-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #ede9fe;
  color: #6d28d9;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 6px;
  letter-spacing: .03em;
}
.topbar-role-badge.admin { background: #fef9c3; color: #854d0e; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.btn-exam-link {
  display: flex; align-items: center; gap: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-exam-link:hover { background: var(--primary); color: white; text-decoration: none; border-color: var(--primary); }

/* ── Main content ── */
.admin-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  padding: 1.75rem;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── Page header ── */
.page-header  { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.25rem; }
.page-title   { font-size: 1.35rem; font-weight: 700; color: var(--gray-900); margin-bottom: 2px; }
.page-subtitle{ color: var(--gray-500); font-size: 0.85rem; }

/* ── Flash alert ── */
.flash-bar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  min-width: 320px;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
  font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow-md);
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideInUp {
  from { transform: translateY(120%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.flash-bar.success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.flash-bar.error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-bar.danger  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-bar.info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.flash-bar.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.flash-close { background: none; border: none; cursor: pointer; color: inherit; opacity: .4; font-size: 1.2rem; line-height: 1; }
.flash-close:hover { opacity: 1; }

/* Alert */
.alert { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert-info    { background: #eff6ff; color: #1e40af;  border: 1px solid #93c5fd; }
.alert-success { background: #dcfce7; color: #166534;  border: 1px solid #86efac; }
.alert-warning { background: #fffbeb; color: #92400e;  border: 1px solid #fcd34d; }
.alert-error   { background: #fef2f2; color: #991b1b;  border: 1px solid #fca5a5; }

/* ── Cards ── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: .95rem; font-weight: 600; color: var(--gray-800); }
.card-body  { padding: 1.25rem; }
.card > form { padding: 1.25rem; }

/* ── Stat cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.35rem;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon-blue   { background: #dbeafe; color: #2563eb; }
.stat-icon-green  { background: #dcfce7; color: #16a34a; }
.stat-icon-yellow { background: #fef9c3; color: #b45309; }
.stat-icon-purple { background: #ede9fe; color: #7c3aed; }

.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { color: var(--gray-500); font-size: 0.78rem; font-weight: 500; margin-top: 4px; }

/* ── Grid layouts ── */
.grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-12-5 { display: grid; grid-template-columns: 7fr 5fr; gap: 1.25rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.5rem 1.1rem;
  border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s; white-space: nowrap; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-sm    { padding: 0.28rem 0.7rem; font-size: 0.8rem; }
.btn-lg    { padding: 0.65rem 1.4rem; font-size: 0.95rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-icon  { padding: 0.38rem 0.45rem; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; color: white; }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover  { background: #b91c1c; color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info    { background: var(--info); color: white; }
.btn-gray    { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-gray:hover { background: var(--gray-200); }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-600); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px; font-weight: 600;
  line-height: 1.5;
}
.badge-blue   { background: #eff6ff; color: #1e40af; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fef2f2; color: #991b1b; }
.badge-yellow { background: #fffbeb; color: #92400e; }
.badge-gray   { background: #f3f4f6; color: #374151; }
.badge-purple { background: #f5f3ff; color: #6d28d9; }

/* ── Status badges ── */
.status-active   { background: #dcfce7; color: #166534; }
.status-pending  { background: #fffbeb; color: #92400e; }
.status-paused   { background: #fef3c7; color: #b45309; }
.status-finished { background: #f3f4f6; color: #6b7280; }
.status-closed   { background: #f3f4f6; color: #6b7280; }

/* ── Tables ── */
.table-wrap  { overflow-x: auto; width: 100%; }
.data-table  { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #f8fafc; color: #64748b;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 10px 14px; border-bottom: 2px solid #e2e8f0; text-align: left;
}
.data-table td {
  padding: 11px 14px; border-bottom: 1px solid #f1f5f9;
  font-size: 13px; color: #374151; vertical-align: middle;
}
.data-table tbody tr:hover td { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Forms ── */
.form-group   { margin-bottom: 1rem; }
.form-label   { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 13px; color: #374151; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; line-height: 1.5;
  border: 1.5px solid #d1d5db; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; color: var(--gray-800);
  background: white; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-input.error { border-color: #ef4444; }
.form-input-sm  { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.form-textarea  { resize: vertical; min-height: 80px; }
.form-hint      { font-size: 0.78rem; color: var(--gray-500); margin-top: 4px; }
.form-row       { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Question cards (Q Bank) ── */
.q-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  transition: box-shadow 0.18s;
}
.q-card:hover { box-shadow: var(--shadow-sm); }
.q-card.fatal { border-left-color: #f87171; }

.q-opt-row {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 5px 8px; border-radius: 6px;
  background: #f9fafb; border: 1px solid #f3f4f6;
}
.q-opt-row.correct { background: #f0fdf4; border-color: #bbf7d0; color: #166534; font-weight: 600; }
.q-opt-badge {
  width: 20px; height: 20px; border-radius: 50%;
  background: #e5e7eb; color: #374151;
  font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.q-opt-row.correct .q-opt-badge { background: #16a34a; color: white; }

.btn-icon-edit {
  background: none; border: 1px solid transparent; border-radius: 6px;
  padding: 4px 7px; cursor: pointer; color: var(--primary);
  font-size: .85rem; flex-shrink: 0; transition: background .15s;
}
.btn-icon-edit:hover { background: #eff6ff; border-color: #bfdbfe; }

/* Answer rows in question form modal */
.ans-row {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: .6rem; padding: .65rem;
  background: #f9fafb; border-radius: 8px; border: 1px solid #f3f4f6;
}
.ans-letter {
  width: 26px; height: 26px; border-radius: 50%;
  background: #e5e7eb; color: #374151;
  font-size: .78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  margin-top: 6px;
}
.ans-radio-label { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; flex-shrink: 0; }
.ans-radio-check { font-size: .65rem; color: var(--gray-500); white-space: nowrap; }
.ans-radio-label input[type=radio]:checked ~ .ans-radio-check { color: var(--success); font-weight: 700; }

/* Media picker */
.mp-tab {
  padding: .5rem 1rem; font-size: .83rem; font-weight: 500;
  background: none; border: none; cursor: pointer; color: var(--gray-500);
  border-bottom: 2px solid transparent; transition: color .15s;
}
.mp-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.mp-img-item {
  border-radius: 8px; overflow: hidden; border: 2px solid #e5e7eb;
  cursor: pointer; transition: border-color .15s; aspect-ratio: 1; position: relative;
}
.mp-img-item:hover, .mp-img-item.selected { border-color: var(--primary); }
.mp-img-item img { width: 100%; height: 100%; object-fit: cover; }
.mp-img-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 3px 6px; background: rgba(0,0,0,.6); color: white;
  font-size: .62rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Bộ đề chips */
.qset-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .3rem .7rem;
  background: white; border: 1px solid var(--gray-200);
  border-radius: 99px; box-shadow: var(--shadow-xs); font-size: .82rem;
}
.qset-chip.active { border-color: var(--primary); background: #eff6ff; }

/* ── Audit log terminal ── */
.audit-log { background: var(--gray-900); color: #34d399; font-family: 'Courier New', monospace; padding: 1rem; height: 300px; overflow-y: auto; font-size: 0.8rem; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.audit-line { padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,.04); }

/* ── Login page ── */
.login-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card  { background: white; border-radius: var(--radius-lg); padding: 2.5rem; box-shadow: var(--shadow-md); }
.login-logo  { font-size: 3rem; text-align: center; margin-bottom: 0.5rem; }
.login-title { text-align: center; font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.login-sub   { text-align: center; color: var(--gray-500); font-size: 0.875rem; margin-bottom: 2rem; }
.login-note  { margin-top: 1rem; font-size: 0.78rem; color: var(--danger); text-align: center; }

/* ── Misc ── */
.divider  { height: 1px; background: var(--gray-100); margin: 1rem 0; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gray-500); }
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; }
.profile-photo { width: 120px; height: 160px; object-fit: cover; border-radius: var(--radius); border: 2px solid var(--gray-200); }
.profile-photo-placeholder { width: 120px; height: 160px; background: var(--gray-100); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 3rem; margin: 0 auto; }

/* ── Result items (Dashboard) ── */
.result-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.result-item:last-child { border-bottom: none; }
.result-name  { font-weight: 600; font-size: 0.875rem; }
.result-meta  { font-size: 0.75rem; color: var(--gray-500); }
.result-score { font-size: 1rem; font-weight: 700; }
.result-score.pass { color: var(--success); }
.result-score.fail { color: var(--danger); }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 4px; }
.page-item {
  min-width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); font-size: 0.875rem;
  cursor: pointer; border: 1px solid var(--gray-200); color: var(--gray-700);
  transition: all .15s;
}
.page-item.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 600; }
.page-item:hover:not(.active) { background: var(--gray-50); border-color: var(--gray-300); }
.page-item:disabled { opacity: .4; cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════
   STUDENT / EXAM UI (Mobile First)
   Lấy từ chuẩn mẫu — tối ưu cho màn hình nhỏ và touch
════════════════════════════════════════════════════════════ */
.exam-body {
  background: var(--gray-100);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* Intro / Login */
.exam-intro-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.exam-intro-card    { background: white; border-radius: var(--radius-lg); padding: 2.5rem; box-shadow: var(--shadow-md); width: 100%; max-width: 400px; text-align: center; }
.intro-logo { font-size: 4rem; margin-bottom: 1rem; }

/* Exam header */
.exam-header {
  background: var(--primary); color: white;
  padding: 10px 15px; display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}
.exam-title   { font-weight: 700; font-size: 1.05rem; }
.exam-student { font-size: 0.83rem; opacity: .9; }
.exam-timer   { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; background: rgba(0,0,0,.2); padding: 5px 14px; border-radius: 6px; }
.btn-submit-exam { font-weight: 700; font-size: 1rem; padding: 8px 20px; }

/* Question area */
.exam-layout        { display: flex; flex-direction: column; min-height: calc(100vh - 60px); }
.exam-content-area  { flex: 1; padding: 15px; padding-bottom: 250px; overflow-y: auto; max-width: 800px; margin: 0 auto; width: 100%; }
.question-card      { background: white; border-radius: 12px; padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200); }
.question-number    { font-size: 1.05rem; font-weight: 700; color: var(--primary); border-bottom: 2px solid var(--gray-100); padding-bottom: 10px; margin-bottom: 14px; }
.question-text      { font-size: 1.1rem; font-weight: 500; line-height: 1.65; }

/* Answer options — chuẩn mẫu */
.answer-option {
  width: 100%; padding: 14px 16px;
  border: 2px solid #e5e7eb; border-radius: 12px;
  background: white; text-align: left; cursor: pointer;
  font-size: 14px; line-height: 1.5; color: #374151;
  transition: all 0.15s; display: flex; align-items: flex-start; gap: 12px;
  min-height: 48px;
}
.answer-option:active { transform: scale(0.98); }
.answer-option:hover { border-color: #93c7af; background: #f0fdf4; }
.answer-option.selected { border-color: #16a34a; background: #dcfce7; color: #166534; font-weight: 500; }
.answer-option.correct  { border-color: #16a34a; background: #dcfce7; }
.answer-option.wrong    { border-color: #ef4444; background: #fef2f2; }

.answer-letter {
  min-width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0; margin-top: -1px;
}
.answer-option.selected .answer-letter { background: #16a34a; border-color: #16a34a; color: white; }
.answer-option.correct  .answer-letter { background: #16a34a; border-color: #16a34a; color: white; }
.answer-option.wrong    .answer-letter { background: #ef4444; border-color: #ef4444; color: white; }

/* Legacy option styles */
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-item  { display: flex; align-items: center; padding: 13px; border: 2px solid var(--gray-200); border-radius: 10px; cursor: pointer; transition: all .15s; background: white; }
.option-item input[type="radio"] { display: none; }
.option-label { width: 34px; height: 34px; border-radius: 50%; background: var(--gray-100); color: var(--gray-700); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem; margin-right: 12px; flex-shrink: 0; }
.option-text  { font-size: .95rem; line-height: 1.5; }
.option-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.option-item.selected .option-label { background: var(--primary); color: white; }

/* Question nav grid */
.exam-nav-grid { position: fixed; bottom: 0; left: 0; right: 0; background: white; border-top: 1px solid var(--gray-200); padding: 10px; box-shadow: 0 -4px 6px -1px rgba(0,0,0,.08); z-index: 90; }
.grid-title    { text-align: center; font-weight: 700; font-size: 0.78rem; color: var(--gray-500); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.grid-buttons  { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; max-width: 800px; margin: 0 auto; max-height: 180px; overflow-y: auto; }

/* Nav buttons — chuẩn mẫu */
.nav-btn, .q-nav-btn {
  width: 100%; aspect-ratio: 1;
  border-radius: 6px; background: white;
  border: 1.5px solid #e5e7eb; color: #6b7280;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; cursor: pointer;
  transition: all 0.1s;
}
.nav-btn.answered, .q-nav-btn.answered { background: #16a34a; border-color: #16a34a; color: white; }
.nav-btn.active, .q-nav-btn.current   { border-color: #2563eb; color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.25); }
.nav-btn.active.answered, .q-nav-btn.current.answered { background: #16a34a; border-color: #2563eb; color: white; box-shadow: 0 0 0 2px rgba(37,99,235,0.25); }

/* ── Student header ── */
.student-header { background: var(--primary); color: white; padding: 12px 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.student-header-brand { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.student-main { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .hide-mobile { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .form-row { grid-template-columns: 1fr; }
  .data-table { display: block; overflow-x: auto; }
}

@media (min-width: 1024px) {
  .hide-desktop { display: none; }
  .exam-layout { flex-direction: row; }
  .exam-content-area { padding-bottom: 20px; }
  .exam-nav-grid { position: sticky; top: 80px; align-self: flex-start; width: 300px; border-left: 1px solid var(--gray-200); border-top: none; padding: 20px; height: calc(100vh - 80px); overflow: hidden; }
  .grid-buttons { grid-template-columns: repeat(5, 1fr); max-height: none; }
}
