/* ==============================
   CRISC Training Simulator CSS
   ============================== */

/* --- Variables & Themes --- */
:root {
  --primary: #1a56db;
  --primary-dark: #1040a0;
  --primary-light: #e8f0fd;
  --secondary: #6366f1;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-bg: #1e2a3a;
  --sidebar-text: #cbd5e1;
  --sidebar-hover: #2d3e52;
  --sidebar-active: #1a56db;
  --header-bg: #1e2a3a;
  --header-text: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-width: 260px;
  --header-h: 60px;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #1e3a5f;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #162032;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --sidebar-bg: #111827;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;
  --header-bg: #111827;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', sans-serif; font-size: 15px; color: var(--text); background: var(--bg); transition: background var(--transition), color var(--transition); }

/* ===========================
   LOGIN SCREEN
   =========================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1a56db 50%, #6366f1 100%);
  z-index: 0;
}
.login-bg::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.login-bg::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  padding: 48px 40px;
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
[data-theme="dark"] .login-card {
  background: rgba(30,41,59,0.97);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img {
  height: 40px;
  margin-bottom: 12px;
}
.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.login-title sup {
  font-size: 0.7em;
  vertical-align: super;
}
.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.login-byline {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}
.login-form .form-group {
  margin-bottom: 18px;
}
.login-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}
.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 14px;
}
[data-theme="dark"] .login-error {
  background: #3b1a1a;
  border-color: #ef4444;
}
.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  letter-spacing: 0.5px;
}
.btn-login:hover { opacity: 0.92; }
.btn-login:active { transform: scale(0.99); }

/* ===========================
   TITLE BAR
   =========================== */
.title-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 0;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.title-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.sidebar-toggle {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 8px 14px;
  transition: color 0.2s;
}
.sidebar-toggle:hover { color: white; }
.app-brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}
.brand-name sup { font-size: 0.65em; }
.brand-byline {
  font-size: 0.72rem;
  color: #60a5fa;
  font-weight: 500;
}
.title-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lang-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
  font-size: 0.85rem;
}
.lang-selector select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e2e8f0;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
}
.lang-selector select option { background: #1e293b; color: #e2e8f0; }
.theme-toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #94a3b8;
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.15); color: white; }
.user-menu { position: relative; }
.user-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex; align-items: center; gap: 7px;
  transition: background 0.2s;
}
.user-btn:hover { background: rgba(255,255,255,0.15); }
.user-btn .fa-user-circle { font-size: 1.1rem; }
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  overflow: hidden;
  z-index: 300;
}
.user-dropdown.open { display: block; }
.user-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  transition: background 0.15s;
}
.user-dropdown a:hover { background: var(--bg); }
.user-dropdown a i { width: 16px; color: var(--text-muted); }

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 150;
  transition: transform var(--transition);
  overflow: hidden;
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 16px 0; }
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.nav-menu { list-style: none; }
.nav-group { margin: 16px 0 4px; }
.nav-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #475569;
  padding: 4px 18px;
}
.nav-group ul { list-style: none; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.88rem;
  border-radius: 0;
  transition: all 0.15s;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.95rem; }
.nav-item:hover { background: var(--sidebar-hover); color: #ffffff; }
.nav-item.active { background: rgba(26,86,219,0.2); color: #60a5fa; border-left-color: var(--primary); }
.sidebar-progress {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.progress-label { font-size: 0.75rem; color: #64748b; margin-bottom: 6px; }
.progress-bar-wrap { background: rgba(255,255,255,0.08); border-radius: 20px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 20px; transition: width 0.5s ease; }
.progress-pct { font-size: 0.78rem; color: #94a3b8; text-align: right; margin-top: 4px; }

/* ===========================
   MAIN CONTENT
   =========================== */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
  padding: 28px;
  transition: margin-left var(--transition);
}
.main-content.full { margin-left: 0; }
.content-section { display: none; }
.content-section.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===========================
   SECTION HEADERS
   =========================== */
.section-header { margin-bottom: 28px; }
.section-header h2 { font-size: 1.8rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.section-header p { color: var(--text-muted); font-size: 0.95rem; }

/* ===========================
   STATS GRID
   =========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card > i { font-size: 2rem; color: var(--primary); opacity: 0.85; }
.stat-card > div { display: flex; flex-direction: column; }
.stat-val { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.stat-lbl { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }

/* ===========================
   DASHBOARD GRID
   =========================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
}
.dash-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.dash-card.full-width { grid-column: 1 / -1; }
.dash-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.exam-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.overview-item {
  text-align: center;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.overview-item i { font-size: 1.4rem; color: var(--primary); }
.overview-item strong { font-size: 0.78rem; color: var(--text-muted); display: block; }
.overview-item span { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.domain-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.domain-table th { background: var(--bg); padding: 10px 14px; text-align: left; font-weight: 700; color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }
.domain-table td { padding: 10px 14px; border-top: 1px solid var(--border); }
.domain-table tr:hover td { background: var(--bg); }
.activity-list { list-style: none; }
.activity-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; display: flex; align-items: center; gap: 10px; color: var(--text-muted); }
.activity-list li:last-child { border-bottom: none; }
.activity-list li i { color: var(--primary); }
.domain-progress-item { margin-bottom: 14px; }
.domain-progress-item .dp-label { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 5px; }
.domain-progress-item .dp-bar { background: var(--border); border-radius: 20px; height: 8px; overflow: hidden; }
.domain-progress-item .dp-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width 0.5s; }

/* ===========================
   DOMAIN CONTENT
   =========================== */
.domain-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 32px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.domain-header::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.domain-header h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.domain-header p { font-size: 0.95rem; opacity: 0.85; }
.domain-header .domain-weight { margin-top: 12px; background: rgba(255,255,255,0.15); display: inline-block; padding: 5px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; }
.topic-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; overflow-x: auto; }
.topic-tab {
  padding: 10px 18px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.2s;
}
.topic-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.topic-tab:hover { color: var(--text); }
.topic-tab .tab-check { margin-left: 5px; color: var(--success); font-size: 0.75rem; }
.topic-panel { display: none; }
.topic-panel.active { display: block; animation: fadeIn 0.25s ease; }
.topic-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.topic-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 14px; color: var(--primary); border-left: 4px solid var(--primary); padding-left: 12px; }
.topic-card h4 { font-size: 0.98rem; font-weight: 700; margin: 16px 0 8px; color: var(--text); }
.topic-card p { line-height: 1.75; color: var(--text); margin-bottom: 10px; font-size: 0.9rem; }
.topic-card ul, .topic-card ol { padding-left: 20px; margin-bottom: 10px; }
.topic-card li { line-height: 1.75; color: var(--text); font-size: 0.9rem; margin-bottom: 4px; }
.info-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 14px 0;
  font-size: 0.88rem;
}
.info-box.warning { background: #fffbeb; border-color: var(--warning); }
.info-box.success { background: #ecfdf5; border-color: var(--success); }
[data-theme="dark"] .info-box.warning { background: #3b2e00; }
[data-theme="dark"] .info-box.success { background: #022c22; }
.diagram-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.diagram-box svg { max-width: 100%; }
.content-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; margin: 16px 0; }
.content-table th { background: var(--primary); color: white; padding: 10px 14px; text-align: left; font-weight: 600; font-size: 0.82rem; }
.content-table td { padding: 10px 14px; border: 1px solid var(--border); }
.content-table tr:nth-child(even) td { background: var(--bg); }
.complete-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: opacity 0.2s;
}
.complete-btn:hover { opacity: 0.9; }
.complete-btn.done { background: #64748b; cursor: default; }
.complete-btn.done:hover { opacity: 1; }

/* ===========================
   QUIZ SECTION
   =========================== */
.quiz-container { background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.quiz-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.quiz-q { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.quiz-q:last-child { border-bottom: none; }
.quiz-q-text { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 12px; line-height: 1.6; }
.quiz-options { list-style: none; }
.quiz-options li { margin-bottom: 8px; }
.quiz-options label {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  transition: all 0.15s;
  line-height: 1.5;
}
.quiz-options label:hover { background: var(--primary-light); border-color: var(--primary); }
.quiz-options input[type="radio"] { margin-top: 3px; accent-color: var(--primary); }
.quiz-options label.correct { background: #ecfdf5; border-color: var(--success); color: var(--success); }
.quiz-options label.wrong { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
[data-theme="dark"] .quiz-options label.correct { background: #022c22; }
[data-theme="dark"] .quiz-options label.wrong { background: #3b1a1a; }
.quiz-feedback { margin-top: 10px; font-size: 0.85rem; padding: 10px 14px; border-radius: 6px; }
.quiz-feedback.correct { background: #ecfdf5; color: #065f46; border-left: 3px solid var(--success); }
.quiz-feedback.wrong { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--danger); }
[data-theme="dark"] .quiz-feedback.correct { background: #022c22; color: #6ee7b7; }
[data-theme="dark"] .quiz-feedback.wrong { background: #3b1a1a; color: #fca5a5; }
.quiz-result-box { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; border-radius: var(--radius); padding: 28px; text-align: center; margin-top: 20px; }
.quiz-result-box .score-big { font-size: 3rem; font-weight: 800; }
.quiz-result-box p { font-size: 1rem; opacity: 0.9; margin-top: 8px; }
.btn-primary { background: var(--primary); color: white; border: none; border-radius: 8px; padding: 10px 22px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--border); color: var(--text); border: none; border-radius: 8px; padding: 10px 22px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-secondary:hover { opacity: 0.85; }
.btn-danger { background: var(--danger); color: white; border: none; border-radius: 8px; padding: 10px 22px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-danger:hover { opacity: 0.9; }

/* ===========================
   EXAM SIMULATOR
   =========================== */
.exam-setup { background: var(--surface); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); border: 1px solid var(--border); max-width: 620px; }
.exam-setup h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.exam-setup p { color: var(--text-muted); margin-bottom: 24px; }
.exam-options { display: grid; gap: 16px; margin-bottom: 24px; }
.exam-option { padding: 18px; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: all 0.2s; }
.exam-option:hover { border-color: var(--primary); background: var(--primary-light); }
.exam-option.selected { border-color: var(--primary); background: var(--primary-light); }
.exam-option h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 4px; }
.exam-option p { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.exam-screen { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.exam-nav-bar { background: var(--header-bg); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.exam-nav-bar h3 { color: white; font-size: 0.95rem; }
.exam-timer { font-size: 1.3rem; font-weight: 800; color: #60a5fa; display: flex; align-items: center; gap: 8px; }
.exam-timer.warning { color: #f87171; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.6; } }
.exam-progress-wrap { background: rgba(255,255,255,0.1); height: 4px; }
.exam-progress-fill { height: 100%; background: var(--success); transition: width 0.3s; }
.exam-body { padding: 28px; }
.exam-q-num { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.exam-q-text { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 20px; line-height: 1.65; }
.exam-opts { display: flex; flex-direction: column; gap: 10px; }
.exam-opt {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.9rem;
  color: var(--text);
}
.exam-opt:hover { border-color: var(--primary); background: var(--primary-light); }
.exam-opt.selected { border-color: var(--primary); background: var(--primary-light); }
.exam-opt.correct { border-color: var(--success); background: #ecfdf5; color: var(--success); }
.exam-opt.wrong { border-color: var(--danger); background: #fef2f2; color: var(--danger); }
[data-theme="dark"] .exam-opt.correct { background: #022c22; }
[data-theme="dark"] .exam-opt.wrong { background: #3b1a1a; }
.exam-opt-letter { width: 28px; height: 28px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; margin-top: 1px; }
.exam-opt.selected .exam-opt-letter { background: var(--primary); color: white; }
.exam-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.exam-q-dots { display: flex; flex-wrap: wrap; gap: 6px; max-width: 400px; }
.exam-q-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--border); border: none; cursor: pointer; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); transition: all 0.15s; }
.exam-q-dot.answered { background: var(--primary); color: white; }
.exam-q-dot.current { border: 2px solid var(--primary); }
.exam-results { padding: 32px; text-align: center; }
.exam-results .result-score { font-size: 4rem; font-weight: 800; color: var(--primary); }
.exam-results .result-label { font-size: 1rem; color: var(--text-muted); margin-bottom: 24px; }
.exam-results-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin: 24px 0; }
.result-item { background: var(--bg); border-radius: var(--radius-sm); padding: 16px; }
.result-item .ri-val { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.result-item .ri-lbl { font-size: 0.78rem; color: var(--text-muted); }

/* ===========================
   STUDY PLAN
   =========================== */
.study-plan-form { background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 24px; }
.study-plan-form h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-field input, .form-field select { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text); font-size: 0.9rem; }
.form-field input:focus, .form-field select:focus { outline: none; border-color: var(--primary); }
.plan-output { background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.plan-output h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.plan-week { margin-bottom: 20px; }
.plan-week h4 { font-size: 0.88rem; font-weight: 700; color: var(--primary); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.plan-day { display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; background: var(--bg); border-radius: 8px; margin-bottom: 6px; font-size: 0.87rem; }
.plan-day-label { font-weight: 700; min-width: 80px; color: var(--text-muted); }
.plan-day-tasks { flex: 1; }
.plan-day-tasks span { display: inline-block; background: var(--primary-light); color: var(--primary); padding: 2px 9px; border-radius: 12px; margin: 2px 3px; font-size: 0.8rem; font-weight: 600; }
.plan-export-btns { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

/* ===========================
   TEMPLATES
   =========================== */
.templates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.template-card { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); transition: transform 0.2s, box-shadow 0.2s; }
.template-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.template-icon { width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), var(--secondary)); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.template-icon i { font-size: 1.4rem; color: white; }
.template-card h4 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.template-card p { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }
.template-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-dl { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; font-size: 0.82rem; font-weight: 600; cursor: pointer; border: none; transition: opacity 0.2s; }
.btn-dl.excel { background: #16a34a; color: white; }
.btn-dl.word { background: #1d4ed8; color: white; }
.btn-dl.pdf { background: #dc2626; color: white; }
.btn-dl:hover { opacity: 0.88; }

/* ===========================
   CERTIFICATE
   =========================== */
.cert-locked-msg { background: var(--surface); border-radius: var(--radius); padding: 40px; text-align: center; box-shadow: var(--shadow); border: 2px dashed var(--border); }
.cert-locked-msg i { font-size: 3rem; color: var(--text-muted); margin-bottom: 16px; }
.cert-locked-msg h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.cert-locked-msg p { color: var(--text-muted); font-size: 0.9rem; }
.cert-progress-items { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; justify-content: center; }
.cert-pi { padding: 6px 14px; border-radius: 20px; font-size: 0.82rem; font-weight: 600; }
.cert-pi.done { background: #ecfdf5; color: var(--success); }
.cert-pi.pending { background: var(--bg); color: var(--text-muted); }
[data-theme="dark"] .cert-pi.done { background: #022c22; }
.cert-wrapper { background: var(--surface); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.cert-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.cert-preview { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
#certificateCanvas { display: block; width: 100%; }

/* ===========================
   ADMIN PANEL
   =========================== */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.admin-tab { padding: 10px 20px; background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--text-muted); transition: all 0.2s; }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-panel-content { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.users-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.users-table th { background: var(--bg); padding: 10px 14px; text-align: left; font-weight: 700; color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; }
.users-table td { padding: 12px 14px; border-top: 1px solid var(--border); }
.users-table tr:hover td { background: var(--bg); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; }
.badge.active { background: #ecfdf5; color: var(--success); }
.badge.disabled { background: #fef2f2; color: var(--danger); }
.badge.admin { background: var(--primary-light); color: var(--primary); }
.badge.user { background: var(--bg); color: var(--text-muted); }
[data-theme="dark"] .badge.active { background: #022c22; }
[data-theme="dark"] .badge.disabled { background: #3b1a1a; }
.add-user-form { max-width: 480px; }
.add-user-form .form-group { margin-bottom: 16px; }
.add-user-form label { display: block; font-size: 0.84rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.add-user-form input, .add-user-form select { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text); font-size: 0.9rem; }
.add-user-form input:focus, .add-user-form select:focus { outline: none; border-color: var(--primary); }
.action-btn { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 0.8rem; color: var(--text-muted); transition: all 0.15s; margin-right: 4px; }
.action-btn:hover { background: var(--bg); }
.action-btn.danger:hover { background: #fef2f2; color: var(--danger); border-color: var(--danger); }
.action-btn.success:hover { background: #ecfdf5; color: var(--success); border-color: var(--success); }

/* ===========================
   MODAL
   =========================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 32px; max-width: 440px; width: 95%; box-shadow: var(--shadow-lg); }
.modal-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.modal-box p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.65; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .exam-overview-grid { grid-template-columns: repeat(2,1fr); }
  .exam-results-grid { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr !important; }
  .search-bar { max-width: 100%; }
  .search-results { max-width: 100%; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .main-content { padding: 16px; }
  .domain-header { padding: 20px; }
  .exam-overview-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .exam-actions { flex-direction: column; align-items: flex-start; }
  .exam-q-dots { max-width: 100%; }
}

/* ===========================
   PRINT STYLES
   =========================== */
@media print {
  .title-bar, .sidebar, .nav-menu, .topic-tabs, .complete-btn,
  .quiz-container, .plan-export-btns, .cert-actions,
  .btn-primary, .btn-secondary, .btn-dl { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .content-section { display: block !important; }
  body { background: white !important; color: black !important; }
  .topic-card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
}

/* Certificate print - landscape, single page */
.cert-print-window {
  display: block;
}

/* ===========================
   NEXT UP BANNER
   =========================== */
.next-up-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.9rem;
  color: var(--text);
  animation: fadeIn 0.3s ease;
}
.next-up-card.success {
  background: #ecfdf5;
  border-color: var(--success);
}
[data-theme="dark"] .next-up-card.success { background: #022c22; }
.next-up-card > i { font-size: 1.4rem; color: var(--primary); flex-shrink: 0; }
.next-up-card.success > i { color: var(--success); }
.next-up-card > div { flex: 1; line-height: 1.5; }

/* ===========================
   QUICK SEARCH
   =========================== */
.search-bar-wrap { position: relative; }
.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  gap: 10px;
  max-width: 520px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.search-icon { color: var(--text-muted); font-size: 0.95rem; }
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  padding: 11px 0;
  outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-hint {
  font-size: 0.72rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-muted);
  white-space: nowrap;
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--primary-light); }
.search-result-item i { color: var(--primary); width: 16px; text-align: center; }
.sri-title { font-weight: 600; color: var(--text); }
.sri-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ===========================
   ADMIN NOTICE + INFO BOXES
   =========================== */
.admin-notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fffbeb;
  border: 1.5px solid #fbbf24;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: #92400e;
}
[data-theme="dark"] .admin-notice {
  background: #2d1f00;
  border-color: #d97706;
  color: #fde68a;
}
.admin-notice-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.admin-notice-body { flex: 1; line-height: 1.6; }
.admin-notice-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: #92400e; padding: 0 4px; flex-shrink: 0;
}
[data-theme="dark"] .admin-notice-close { color: #fde68a; }

.admin-info-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  line-height: 1.6;
  flex-wrap: wrap;
}
.admin-info-box.success { background: rgba(16,185,129,0.1); border: 1px solid var(--success); color: var(--text); }
.admin-info-box.warning { background: #fffbeb; border: 1px solid #f59e0b; color: #92400e; }
[data-theme="dark"] .admin-info-box.warning { background: #2d1f00; color: #fde68a; }
.admin-info-box i { font-size: 1.1rem; flex-shrink: 0; }
.admin-info-box.success i { color: var(--success); }
.admin-info-box.warning i { color: #f59e0b; }
.admin-info-box.success { border-left: 4px solid var(--success); }
.admin-info-box.warning { border-left: 4px solid #f59e0b; }

/* Deploy steps */
.deploy-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.deploy-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.55;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* User source badges */
.user-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}
.user-source.server {
  background: rgba(16,185,129,0.12);
  color: #065f46;
  border: 1px solid rgba(16,185,129,0.35);
}
[data-theme="dark"] .user-source.server {
  color: #6ee7b7;
  border-color: rgba(16,185,129,0.4);
}
.user-source.local {
  background: rgba(245,158,11,0.1);
  color: #92400e;
  border: 1px solid rgba(245,158,11,0.35);
}
[data-theme="dark"] .user-source.local {
  color: #fde68a;
  border-color: rgba(245,158,11,0.4);
}

/* User chips */
.user-chip {
  display: inline-block;
  background: var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  margin: 2px 3px;
  color: var(--text);
}

/* Small button */
.btn-small {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-small:hover { border-color: var(--primary); color: var(--primary); }

/* ===========================
   EXAM FLAG BUTTON
   =========================== */
.btn-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-flag:hover { border-color: #f59e0b; color: #f59e0b; background: #fffbeb; }
.btn-flag.flagged { border-color: #f59e0b; color: #f59e0b; background: #fffbeb; }
[data-theme="dark"] .btn-flag.flagged { background: #3b2e00; }
.exam-q-dot.flagged { background: #f59e0b; color: white; font-size: 0.65rem; }

/* ===========================
   CONTINUE PROMPT
   =========================== */
#continuePrompt { backdrop-filter: blur(4px); }

/* ===========================
   CHART CANVAS FIX
   =========================== */
#radarChart, #trendChart { max-height: 260px; }

/* Scrollbar customization */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* RTL support for Arabic */
[dir="rtl"] .title-bar-left { flex-direction: row-reverse; }
[dir="rtl"] .sidebar { left: auto; right: 0; transform: none; }
[dir="rtl"] .sidebar.collapsed { transform: translateX(var(--sidebar-width)); }
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-width); }
[dir="rtl"] .main-content.full { margin-right: 0; }
[dir="rtl"] .nav-item { border-left: none; border-right: 3px solid transparent; }
[dir="rtl"] .nav-item.active { border-right-color: var(--primary); border-left: none; }
[dir="rtl"] .topic-card h3 { border-left: none; border-right: 4px solid var(--primary); padding-left: 0; padding-right: 12px; }
[dir="rtl"] .info-box { border-left: none; border-right: 4px solid var(--primary); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
[dir="rtl"] .info-box.warning { border-right-color: var(--warning); }
[dir="rtl"] .info-box.success { border-right-color: var(--success); }
[dir="rtl"] .domain-header::after { left: -40px; right: auto; }
[dir="rtl"] .user-dropdown { left: 0; right: auto; }

@media (max-width: 900px) {
  [dir="rtl"] .sidebar { transform: translateX(var(--sidebar-width)); left: auto; right: 0; }
  [dir="rtl"] .sidebar.open { transform: translateX(0); }
  [dir="rtl"] .main-content { margin-right: 0; }
}

/* ===========================
   SIDEBAR DOMAIN BADGES
   =========================== */
.nav-domain-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.6;
  min-width: 22px;
  transition: all 0.2s;
  flex-shrink: 0;
}
.nav-domain-badge.complete {
  background: var(--success);
  color: #fff;
}
.nav-domain-badge.partial {
  background: var(--warning);
  color: #000;
}
.nav-domain-badge.none {
  background: var(--border);
  color: var(--text-muted);
}
.nav-item { display: flex; align-items: center; gap: 8px; }

/* ===========================
   STREAK BADGE ON DASHBOARD
   =========================== */
.streak-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fff7ed, #fed7aa);
  border: 1.5px solid #fdba74;
  border-radius: var(--radius);
  padding: 12px 20px;
  margin-bottom: 20px;
  width: fit-content;
  min-width: 160px;
  box-shadow: 0 2px 8px rgba(251,146,60,0.18);
  animation: streakPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
[data-theme="dark"] .streak-badge {
  background: linear-gradient(135deg, #431407, #7c2d12);
  border-color: #c2410c;
}
@keyframes streakPop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.streak-fire { font-size: 2rem; line-height: 1; }
.streak-num { font-size: 1.6rem; font-weight: 800; color: #ea580c; line-height: 1; }
.streak-lbl { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.streak-best { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; background: rgba(255,255,255,0.5); border-radius: 8px; padding: 2px 8px; margin-left: 4px; }
[data-theme="dark"] .streak-best { background: rgba(0,0,0,0.25); }

/* ===========================
   GLOSSARY SECTION
   =========================== */
.glossary-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.gloss-filter {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}
.gloss-filter:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.gloss-filter.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.glossary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: box-shadow 0.18s, transform 0.18s;
}
.glossary-card:hover {
  box-shadow: 0 4px 16px rgba(26,86,219,0.12);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.glossary-term {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.glossary-def {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ===========================
   ONE-QUESTION QUIZ MODE
   =========================== */
.quiz-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.quiz-mode-btn {
  padding: 7px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}
.quiz-mode-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.quiz-mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.quiz-oq-panel { padding: 4px 0; }
.oq-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}
.oq-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 10px;
  transition: width 0.4s ease;
}
.oq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.oq-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.oq-score {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--success);
}
.oq-question {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
}
.oq-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}
.oq-opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}
.oq-opt:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light, rgba(26,86,219,0.06));
}
.oq-opt.correct {
  background: rgba(16,185,129,0.1);
  border-color: var(--success);
  color: var(--success);
}
.oq-opt.wrong {
  background: rgba(239,68,68,0.1);
  border-color: var(--danger, #ef4444);
  color: var(--danger, #ef4444);
}
.oq-opt.dimmed {
  opacity: 0.45;
}
.oq-opt:disabled { cursor: default; }
.oq-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.oq-opt.correct .oq-letter { background: var(--success); color: #fff; }
.oq-opt.wrong .oq-letter { background: var(--danger, #ef4444); color: #fff; }
.oq-explanation {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  line-height: 1.6;
  margin-top: 16px;
}
.oq-explanation.correct {
  background: rgba(16,185,129,0.1);
  border: 1px solid var(--success);
  color: var(--text);
}
.oq-explanation.wrong {
  background: rgba(239,68,68,0.08);
  border: 1px solid var(--danger, #ef4444);
  color: var(--text);
}
.oq-explanation i { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.oq-explanation.correct i { color: var(--success); }
.oq-explanation.wrong i { color: var(--danger, #ef4444); }

/* ===========================
   KEYBOARD SHORTCUT FLASH
   =========================== */
@keyframes kbFlash {
  0%   { outline: 3px solid var(--primary); outline-offset: 2px; }
  100% { outline: 3px solid transparent; outline-offset: 4px; }
}
.kb-flash {
  animation: kbFlash 0.2s ease-out forwards;
}

/* ===========================
   EXAM MODE STATS BADGE
   =========================== */
.exam-stat-badge {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  line-height: 1.7;
}
.exam-stat-badge .esb-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.esb-pass { color: var(--success); font-weight: 700; }
.esb-fail { color: var(--danger, #ef4444); font-weight: 700; }
