/* ============== CBT Portal — Dark Glassmorphism ============== */
:root {
  --bg-base: #0a0b14;
  --bg-deep: #060710;
  --surface-1: rgba(30, 32, 50, 0.55);
  --surface-2: rgba(20, 22, 38, 0.65);
  --border-soft: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --accent-purple: #a855f7;
  --accent-cyan: #22d3ee;
  --accent-violet: #8b5cf6;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(168, 85, 247, 0.18) 0%, transparent 42%),
    radial-gradient(circle at 88% 78%, rgba(34, 211, 238, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(139, 92, 246, 0.10) 0%, transparent 50%),
    var(--bg-base);
  background-attachment: fixed;
}

/* === Headings & Hierarchy === */
h1, h2, h3, h4 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* === Glass Card === */
.glass {
  background: linear-gradient(135deg, rgba(30, 32, 50, 0.65) 0%, rgba(20, 22, 38, 0.55) 100%);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 30px 60px -25px rgba(0, 0, 0, 0.55);
}

.glass-strong {
  background: linear-gradient(135deg, rgba(40, 42, 65, 0.75) 0%, rgba(24, 26, 44, 0.7) 100%);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 40px 80px -30px rgba(0, 0, 0, 0.65);
}

/* === Inputs === */
.input-dark {
  width: 100%;
  background: rgba(15, 17, 30, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.input-dark::placeholder {
  color: rgba(148, 163, 184, 0.45);
}

.input-dark:hover {
  border-color: rgba(148, 163, 184, 0.32);
  background: rgba(20, 22, 38, 0.75);
}

.input-dark:focus {
  border-color: var(--accent-purple);
  background: rgba(25, 20, 45, 0.85);
  box-shadow:
    0 0 0 4px rgba(168, 85, 247, 0.12),
    0 0 24px -4px rgba(168, 85, 247, 0.4);
}

.input-icon-wrap {
  position: relative;
}
.input-icon-wrap > i.fa-fw {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(148, 163, 184, 0.55);
  pointer-events: none;
  font-size: 14px;
  transition: color 0.25s;
}
.input-icon-wrap .input-dark { padding-left: 44px; }
.input-icon-wrap:focus-within > i.fa-fw { color: var(--accent-purple); }

/* === Buttons === */
.btn-primary {
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #22d3ee 100%);
  background-size: 200% 200%;
  color: white;
  border: 0;
  padding: 13px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 8px 24px -8px rgba(168, 85, 247, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  background-position: 100% 0%;
  transform: translateY(-1px);
  box-shadow:
    0 14px 30px -10px rgba(168, 85, 247, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: white;
  border: 0;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.2s;
  box-shadow: 0 6px 16px -6px rgba(239, 68, 68, 0.45);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(239, 68, 68, 0.6); }

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: white;
  border: 0;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.2s;
  box-shadow: 0 6px 16px -6px rgba(16, 185, 129, 0.5);
}
.btn-success:hover { transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-ghost:hover { background: rgba(148, 163, 184, 0.1); color: var(--text-primary); }

/* === Login screen specifics === */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 44px 38px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.4), rgba(34, 211, 238, 0.25), transparent 70%);
  border-radius: 22px;
  z-index: -1;
  filter: blur(14px);
  opacity: 0.7;
}

.brand-mark {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 60%, #22d3ee 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: white;
  box-shadow: 0 14px 30px -8px rgba(168, 85, 247, 0.55);
  margin: 0 auto 18px;
}

/* === Modal === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(6, 7, 16, 0.72);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal-card {
  max-width: 460px;
  width: 100%;
  padding: 32px 30px;
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-card.lg { max-width: 720px; }
.modal-card.xl { max-width: 920px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* === Sidebar === */
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.sidebar-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
}
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18) 0%, rgba(34, 211, 238, 0.08) 100%);
  color: white;
  border: 1px solid rgba(168, 85, 247, 0.25);
  box-shadow: 0 0 20px -6px rgba(168, 85, 247, 0.4);
}
.sidebar-link i { width: 18px; text-align: center; }

/* === Cards (exam grid) === */
.exam-card {
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.exam-card:hover {
  transform: translateY(-4px);
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow:
    0 30px 60px -20px rgba(168, 85, 247, 0.3),
    0 0 0 1px rgba(168, 85, 247, 0.2) inset;
}
.exam-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(168, 85, 247, 0.08));
  pointer-events: none;
  opacity: 0; transition: opacity 0.3s;
}
.exam-card:hover::after { opacity: 1; }

/* === Status pills === */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill-draft { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148,163,184,0.2); }
.pill-published { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.pill-closed { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.pill-cyan { background: rgba(34, 211, 238, 0.14); color: #67e8f9; border: 1px solid rgba(34,211,238,0.28); }
.pill-purple { background: rgba(168, 85, 247, 0.16); color: #d8b4fe; border: 1px solid rgba(168,85,247,0.3); }

/* === Tables === */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl thead th {
  text-align: left;
  padding: 12px 14px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-soft);
}
.tbl tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: rgba(148, 163, 184, 0.04); }
.tbl tbody tr:last-child td { border-bottom: 0; }

/* === Toggle Switch === */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer;
  inset: 0;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 24px;
  transition: 0.25s;
}
.slider::before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.25s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
input:checked + .slider {
  background: linear-gradient(135deg, #a855f7, #22d3ee);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}
input:checked + .slider::before { transform: translateX(20px); }

/* === Toast === */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  padding: 14px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 32, 50, 0.9), rgba(20, 22, 38, 0.95));
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(14px);
  color: white;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.5);
  animation: slideInRight 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
}
.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }
.toast.warning { border-color: rgba(245, 158, 11, 0.4); }
.toast.info { border-color: rgba(34, 211, 238, 0.4); }
.toast i { margin-top: 2px; }
.toast.success i { color: #6ee7b7; }
.toast.error i { color: #fca5a5; }
.toast.warning i { color: #fcd34d; }
.toast.info i { color: #67e8f9; }
@keyframes slideInRight { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* === Question card (exam) === */
.qcard {
  padding: 24px;
  margin-bottom: 16px;
}
.qcard.required-missing { border-color: rgba(239, 68, 68, 0.45); box-shadow: 0 0 0 1px rgba(239,68,68,0.25), 0 30px 60px -25px rgba(239,68,68,0.25); }

.option-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 17, 30, 0.55);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s;
  margin: 8px 0;
}
.option-row:hover {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(25, 20, 45, 0.7);
}
.option-row.selected {
  border-color: var(--accent-purple);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(99, 102, 241, 0.10));
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.5), 0 0 20px -6px rgba(168, 85, 247, 0.45);
}
.option-letter {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.option-row.selected .option-letter {
  background: linear-gradient(135deg, #a855f7, #22d3ee);
  color: white;
}

/* === Timer === */
.timer-bar {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-weight: 700;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(168,85,247,0.18), rgba(34,211,238,0.12));
  padding: 8px 18px;
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.05em;
}
.timer-bar.warn { color: #fcd34d; border-color: rgba(245,158,11,0.5); background: rgba(245,158,11,0.1); }
.timer-bar.crit { color: #fca5a5; border-color: rgba(239,68,68,0.6); background: rgba(239,68,68,0.12); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); } 50% { box-shadow: 0 0 0 10px rgba(239,68,68,0); } }

/* === Question palette (exam sidebar) === */
.q-nav-btn {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.16);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
}
.q-nav-btn:hover { border-color: rgba(168, 85, 247, 0.35); color: var(--text-primary); }
.q-nav-btn.answered {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.15));
  border-color: rgba(16, 185, 129, 0.5);
  color: #6ee7b7;
}
.q-nav-btn.current {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.5);
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.4); }

/* === Misc === */
.text-grad {
  background: linear-gradient(135deg, #c4b5fd 0%, #67e8f9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148,163,184,0.2), transparent);
  margin: 24px 0;
}

.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(15, 17, 30, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
  cursor: pointer;
  transition: all 0.18s;
}
.checkbox-row:hover { border-color: rgba(168, 85, 247, 0.3); }
.checkbox-row input[type=checkbox] { accent-color: var(--accent-purple); width: 16px; height: 16px; }

.label-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
  letter-spacing: 0.01em;
}

/* === Layout helpers === */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar {
  padding: 24px 18px;
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(20, 22, 38, 0.6), rgba(10, 11, 20, 0.7));
  backdrop-filter: blur(18px);
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
}
.main-area { padding: 28px 36px; min-width: 0; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .main-area { padding: 20px; }
}

/* Avatar */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7, #22d3ee);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 96px; height: 96px; font-size: 32px; }

/* Spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(148, 163, 184, 0.25);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Stat card === */
.stat-card { padding: 20px 22px; }
.stat-card .num {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.stat-card .lbl {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
