/* ===== CSS Variables / Theming ===== */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.3);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --cyan: #06b6d4;
  --border: #334155;
  --sidebar-w: 300px;
  --topbar-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.15);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== Splash Screen ===== */
.splash {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}

.splash::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.15), transparent 70%);
  top: -100px;
  right: -100px;
  animation: float 6s ease-in-out infinite;
}

.splash::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,0.12), transparent 70%);
  bottom: -50px;
  left: -50px;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.splash-content {
  text-align: center;
  z-index: 1;
  padding: 2rem;
  max-width: 700px;
}

.splash-icon {
  font-size: 4rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.splash h1 {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.splash h2 {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.splash-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.splash-stats {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  backdrop-filter: blur(10px);
}

.stat-card i { color: var(--accent); font-size: 1.3rem; }
.stat-card span { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }

.btn-start, .btn-resume {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.5rem;
}

.btn-start {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-resume {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-resume:hover {
  background: var(--accent);
  color: white;
}

/* ===== Top Bar ===== */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.5rem;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.topbar-title i { color: var(--accent); }

.topbar-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 400px;
  margin: 0 1rem;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 35px;
}

.topbar-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.95rem;
}

.btn-icon:hover {
  background: var(--accent);
  color: white;
}

/* ===== Layout ===== */
.app-container {
  min-height: 100vh;
}

.main-layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 90;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.time-badge {
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.sidebar-nav {
  padding: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  gap: 0.75rem;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-tertiary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.1));
  border-left: 3px solid var(--accent);
}

.nav-item.completed .nav-check {
  background: var(--success);
  color: white;
}

.nav-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
}

.nav-info { flex: 1; min-width: 0; }

.nav-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ===== Content ===== */
.content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--topbar-h));
}

.module-header {
  padding: 2.5rem 3rem 2rem;
  background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(139,92,246,0.05));
  border-bottom: 1px solid var(--border);
}

.module-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

.module-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.module-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.module-meta {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.module-meta span {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.module-meta i { color: var(--accent); }

/* Section Dots Progress */
.section-progress {
  padding: 1rem 3rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: var(--topbar-h);
  z-index: 10;
}

.section-dots {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.section-dot {
  width: 32px;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  transition: var(--transition);
  cursor: pointer;
}

.section-dot.active {
  background: var(--accent);
  width: 48px;
}

.section-dot.visited {
  background: var(--success);
}

/* Content Body */
.content-body {
  flex: 1;
  padding: 2rem 3rem;
  max-width: 900px;
  width: 100%;
  animation: fadeInUp 0.4s ease;
}

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

/* Markdown Content Styles */
.content-body h1 { font-size: 1.8rem; font-weight: 800; margin: 2rem 0 1rem; color: var(--text-primary); }
.content-body h2 { font-size: 1.5rem; font-weight: 700; margin: 1.8rem 0 0.8rem; color: var(--text-primary); border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }
.content-body h3 { font-size: 1.25rem; font-weight: 600; margin: 1.5rem 0 0.6rem; color: var(--accent); }
.content-body h4 { font-size: 1.1rem; font-weight: 600; margin: 1.2rem 0 0.5rem; }

.content-body p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.content-body ul, .content-body ol {
  margin: 0.5rem 0 1rem 1.5rem;
  color: var(--text-secondary);
}

.content-body li {
  margin-bottom: 0.4rem;
  line-height: 1.7;
}

.content-body strong { color: var(--text-primary); font-weight: 600; }

.content-body code {
  background: var(--bg-tertiary);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: var(--cyan);
}

.content-body pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
  position: relative;
}

.content-body pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.6;
}

.content-body blockquote {
  border-left: 4px solid var(--accent);
  background: rgba(59,130,246,0.08);
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.content-body th {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.content-body td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.content-body tr:hover td { background: rgba(59,130,246,0.05); }

.content-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1rem 0;
}

.content-body hr {
  border: none;
  height: 2px;
  background: var(--border);
  margin: 2rem 0;
}

/* ===== Special Content Blocks ===== */

/* Info/Tip/Warning/Danger Callouts */
.callout {
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  border-left: 4px solid;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.callout-icon { font-size: 1.2rem; margin-top: 0.1rem; }

.callout-info { background: rgba(59,130,246,0.1); border-color: var(--accent); }
.callout-info .callout-icon { color: var(--accent); }

.callout-tip { background: rgba(16,185,129,0.1); border-color: var(--success); }
.callout-tip .callout-icon { color: var(--success); }

.callout-warning { background: rgba(245,158,11,0.1); border-color: var(--warning); }
.callout-warning .callout-icon { color: var(--warning); }

.callout-danger { background: rgba(239,68,68,0.1); border-color: var(--danger); }
.callout-danger .callout-icon { color: var(--danger); }

/* Interview Q&A Cards */
.interview-qa {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1rem 0;
  overflow: hidden;
}

.interview-q {
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.05));
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.interview-q:hover { background: rgba(59,130,246,0.15); }

.interview-q::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.8rem;
  transition: var(--transition);
  color: var(--accent);
}

.interview-qa.open .interview-q::after { transform: rotate(180deg); }

.interview-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.interview-a-inner {
  padding: 1.25rem 1.5rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.interview-qa.open .interview-a {
  max-height: 2000px;
}

/* Hands-On Practice Box */
.hands-on {
  background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(59,130,246,0.05));
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.hands-on-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

/* Quiz Component */
.quiz-box {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.quiz-question {
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1.05rem;
  display: flex;
  gap: 0.5rem;
}

.quiz-question::before {
  content: '\f059';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--purple);
}

.quiz-options { list-style: none; padding: 0; }

.quiz-option {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quiz-option:hover {
  border-color: var(--accent);
  background: rgba(59,130,246,0.05);
}

.quiz-option.selected {
  border-color: var(--accent);
  background: rgba(59,130,246,0.1);
}

.quiz-option.correct {
  border-color: var(--success);
  background: rgba(16,185,129,0.1);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: rgba(239,68,68,0.1);
}

.quiz-option-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.quiz-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  display: none;
  line-height: 1.7;
}

.quiz-feedback.show { display: block; animation: fadeInUp 0.3s ease; }
.quiz-feedback.correct { background: rgba(16,185,129,0.1); border: 1px solid var(--success); }
.quiz-feedback.incorrect { background: rgba(239,68,68,0.1); border: 1px solid var(--danger); }

/* Mermaid diagrams */
.mermaid {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
  text-align: center;
  overflow-x: auto;
}

/* ===== Content Footer / Navigation ===== */
.content-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 3rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  bottom: 0;
}

.btn-nav {
  padding: 0.65rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
}

.btn-nav:hover {
  border-color: var(--accent);
  background: rgba(59,130,246,0.1);
  color: var(--accent);
}

.btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-next {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-next:hover {
  background: var(--accent-hover);
}

.section-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal.show { display: flex; }

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: fadeInUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.timer-display {
  font-size: 3rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  margin: 1rem 0;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.btn-timer {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-timer:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.timer-note { font-size: 0.8rem; color: var(--text-muted); }

/* ===== Popup ===== */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
}

.popup-overlay.show { display: block; }

.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 160;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s ease;
}

.popup.show { display: block; }

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
}

.popup-title { font-weight: 700; font-size: 1rem; }

.popup-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
}

.popup-body {
  padding: 1.5rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3s forwards;
  min-width: 250px;
  max-width: 400px;
}

@keyframes slideInRight {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(50px); }
}

.toast-success .toast-icon { color: var(--success); }
.toast-info .toast-icon { color: var(--accent); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-icon { font-size: 1.1rem; }
.toast-msg { font-size: 0.85rem; font-weight: 500; }

/* ===== Keyword Popups ===== */
.keyword {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent);
  cursor: pointer;
  transition: var(--transition);
}

.keyword:hover {
  color: var(--purple);
  border-color: var(--purple);
}

/* ===== Loading Spinner ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  gap: 0.75rem;
}

/* ===== Accordion ===== */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1rem 0;
  overflow: hidden;
}

.accordion-header {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  transition: var(--transition);
}

.accordion-header:hover { background: var(--bg-tertiary); }

.accordion-header::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--accent);
  transition: var(--transition);
}

.accordion.open .accordion-header::after {
  content: '−';
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.accordion.open .accordion-body {
  max-height: 5000px;
}

.accordion-body-inner {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ===== Tab Component ===== */
.tabs {
  margin: 1.5rem 0;
}

.tab-headers {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  overflow-x: auto;
}

.tab-header {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-header:hover { color: var(--text-primary); }

.tab-header.active {
  color: var(--accent);
  border-color: var(--accent);
}

.tab-content { display: none; padding: 1.25rem 0; animation: fadeInUp 0.3s ease; }
.tab-content.active { display: block; }

/* ===== Flashcard ===== */
.flashcard {
  perspective: 1000px;
  margin: 1.5rem 0;
  height: 200px;
  cursor: pointer;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  position: relative;
}

.flashcard.flipped .flashcard-inner { transform: rotateX(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  font-size: 1rem;
  line-height: 1.6;
}

.flashcard-front {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.1));
  border: 1px solid var(--accent);
  font-weight: 600;
}

.flashcard-back {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(6,182,212,0.1));
  border: 1px solid var(--success);
  transform: rotateX(180deg);
  color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 85; }
  .sidebar-overlay.show { display: block; }
  .content { margin-left: 0; }
  .menu-toggle { display: block; }
  .module-header { padding: 2rem; }
  .content-body { padding: 1.5rem 2rem; }
  .content-footer { padding: 1rem 2rem; }
  .section-progress { padding: 0.75rem 2rem; }
}

@media (max-width: 640px) {
  .splash h1 { font-size: 2rem; }
  .splash h2 { font-size: 1.2rem; }
  .splash-stats { gap: 0.5rem; }
  .stat-card { padding: 0.75rem 1rem; }

  .topbar { padding: 0 1rem; gap: 0.5rem; }
  .topbar-title span { display: none; }
  .topbar-progress { margin: 0 0.5rem; }

  .module-header { padding: 1.5rem; }
  .module-header h1 { font-size: 1.4rem; }
  .content-body { padding: 1.25rem 1.25rem; }
  .content-footer { padding: 1rem; }
  .section-progress { padding: 0.75rem 1.25rem; }

  .btn-nav { padding: 0.5rem 1rem; font-size: 0.85rem; }

  .content-body h2 { font-size: 1.3rem; }
  .content-body h3 { font-size: 1.1rem; }

  .flashcard { height: 180px; }
  .quiz-option { padding: 0.6rem 0.8rem; font-size: 0.9rem; }
}

/* ===== Print Styles ===== */
@media print {
  .topbar, .sidebar, .content-footer, .section-progress { display: none; }
  .content { margin-left: 0; }
  .content-body { max-width: 100%; }
}
