/* =============================================
   CBT Management System - Main Stylesheet
   Professional WAEC-inspired Design
============================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

:root {
  --primary:       #0a3d62;
  --primary-light: #1a6fa8;
  --accent:        #f39c12;
  --accent-dark:   #d68910;
  --success:       #27ae60;
  --danger:        #c0392b;
  --warning:       #f39c12;
  --info:          #2980b9;
  --dark:          #1a1a2e;
  --gray-900:      #1e293b;
  --gray-800:      #2d3748;
  --gray-700:      #4a5568;
  --gray-600:      #718096;
  --gray-400:      #a0aec0;
  --gray-200:      #e2e8f0;
  --gray-100:      #f7fafc;
  --white:         #ffffff;
  --sidebar-w:     260px;
  --header-h:      64px;
  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.14);
  --transition:    all 0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
}

/* =============================================
   AUTH / LOGIN PAGE
============================================= */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--primary) 0%, #1a6fa8 50%, #0a3d62 100%);
}

.auth-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
  color: white;
  position: relative;
  overflow: hidden;
}

.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-logo { font-size: 3rem; font-weight: 800; letter-spacing: -1px; position: relative; }
.auth-logo span { color: var(--accent); }
.auth-tagline { font-size: 1.1rem; opacity: 0.85; margin-top: 12px; position: relative; }
.auth-features { list-style: none; margin-top: 40px; position: relative; }
.auth-features li { display: flex; align-items: center; gap: 12px; padding: 10px 0; font-size: 1rem; }
.auth-features li::before { content: '✓'; background: var(--accent); color: white; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }

.auth-right {
  width: 460px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 50px;
}

.auth-form-wrap { width: 100%; }
.auth-title { font-size: 1.8rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.auth-sub { color: var(--gray-600); margin-bottom: 32px; }

/* =============================================
   FORM ELEMENTS
============================================= */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 7px;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--gray-900);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}

.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(26,111,168,0.12); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid { border-color: var(--success); }

textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }

.input-group { position: relative; }
.input-group .form-control { padding-left: 44px; }
.input-group .input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 1.1rem; pointer-events: none; }

/* =============================================
   BUTTONS
============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(10,61,98,0.3); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); transform: translateY(-1px); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(1.1); }

.btn-outline { background: transparent; border: 2px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* =============================================
   DASHBOARD LAYOUT
============================================= */
.dashboard { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 22px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}
.sidebar-brand-name span { color: var(--accent); }
.sidebar-brand-sub { font-size: 0.72rem; color: rgba(255,255,255,0.55); margin-top: 2px; letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 16px 0; }
.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 14px 24px 6px;
}

.nav-item { margin: 2px 10px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active { background: var(--accent); color: white; font-weight: 600; }
.nav-link .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--danger); color: white; font-size: 0.7rem; padding: 2px 7px; border-radius: 20px; font-weight: 700; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* =============================================
   MAIN CONTENT
============================================= */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 10px rgba(0,0,0,0.06);
}

.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--gray-900); }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.user-avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.85rem;
  cursor: pointer;
}

.page-content { padding: 28px; flex: 1; }

/* =============================================
   CARDS & STATS
============================================= */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); display: flex; align-items: center; gap: 10px; }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); background: var(--gray-100); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 28px; }

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: rgba(41,128,185,0.12); color: var(--info); }
.stat-icon.green  { background: rgba(39,174,96,0.12);  color: var(--success); }
.stat-icon.orange { background: rgba(243,156,18,0.12); color: var(--accent); }
.stat-icon.red    { background: rgba(192,57,43,0.12);  color: var(--danger); }
.stat-icon.purple { background: rgba(142,68,173,0.12); color: #8e44ad; }

.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 0.82rem; color: var(--gray-600); margin-top: 4px; font-weight: 500; }

/* =============================================
   TABLES
============================================= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--gray-200);
  text-align: left;
  white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--gray-200); color: var(--gray-800); font-size: 0.9rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-100); }

/* =============================================
   BADGES & TAGS
============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  gap: 5px;
}
.badge-success { background: rgba(39,174,96,0.15); color: #1e8449; }
.badge-danger  { background: rgba(192,57,43,0.15);  color: #c0392b; }
.badge-warning { background: rgba(243,156,18,0.15); color: #b7770d; }
.badge-info    { background: rgba(41,128,185,0.15); color: #1a5276; }
.badge-primary { background: rgba(10,61,98,0.12);   color: var(--primary); }
.badge-gray    { background: var(--gray-200);        color: var(--gray-600); }

/* =============================================
   ALERTS & FLASH MESSAGES
============================================= */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
}
.alert-success { background: #eafaf1; border-color: var(--success); color: #1e8449; }
.alert-danger  { background: #fdedec; border-color: var(--danger);  color: #c0392b; }
.alert-warning { background: #fef9e7; border-color: var(--warning); color: #b7770d; }
.alert-info    { background: #eaf4fb; border-color: var(--info);    color: #1a5276; }

/* =============================================
   EXAM INTERFACE
============================================= */
.exam-layout { display: flex; gap: 0; min-height: 100vh; }

.exam-sidebar {
  width: 300px;
  background: var(--primary);
  position: fixed;
  top: 0; bottom: 0; right: 0;
  overflow-y: auto;
  z-index: 50;
  padding: 20px;
}

.exam-main { margin-right: 300px; padding: 24px 32px; flex: 1; max-width: calc(100vw - 300px); }

.exam-header {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-left: 5px solid var(--primary);
}

.exam-timer {
  font-family: 'DM Mono', monospace;
  font-size: 2rem;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 2px;
}

.exam-timer.warning { color: var(--accent); animation: pulse 1s infinite; }
.exam-timer.danger  { color: var(--danger); animation: pulse 0.5s infinite; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.question-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid var(--gray-200);
}

.question-number {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.question-number .q-badge {
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
}

.question-text { font-size: 1.05rem; line-height: 1.7; color: var(--gray-900); margin-bottom: 24px; font-weight: 500; }

.options-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.option-item {
  position: relative;
}

.option-label {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  line-height: 1.5;
}

.option-label:hover { border-color: var(--primary-light); background: rgba(10,61,98,0.03); }

.option-label input[type=radio] { display: none; }

.option-label input[type=radio]:checked ~ .option-text-wrap { color: var(--primary); font-weight: 600; }
.option-label:has(input:checked) { border-color: var(--primary); background: rgba(10,61,98,0.06); }

.option-key {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gray-600);
  flex-shrink: 0;
  transition: var(--transition);
}

.option-label:has(input:checked) .option-key {
  background: var(--primary);
  color: white;
}

/* Correct/wrong highlighting for results */
.option-label.correct { border-color: var(--success); background: rgba(39,174,96,0.08); }
.option-label.correct .option-key { background: var(--success); color: white; }
.option-label.wrong { border-color: var(--danger); background: rgba(192,57,43,0.06); }
.option-label.wrong .option-key { background: var(--danger); color: white; }

/* Theory question */
.theory-answer {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  transition: var(--transition);
  outline: none;
}
.theory-answer:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(26,111,168,0.1); }

/* Question navigator (sidebar) */
.q-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 14px 0;
}
.q-nav-btn {
  aspect-ratio: 1;
  border-radius: 6px;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.q-nav-btn.unanswered { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.7); }
.q-nav-btn.answered   { background: var(--accent); color: white; }
.q-nav-btn.current    { background: white; color: var(--primary); }
.q-nav-btn:hover      { transform: scale(1.1); }

/* =============================================
   RESULT PAGE
============================================= */
.result-hero {
  text-align: center;
  padding: 48px 24px;
}
.result-score-ring {
  width: 160px; height: 160px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  margin: 0 auto 24px;
  font-weight: 800;
  position: relative;
}
.result-score-ring.pass { background: conic-gradient(var(--success) var(--pct), var(--gray-200) 0); }
.result-score-ring.fail { background: conic-gradient(var(--danger) var(--pct), var(--gray-200) 0); }
.result-score-ring::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: white;
}
.result-percent { font-size: 2.4rem; font-weight: 800; position: relative; z-index: 1; line-height: 1; }
.result-grade { font-size: 1rem; color: var(--gray-600); position: relative; z-index: 1; }

/* =============================================
   QUESTION BUILDER
============================================= */
.option-builder { background: var(--gray-100); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; position: relative; }
.option-builder-label { font-size: 0.78rem; font-weight: 700; color: var(--gray-600); margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }

.section-divider { display: flex; align-items: center; gap: 12px; margin: 28px 0; color: var(--gray-400); font-size: 0.8rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.section-divider::before, .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--gray-200); }

/* =============================================
   UTILITIES
============================================= */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 20px; }
.mb-4 { margin-bottom: 28px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.text-muted { color: var(--gray-500); }
.text-small { font-size: 0.82rem; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); }
.page-sub { color: var(--gray-600); margin-top: 2px; font-size: 0.9rem; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.empty-icon { font-size: 3.5rem; margin-bottom: 16px; }
.empty-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-700); margin-bottom: 8px; }

.progress-bar-wrap { height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; background: var(--primary); transition: width 0.4s ease; }
.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.danger  { background: var(--danger); }
.progress-bar-fill.warning { background: var(--warning); }

/* Responsive */
@media (max-width: 900px) {
  .auth-left { display: none; }
  .auth-right { width: 100%; }
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; }
  .exam-sidebar { display: none; }
  .exam-main { margin-right: 0; max-width: 100%; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* =============================================
   DROPDOWN
============================================= */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 999;
  display: none;
  overflow: hidden;
}
.dropdown-menu.show { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--gray-800); text-decoration: none; font-size: 0.9rem; transition: background 0.15s; }
.dropdown-item:hover { background: var(--gray-100); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { border: none; border-top: 1px solid var(--gray-200); margin: 4px 0; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* =============================================
   MODAL
============================================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(3px);
  z-index: 1000; display: none; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: white; border-radius: var(--radius-lg);
  width: 90%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-weight: 700; font-size: 1.05rem; }
.modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--gray-500); line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; gap: 12px; justify-content: flex-end; }

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Print */
@media print {
  .sidebar, .topbar, .btn, .exam-sidebar { display: none !important; }
  .main-wrap { margin-left: 0; }
}