/* ==========================================================================
   ISTQB Certified Tester Advanced Level - Technical Test Analyst (CTAL-TTA)
   Modern, responsive styling with Dark/Light theme & smooth animations
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-glow: rgba(37, 99, 235, 0.25);
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --info: #06b6d4;
  --info-bg: #ecfeff;
  
  /* Dark theme defaults */
  --bg-main: #0b0f19;
  --bg-card: #111827;
  --bg-card-hover: #172033;
  --bg-surface: #1e293b;
  --border-color: #334155;
  --border-light: #1e293b;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-surface: #e2e8f0;
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --primary-light: #eff6ff;
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge-cert {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(167, 139, 250, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.nav-btn.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

/* ==========================================================================
   Main Container & Layout
   ========================================================================== */
.main-content {
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

.view-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-panel.active {
  display: block;
}

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

.page-title-row {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* ==========================================================================
   Dashboard View
   ========================================================================== */
.hero-banner {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(37, 99, 235, 0.15));
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.2), transparent 70%);
  pointer-events: none;
}

.hero-content h2 {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

[data-theme="light"] .hero-content h2 {
  color: #0f172a;
}

.hero-content p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 750px;
  margin-bottom: 1.5rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.stat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: rgba(37, 99, 235, 0.15); color: #60a5fa; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: #c084fc; }
.stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.stat-info .stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-info .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Dashboard Action Cards */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s ease;
  position: relative;
}

.dash-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-card);
}

.dash-card-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dash-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.dash-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.dash-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.dash-card-footer {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-card-badge {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-success { background: var(--success); color: #ffffff; }
.btn-warning { background: var(--warning); color: #0f172a; }
.btn-danger { background: var(--danger); color: #ffffff; }

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Exam Overview Box */
.exam-summary-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.summary-item h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.summary-item p {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

/* ==========================================================================
   Chapter Study Guide & Notes View
   ========================================================================== */
.chapters-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .chapters-layout {
    grid-template-columns: 1fr;
  }
}

.chapter-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  height: fit-content;
  position: sticky;
  top: 75px;
}

.chapter-sidebar-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
}

.chapter-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chapter-nav-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
}

.chapter-nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.chapter-nav-item.active {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border-color: rgba(124, 58, 237, 0.35);
}

.chapter-nav-num {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 700;
}

.chapter-nav-item.active .chapter-nav-num {
  color: #c4b5fd;
}

.chapter-content-pane {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.chapter-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}

.chapter-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.badge-tag {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-klevel {
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.35);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.chapter-title-text {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.chapter-subtitle-text {
  color: var(--text-muted);
  font-size: 1rem;
}

.learning-objectives-box {
  background: rgba(124, 58, 237, 0.08);
  border-left: 4px solid #7c3aed;
  padding: 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 1.75rem;
}

.learning-objectives-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #a78bfa;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.learning-objectives-box ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-main);
}

.learning-objectives-box li {
  margin-bottom: 0.35rem;
}

.section-block {
  margin-bottom: 2rem;
}

.section-block h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.4rem;
}

.section-block p, .section-block ul, .section-block ol {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.section-block ul, .section-block ol {
  padding-left: 1.5rem;
}

.section-block li {
  margin-bottom: 0.4rem;
}

.section-block table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.88rem;
}

.section-block th, .section-block td {
  border: 1px solid var(--border-color);
  padding: 0.65rem 0.85rem;
  text-align: left;
}

.section-block th {
  background: var(--bg-surface);
  font-weight: 700;
}

.cheatsheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.cheatsheet-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.cheatsheet-key {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #a78bfa;
  margin-bottom: 0.25rem;
}

.cheatsheet-val {
  font-size: 0.88rem;
  color: var(--text-main);
}

.pitfalls-box {
  background: rgba(239, 68, 68, 0.08);
  border-left: 4px solid var(--danger);
  padding: 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.5rem 0;
}

.pitfalls-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pitfalls-box ul {
  padding-left: 1.25rem;
  font-size: 0.88rem;
}

.pitfalls-box li {
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   Interactive Flashcards View
   ========================================================================== */
.flashcards-container {
  max-width: 800px;
  margin: 0 auto;
}

.flashcard-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
}

.flashcard-progress-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card-perspective-stage {
  perspective: 1200px;
  width: 100%;
  min-height: 380px;
  margin-bottom: 1.5rem;
}

.flashcard {
  width: 100%;
  min-height: 380px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
  cursor: pointer;
  border-radius: var(--radius-xl);
}

.flashcard.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
}

.card-front {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-surface));
}

.card-back {
  background: linear-gradient(145deg, var(--bg-surface), var(--bg-card));
  transform: rotateY(180deg);
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-chapter-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a78bfa;
  background: rgba(124, 58, 237, 0.15);
  padding: 3px 8px;
  border-radius: 4px;
}

.card-flip-prompt {
  font-size: 0.75rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card-main-content {
  margin: auto 0;
  text-align: center;
}

.card-main-content h3 {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-main);
}

.card-main-content p {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-line;
}

.card-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
}

.card-category-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.flashcard-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.deck-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.deck-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #2563eb);
  width: 0%;
  transition: width 0.3s ease;
}

/* ==========================================================================
   Practice Questions View
   ========================================================================== */
.practice-controls {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.filters-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.search-input {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  outline: none;
  min-width: 240px;
}

.search-input:focus {
  border-color: var(--primary);
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.question-card.active {
  border-color: var(--primary);
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.question-num {
  font-weight: 800;
  font-size: 0.85rem;
  color: #a78bfa;
}

.question-body {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.question-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.option-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  user-select: none;
}

.option-item:hover:not(.locked) {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateX(2px);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.option-item.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
}

.option-item.selected .option-letter {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.option-item.correct {
  border-color: var(--success) !important;
  background: rgba(16, 185, 129, 0.12) !important;
}

.option-item.correct .option-letter {
  background: var(--success) !important;
  color: #ffffff !important;
  border-color: var(--success) !important;
}

.option-item.incorrect {
  border-color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.12) !important;
}

.option-item.incorrect .option-letter {
  background: var(--danger) !important;
  color: #ffffff !important;
  border-color: var(--danger) !important;
}

.explanation-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease;
}

.explanation-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.explanation-rationale {
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.distractors-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

.distractors-list {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.distractors-list li {
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Mock Exam Simulator
   ========================================================================== */
.exam-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.exam-mode-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.exam-mode-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.exam-mode-card.selected {
  border-color: var(--primary);
  background: rgba(124, 58, 237, 0.15);
}

.exam-mode-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exam-mode-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.exam-header-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.exam-timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 800;
  color: #a78bfa;
  background: rgba(124, 58, 237, 0.1);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(124, 58, 237, 0.25);
}

.exam-timer.warning {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.exam-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .exam-layout {
    grid-template-columns: 1fr;
  }
}

.exam-nav-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  height: fit-content;
  position: sticky;
  top: 75px;
}

.exam-nav-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.exam-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 1.25rem;
  padding-right: 4px;
}

.exam-grid-cell {
  aspect-ratio: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.exam-grid-cell:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.exam-grid-cell.current {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--primary);
}

.exam-grid-cell.answered {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.exam-grid-cell.flagged::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  background: #f59e0b;
  border-radius: 50%;
}

.exam-legend {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
  margin-bottom: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Exam Score Result Screen */
.exam-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: var(--shadow-card);
}

.result-badge {
  display: inline-flex;
  padding: 0.5rem 1.5rem;
  border-radius: 9999px;
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
}

.result-badge.passed {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 2px solid #10b981;
}

.result-badge.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 2px solid #ef4444;
}

.result-score-number {
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.result-score-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.chapter-performance-breakdown {
  text-align: left;
  margin: 2rem 0;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.chapter-performance-breakdown h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.perf-bar-row {
  margin-bottom: 0.85rem;
}

.perf-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.perf-bar-track {
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
}

.perf-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.6s ease;
}

.perf-bar-fill.high { background: var(--success); }
.perf-bar-fill.medium { background: var(--warning); }
.perf-bar-fill.low { background: var(--danger); }

/* ==========================================================================
   Technical Testing Tools (MC/DC, Cyclomatic Complexity, Risk Matrix)
   ========================================================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.tool-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.tool-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.calc-input-group {
  margin-bottom: 1rem;
}

.calc-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.calc-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
}

.calc-input:focus {
  border-color: var(--primary);
}

.calc-results-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.calc-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.calc-metric-row:last-child {
  margin-bottom: 0;
}

.calc-metric-val {
  font-size: 1.25rem;
  font-weight: 800;
}

/* Truth Table styling for MC/DC */
.truth-table-container {
  overflow-x: auto;
  margin-top: 1rem;
}

.truth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: center;
}

.truth-table th, .truth-table td {
  border: 1px solid var(--border-color);
  padding: 6px 8px;
}

.truth-table th {
  background: var(--bg-surface);
}

.truth-table tr.mcdc-selected {
  background: rgba(16, 185, 129, 0.15);
  font-weight: 700;
}

/* ==========================================================================
   Glossary View
   ========================================================================== */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.glossary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease;
}

.glossary-card:hover {
  border-color: var(--primary);
}

.glossary-term-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.glossary-term {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.glossary-acronym {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.glossary-def {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.glossary-footer {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-top: auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
}

/* ==========================================================================
   Modal Dialog
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-card);
  animation: modalScale 0.25s ease;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-box h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.modal-box p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Utility classes */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }
