/* ===================================================================
   CCE EXAM HUB - MODERN NOTES READER & COLOR HIGHLIGHTER SYSTEM
   State-of-the-Art Interactive Study Experience
   - Real-marker Color Highlighting Engine (Yellow, Mint, Pink, Cyan, Violet, Amber)
   - Sepia Eye-Care, Light, and Cyber Dark Reading Modes
   - Floating Study Toolbar (Highlighter Pen, Font Scaler, Audio Read-Aloud, Search, Focus Mode)
   - Glowing Formula Cards, Interactive Solved Examples, High-Yield Takeaways
   - Reading Progress Bar & Scrollspy Table of Contents
   =================================================================== */

/* ===================================================================
   1. SEPIA & EYE-CARE THEME VARIABLES
   =================================================================== */
[data-theme="sepia"] {
  --bg-primary: #fbf0d9;
  --bg-secondary: #f3e4c4;
  --bg-elevated: #fffdf7;
  --bg-card: rgba(255, 252, 245, 0.94);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(251, 240, 217, 0.94);

  --border-subtle: rgba(140, 100, 50, 0.14);
  --border-medium: rgba(140, 100, 50, 0.24);
  --border-glow: rgba(190, 110, 30, 0.35);
  --border-active: #c25e00;

  --text-primary: #2d2319;
  --text-secondary: #584532;
  --text-muted: #85705a;
  --text-inverse: #fbf0d9;

  --shadow-sm: 0 2px 8px rgba(100, 65, 25, 0.08);
  --shadow-md: 0 8px 24px -4px rgba(100, 65, 25, 0.12);
  --shadow-lg: 0 20px 40px -12px rgba(100, 65, 25, 0.16);

  --accent-primary: #b45309;
  --accent-secondary: #0284c7;
  --accent-tertiary: #7e22ce;
  --accent-success: #047857;
  --accent-warning: #b45309;
  --accent-danger: #be123c;
}

/* ===================================================================
   2. COLOR HIGHLIGHTERS (Authentic Textbook Marker Styling)
   =================================================================== */
/* Base Highlighter Mark */
mark,
.hl-yellow,
.hl-green,
.hl-pink,
.hl-cyan,
.hl-purple,
.hl-amber,
.hl-pen-yellow,
.hl-pen-green,
.hl-pen-pink,
.hl-pen-cyan,
.hl-pen-purple {
  display: inline;
  padding: 0.15em 0.35em;
  margin: 0 0.1em;
  border-radius: 4px;
  font-weight: 600;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: all 0.2s ease;
  position: relative;
}

/* Yellow Highlighter (Core Concepts, Landmark Dates & Keywords) */
.hl-yellow,
.hl-pen-yellow,
mark:not([class*="hl-"]) {
  background: rgba(250, 204, 21, 0.32);
  color: #fef08a;
  border-bottom: 2px solid #eab308;
}
[data-theme="light"] .hl-yellow,
[data-theme="light"] .hl-pen-yellow,
[data-theme="light"] mark:not([class*="hl-"]) {
  background: rgba(250, 204, 21, 0.45);
  color: #713f12;
  border-bottom: 2px solid #ca8a04;
}
[data-theme="sepia"] .hl-yellow,
[data-theme="sepia"] .hl-pen-yellow,
[data-theme="sepia"] mark:not([class*="hl-"]) {
  background: rgba(234, 179, 8, 0.38);
  color: #422006;
  border-bottom: 2px solid #a16207;
}

/* Mint Green Highlighter (Formulas, Laws & Definitions) */
.hl-green,
.hl-pen-green {
  background: rgba(16, 185, 129, 0.28);
  color: #a7f3d0;
  border-bottom: 2px solid #10b981;
}
[data-theme="light"] .hl-green,
[data-theme="light"] .hl-pen-green {
  background: rgba(16, 185, 129, 0.36);
  color: #064e3b;
  border-bottom: 2px solid #059669;
}
[data-theme="sepia"] .hl-green,
[data-theme="sepia"] .hl-pen-green {
  background: rgba(5, 150, 105, 0.32);
  color: #064e3b;
  border-bottom: 2px solid #047857;
}

/* Rose Pink Highlighter (Warnings, Exceptions & Exam Traps) */
.hl-pink,
.hl-pen-pink {
  background: rgba(244, 63, 94, 0.28);
  color: #fecdd3;
  border-bottom: 2px solid #f43f5e;
}
[data-theme="light"] .hl-pink,
[data-theme="light"] .hl-pen-pink {
  background: rgba(244, 63, 94, 0.35);
  color: #881337;
  border-bottom: 2px solid #e11d48;
}
[data-theme="sepia"] .hl-pink,
[data-theme="sepia"] .hl-pen-pink {
  background: rgba(225, 29, 72, 0.3);
  color: #4c0519;
  border-bottom: 2px solid #be123c;
}

/* Electric Cyan Highlighter (Articles, Amendments & Constitutional Terms) */
.hl-cyan,
.hl-pen-cyan {
  background: rgba(14, 165, 233, 0.28);
  color: #bae6fd;
  border-bottom: 2px solid #0ea5e9;
}
[data-theme="light"] .hl-cyan,
[data-theme="light"] .hl-pen-cyan {
  background: rgba(14, 165, 233, 0.35);
  color: #0c4a6e;
  border-bottom: 2px solid #0284c7;
}
[data-theme="sepia"] .hl-cyan,
[data-theme="sepia"] .hl-pen-cyan {
  background: rgba(2, 132, 199, 0.3);
  color: #082f49;
  border-bottom: 2px solid #0369a1;
}

/* Neon Violet / Purple Highlighter (Committees, Famous Scholars & Case Laws) */
.hl-purple,
.hl-pen-purple {
  background: rgba(168, 85, 247, 0.28);
  color: #e9d5ff;
  border-bottom: 2px solid #a855f7;
}
[data-theme="light"] .hl-purple,
[data-theme="light"] .hl-pen-purple {
  background: rgba(168, 85, 247, 0.35);
  color: #4a044e;
  border-bottom: 2px solid #9333ea;
}
[data-theme="sepia"] .hl-purple,
[data-theme="sepia"] .hl-pen-purple {
  background: rgba(147, 51, 234, 0.3);
  color: #3b0764;
  border-bottom: 2px solid #7e22ce;
}

/* Sunset Amber Highlighter */
.hl-amber,
.hl-pen-amber {
  background: rgba(249, 115, 22, 0.28);
  color: #fed7aa;
  border-bottom: 2px solid #f97316;
}
[data-theme="light"] .hl-amber,
[data-theme="light"] .hl-pen-amber {
  background: rgba(249, 115, 22, 0.35);
  color: #7c2d12;
  border-bottom: 2px solid #ea580c;
}
[data-theme="sepia"] .hl-amber,
[data-theme="sepia"] .hl-pen-amber {
  background: rgba(234, 88, 12, 0.3);
  color: #431407;
  border-bottom: 2px solid #c2410c;
}

/* Hover effects on user highlights */
.hl-user-marked {
  cursor: pointer;
  position: relative;
}
.hl-user-marked:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
}

/* Pulsing Search Match Highlight */
.hl-search-match {
  background: #f59e0b !important;
  color: #000000 !important;
  border-radius: 3px;
  animation: hlPulse 1.4s ease-in-out infinite alternate;
}
@keyframes hlPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  100% { transform: scale(1.04); box-shadow: 0 0 14px 4px rgba(245, 158, 11, 0.6); }
}

/* ===================================================================
   3. READING PROGRESS BAR
   =================================================================== */
.reading-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 1001;
}
.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 35%, #ec4899 70%, #06b6d4 100%);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.8), 0 0 4px rgba(236, 72, 153, 0.8);
  transition: width 0.1s ease-out;
}

/* ===================================================================
   4. FLOATING STUDY & HIGHLIGHTER TOOLBAR
   =================================================================== */
.study-toolbar-wrapper {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: calc(100% - 2rem);
  max-width: 920px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.study-toolbar {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full, 9999px);
  padding: 0.5rem 0.85rem;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

[data-theme="light"] .study-toolbar {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(99, 102, 241, 0.15);
}

[data-theme="sepia"] .study-toolbar {
  background: rgba(255, 252, 243, 0.96);
  border-color: rgba(140, 100, 50, 0.2);
  box-shadow: 0 16px 36px -6px rgba(100, 65, 25, 0.18);
}

.study-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.study-toolbar-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 0.15rem;
}
[data-theme="light"] .study-toolbar-divider,
[data-theme="sepia"] .study-toolbar-divider {
  background: rgba(15, 23, 42, 0.14);
}

/* Tool Buttons */
.study-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 36px;
  padding: 0 0.65rem;
  border-radius: var(--radius-full, 9999px);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.study-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}
[data-theme="light"] .study-tool-btn:hover,
[data-theme="sepia"] .study-tool-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.12);
}

.study-tool-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
}

/* Highlighter Color Chips */
.hl-picker-group {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .hl-picker-group,
[data-theme="sepia"] .hl-picker-group {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(15, 23, 42, 0.08);
}

.hl-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hl-color-dot:hover {
  transform: scale(1.22);
}
.hl-color-dot.active {
  border-color: #ffffff;
  transform: scale(1.25);
  box-shadow: 0 0 10px currentColor;
}
[data-theme="light"] .hl-color-dot.active,
[data-theme="sepia"] .hl-color-dot.active {
  border-color: #0f172a;
}

.hl-dot-yellow { background-color: #eab308; color: #eab308; }
.hl-dot-green  { background-color: #10b981; color: #10b981; }
.hl-dot-pink   { background-color: #f43f5e; color: #f43f5e; }
.hl-dot-cyan   { background-color: #0ea5e9; color: #0ea5e9; }
.hl-dot-purple { background-color: #a855f7; color: #a855f7; }

/* Eraser Button */
.hl-eraser-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.75rem;
}
.hl-eraser-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  border-color: #f43f5e;
}
.hl-eraser-btn.active {
  background: #f43f5e;
  color: #ffffff;
}

/* Active Pen Indicator Banner */
.hl-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(250, 204, 21, 0.15);
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.3);
}
[data-theme="light"] .hl-active-badge {
  background: rgba(250, 204, 21, 0.25);
  color: #854d0e;
}
[data-theme="sepia"] .hl-active-badge {
  background: rgba(234, 179, 8, 0.2);
  color: #713f12;
}

/* Stats Pill */
.study-stats-pill {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-right: 0.3rem;
}

/* ===================================================================
   5. IN-NOTE QUICK SEARCH BAR
   =================================================================== */
.in-note-search-wrapper {
  position: fixed;
  top: 4.5rem;
  right: 1.5rem;
  z-index: 999;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.25s ease;
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
}
.in-note-search-wrapper.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.in-note-search-input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  width: 220px;
}
.in-note-search-count {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===================================================================
   6. MODERN NOTE READER VIEW LAYOUT
   =================================================================== */
.reader-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 8rem;
  transition: font-size 0.2s ease, max-width 0.3s ease;
}

/* Focus Mode */
body.focus-mode .navbar,
body.focus-mode .footer,
body.focus-mode .reader-header .hero-pill,
body.focus-mode .topic-index-grid,
body.focus-mode .reading-meta-chips {
  display: none !important;
}
body.focus-mode .reader-wrapper {
  max-width: 860px;
  padding-top: 1.5rem;
}
body.focus-mode .reader-title {
  font-size: 2.4rem;
}

/* Breadcrumbs */
.reader-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.reader-breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.reader-breadcrumbs a:hover {
  color: var(--accent-primary);
}
.reader-breadcrumbs span.sep {
  opacity: 0.4;
}
.reader-breadcrumbs span.current {
  color: var(--accent-primary);
  font-weight: 600;
}

/* Header & Banner */
.reader-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.reader-subject-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.2);
}

.reader-title {
  font-size: 2.85rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.18;
  margin-bottom: 1rem;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.reader-desc-lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Meta Chips */
.reading-meta-chips {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.reader-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.reader-meta-chip.chip-highlight {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

/* Quick Jump Topics Grid */
.topic-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  margin: 1.75rem 0 3.5rem;
}

.topic-index-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.topic-index-pill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-primary);
  opacity: 0;
  transition: opacity 0.2s;
}

.topic-index-pill:hover,
.topic-index-pill.active {
  border-color: var(--border-glow);
  color: var(--text-primary);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.25);
}

.topic-index-pill:hover::before,
.topic-index-pill.active::before {
  opacity: 1;
}

.topic-index-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
}

.topic-index-arrow {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.topic-index-pill:hover .topic-index-arrow {
  transform: translateX(3px);
  color: var(--accent-primary);
}

/* ===================================================================
   7. NOTE ARTICLE CONTENT TYPOGRAPHY & ELEMENTS
   =================================================================== */
.ai-note-article {
  font-size: 1.12rem;
  line-height: 1.88;
  color: var(--text-primary);
}

/* Section Headings with Subject Glow */
.ai-note-article h2 {
  font-size: 2rem;
  font-weight: 800;
  margin: 3.5rem 0 1.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.12) 0%, transparent 100%);
  border-left: 5px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  scroll-margin-top: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ai-note-article h3 {
  font-size: 1.42rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  color: var(--accent-primary);
  scroll-margin-top: 5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-note-article p {
  margin-bottom: 1.4rem;
  color: var(--text-secondary);
}

.ai-note-article ul,
.ai-note-article ol {
  margin-bottom: 1.75rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.ai-note-article li {
  margin-bottom: 0.75rem;
  position: relative;
}

.ai-note-article li strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Monospace & Inline Code */
.ai-note-article code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  padding: 0.2em 0.5em;
  border-radius: var(--radius-xs);
  background: rgba(99, 102, 241, 0.14);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.24);
}
[data-theme="light"] .ai-note-article code {
  background: rgba(99, 102, 241, 0.1);
  color: #4338ca;
  border-color: rgba(99, 102, 241, 0.2);
}
[data-theme="sepia"] .ai-note-article code {
  background: rgba(180, 83, 9, 0.12);
  color: #92400e;
  border-color: rgba(180, 83, 9, 0.2);
}

/* ===================================================================
   8. FORMULA BOX & SHORTCUT RULES (Modern Glass Card)
   =================================================================== */
.formula-box {
  background: var(--bg-card);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.85rem;
  margin: 2rem 0;
  box-shadow: 0 12px 30px -8px rgba(139, 92, 246, 0.15), var(--shadow-sm);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.formula-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
}

.formula-box h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #c084fc;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}
[data-theme="light"] .formula-box h4 {
  color: #7e22ce;
}
[data-theme="sepia"] .formula-box h4 {
  color: #6b21a8;
}

.formula-box p {
  color: var(--text-primary);
  font-size: 1.02rem;
  line-height: 1.85;
  margin-bottom: 0;
}

.formula-box code {
  background: rgba(139, 92, 246, 0.2);
  color: #f3e8ff;
  border-color: rgba(139, 92, 246, 0.35);
  font-weight: 700;
  padding: 0.25em 0.6em;
}
[data-theme="light"] .formula-box code {
  color: #581c87;
  background: rgba(139, 92, 246, 0.12);
}

/* ===================================================================
   9. SOLVED EXAMPLES & PRACTICE PROBLEMS
   =================================================================== */
.example-box {
  background: var(--bg-card);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.85rem;
  margin: 2rem 0;
  box-shadow: 0 12px 32px -8px rgba(14, 165, 233, 0.12), var(--shadow-sm);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.example-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0ea5e9, #06b6d4, #10b981);
}

.example-box h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
[data-theme="light"] .example-box h4 {
  color: #0284c7;
}
[data-theme="sepia"] .example-box h4 {
  color: #0369a1;
}

.example-item {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Question Container */
.example-q {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.65;
  background: rgba(14, 165, 233, 0.08);
  border-left: 4px solid #0ea5e9;
  padding: 0.9rem 1.15rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.badge-q {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  background: #0ea5e9;
  color: #ffffff;
  white-space: nowrap;
  margin-top: 0.15rem;
}

/* Step by Step Breakdown */
.example-steps {
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

/* Final Answer Badge */
.example-ans {
  font-size: 1rem;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px -2px rgba(16, 185, 129, 0.15);
}
.example-ans::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #10b981;
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 900;
}
[data-theme="light"] .example-ans {
  color: #047857;
  background: rgba(16, 185, 129, 0.15);
}

/* Subtopic Badge */
.subtopic-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.28);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.subtopic-badge::before {
  content: '🏷️';
  font-size: 0.85em;
}
[data-theme="light"] .subtopic-badge {
  background: rgba(99, 102, 241, 0.1);
  color: #4338ca;
}
[data-theme="sepia"] .subtopic-badge {
  background: rgba(180, 83, 9, 0.12);
  color: #92400e;
}

/* ===================================================================
   10. HIGH-YIELD EXAM KEY TAKEAWAY CARD
   =================================================================== */
.key-takeaway {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(6, 182, 212, 0.06) 100%);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.85rem;
  margin: 2.25rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 30px -8px rgba(16, 185, 129, 0.15);
}

.key-takeaway::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  bottom: 0;
  background: #10b981;
}

.key-takeaway h4 {
  color: #34d399;
  font-size: 1.22rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
[data-theme="light"] .key-takeaway h4 {
  color: #059669;
}
[data-theme="sepia"] .key-takeaway h4 {
  color: #047857;
}

.key-takeaway p {
  color: var(--text-primary);
  font-size: 1.02rem;
  line-height: 1.8;
  margin-bottom: 0;
}

/* ===================================================================
   11. MODERN DATA TABLES
   =================================================================== */
.table-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 2.25rem 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.ai-note-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.96rem;
  margin: 0;
}

.ai-note-article th {
  background: rgba(99, 102, 241, 0.14);
  color: var(--text-primary);
  font-weight: 800;
  text-align: left;
  padding: 1.05rem 1.35rem;
  border-bottom: 2px solid var(--border-medium);
  letter-spacing: -0.01em;
}

.ai-note-article td {
  padding: 0.95rem 1.35rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  line-height: 1.65;
}

.ai-note-article tbody tr:last-child td {
  border-bottom: none;
}

.ai-note-article tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}
[data-theme="light"] .ai-note-article tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.02);
}
[data-theme="sepia"] .ai-note-article tbody tr:nth-child(even) {
  background: rgba(140, 100, 50, 0.04);
}

.ai-note-article tbody tr:hover {
  background: rgba(99, 102, 241, 0.06);
}

/* ===================================================================
   12. CHAPTER BOTTOM NAVIGATION CARDS
   =================================================================== */
.chapter-nav-grid {
  margin-top: 4.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.chapter-nav-card {
  display: flex;
  flex-direction: column;
  padding: 1.35rem 1.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.chapter-nav-card:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.chapter-nav-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chapter-nav-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

/* ===================================================================
   13. AUDIO READ-ALOUD SPEECH SYNTHESIS PLAYER
   =================================================================== */
.audio-player-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.16) 0%, rgba(139, 92, 246, 0.12) 100%);
  border: 1px solid rgba(99, 102, 241, 0.32);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(12px);
}
.audio-status-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===================================================================
   14. PRINT STYLESHEET (Clean PDF Output)
   =================================================================== */
@media print {
  .navbar,
  .footer,
  .study-toolbar-wrapper,
  .in-note-search-wrapper,
  .reading-progress-container,
  .topic-index-grid,
  .chapter-nav-grid,
  .btn,
  .theme-toggle-btn {
    display: none !important;
  }
  
  body {
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 11pt !important;
  }

  .reader-wrapper {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .reader-title {
    color: #111827 !important;
    -webkit-text-fill-color: initial !important;
    font-size: 24pt !important;
  }

  .formula-box,
  .example-box,
  .key-takeaway {
    border: 1pt solid #cbd5e1 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  mark,
  .hl-yellow,
  .hl-green,
  .hl-pink,
  .hl-cyan,
  .hl-purple {
    border-bottom: 1pt solid #475569 !important;
    background: #f1f5f9 !important;
    color: #0f172a !important;
  }
}

/* ===================================================================
   15. RESPONSIVENESS
   =================================================================== */
@media (max-width: 768px) {
  .reader-title {
    font-size: 2.15rem;
  }
  .study-toolbar {
    padding: 0.4rem 0.65rem;
    gap: 0.4rem;
  }
  .study-tool-btn span.btn-text {
    display: none;
  }
  .chapter-nav-grid {
    grid-template-columns: 1fr;
  }
}
