/* ==========================================================================
   PRAVASH CODEX & ACADEMY - DESIGN SYSTEM
   Modern, Ultra-Premium Dark/Light Architecture
   ========================================================================== */

:root {
  /* Color Tokens - Modern OLED Dark Palette */
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(28, 38, 58, 0.95);
  --bg-elevated: #151e33;
  --bg-glass: rgba(15, 23, 42, 0.75);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.3);
  --border-focus: rgba(6, 182, 212, 0.5);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-invert: #090d16;

  /* Accent Vibrance */
  --emerald-glow: #10b981;
  --emerald-subtle: rgba(16, 185, 129, 0.12);
  --cyan-glow: #06b6d4;
  --cyan-subtle: rgba(6, 182, 212, 0.12);
  --amber-glow: #f59e0b;
  --amber-subtle: rgba(245, 158, 11, 0.12);
  --rose-glow: #f43f5e;
  --indigo-glow: #6366f1;

  /* Typography Tokens */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Geometry & Shadows */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.25);

  --header-height: 70px;
  --bottom-nav-height: 64px;
  --transition-smooth: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-active: rgba(16, 185, 129, 0.5);
  --border-focus: rgba(6, 182, 212, 0.6);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-invert: #f8fafc;

  --emerald-subtle: rgba(16, 185, 129, 0.15);
  --cyan-subtle: rgba(6, 182, 212, 0.15);
  --amber-subtle: rgba(245, 158, 11, 0.15);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.18);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Background Atmospheric Glow */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 20%;
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: 0;
  right: 10%;
  width: 500px;
  height: 350px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Links & Buttons Reset */
a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-smooth);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 36px;
}

/* Brand Logo */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: translateY(-1px);
}

.logo-symbol {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.logo-char {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  color: #090d16;
}

.logo-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  border: 2px solid var(--bg-primary);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-accent {
  color: var(--emerald-glow);
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Nav Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--border-subtle);
}

.nav-link.active {
  color: var(--emerald-glow);
  background: var(--emerald-subtle);
  border: 1px solid var(--border-active);
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.header-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Search Trigger */
.search-trigger-btn {
  min-width: 200px;
  justify-content: space-between;
  background: var(--bg-secondary);
}

.search-btn-text {
  color: var(--text-muted);
}

.search-kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--border-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* PDF Dropdown */
.dropdown-wrapper {
  position: relative;
}

.pdf-btn {
  background: var(--emerald-subtle);
  border-color: var(--border-active);
  color: var(--emerald-glow);
  font-weight: 600;
}

.pdf-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  flex-direction: column;
  z-index: 200;
  animation: dropIn 0.15s ease-out;
}

.dropdown-wrapper.open .dropdown-menu {
  display: flex;
}

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

.dropdown-header {
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
}

.dropdown-header span {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.dropdown-header small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.dropdown-item:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.dropdown-item.highlight {
  background: var(--emerald-subtle);
  border: 1px solid var(--border-active);
  color: var(--emerald-glow);
}

.dropdown-item.highlight:hover {
  background: rgba(16, 185, 129, 0.2);
}

.dropdown-item .item-icon {
  font-size: 1.25rem;
}

.dropdown-item .item-info {
  display: flex;
  flex-direction: column;
}

.dropdown-item .item-info strong {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.dropdown-item .item-info small {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

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

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* ==========================================================================
   MAIN CONTENT & ROUTING CONTAINER
   ========================================================================== */

.main-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 80px;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   VIEW 1: DASHBOARD / ACADEMY HOME
   ========================================================================== */

.dashboard-hero {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 182, 212, 0.08) 50%, rgba(99, 102, 241, 0.05) 100%);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-xl);
  padding: 40px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.dashboard-hero::after {
  content: 'BRAHMASTRA';
  position: absolute;
  right: -20px;
  bottom: -20px;
  font-family: var(--font-heading);
  font-size: 6rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.02);
  pointer-events: none;
  letter-spacing: 0.1em;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--emerald-subtle);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--emerald-glow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
  max-width: 750px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, #34d399, #10b981);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Stats Ribbon */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition-smooth);
}

.stat-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: var(--bg-elevated);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Section Titles */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--emerald-glow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Course Grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.course-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  box-shadow: var(--shadow-md);
}

.course-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.course-badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--emerald-subtle);
  color: var(--emerald-glow);
  border: 1px solid var(--border-active);
}

.course-badge.blue {
  background: var(--cyan-subtle);
  color: var(--cyan-glow);
  border-color: var(--border-focus);
}

.course-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
}

.course-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  flex: 1;
}

.course-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.meta-pill {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.course-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.course-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--emerald-glow);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s ease;
}

.course-card:hover .course-link {
  gap: 10px;
}

/* ==========================================================================
   VIEW 2: OPTIONS TRACK VIEW
   ========================================================================== */

.track-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.track-hero-left {
  max-width: 650px;
}

.track-hero-title {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.track-hero-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.episode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: var(--transition-smooth);
}

.episode-card.active {
  border-color: var(--border-active);
  cursor: pointer;
}

.episode-card.active:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--emerald-glow);
}

.episode-card.locked {
  opacity: 0.65;
  background: rgba(18, 24, 38, 0.4);
}

.episode-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.episode-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--emerald-glow);
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--emerald-subtle);
}

.episode-status {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.episode-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}

.episode-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex: 1;
}

.episode-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.btn-open-ep {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--emerald-glow);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   VIEW 3: THE INTERACTIVE STUDY READER
   ========================================================================== */

.reader-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Reader Toolbar */
.reader-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.reader-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reader-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.reader-back-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.reader-episode-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}

.reader-page-indicator {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--emerald-glow);
  background: var(--emerald-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.reader-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.tool-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.tool-btn.highlight {
  background: var(--emerald-subtle);
  border-color: var(--border-active);
  color: var(--emerald-glow);
}

/* Reader Main Workspace (Canvas + Sidebar) */
.reader-workspace {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  min-height: 700px;
  align-items: start;
}

/* 1. Left Drawer: Page Directory */
.reader-drawer {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 820px;
  overflow-y: auto;
}

.drawer-header {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.page-list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid transparent;
  color: var(--text-secondary);
  text-align: left;
  transition: var(--transition-smooth);
}

.page-list-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.page-list-item.active {
  background: var(--emerald-subtle);
  border-color: var(--border-active);
  color: var(--emerald-glow);
}

.page-list-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 22px;
  margin-top: 2px;
}

.page-list-title {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}

/* 2. Center Stage: High-Res Slide Canvas */
.reader-stage {
  position: relative;
  background: #000000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 780px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  user-select: none;
}

.slide-canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 820px;
  touch-action: pan-y pinch-zoom;
}

.slide-image {
  max-width: 100%;
  max-height: 800px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  transition: transform 0.2s ease, opacity 0.15s ease;
  cursor: zoom-in;
}

/* Floating Stage Controls (Prev / Next Arrows) */
.stage-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
  z-index: 10;
}

.stage-nav-btn:hover {
  background: rgba(16, 185, 129, 0.85);
  transform: translateY(-50%) scale(1.08);
}

.stage-nav-btn.prev { left: 16px; }
.stage-nav-btn.next { right: 16px; }

/* 3. Right Panel: Concept Breakdown & Takeaways */
.reader-notes-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 820px;
  overflow-y: auto;
}

.notes-header-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cyan-glow);
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--cyan-subtle);
  display: inline-block;
  align-self: flex-start;
}

.notes-slide-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}

.notes-metaphor-box {
  background: var(--bg-elevated);
  border-left: 3px solid var(--emerald-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
}

.metaphor-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--emerald-glow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.metaphor-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notes-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notes-bullet-item {
  display: flex;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.notes-bullet-item::before {
  content: '•';
  color: var(--emerald-glow);
  font-size: 1.2rem;
  line-height: 1;
}

.notes-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.concept-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

/* Filmstrip Thumbnail Bar at Bottom */
.filmstrip-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.filmstrip-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 80px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition-smooth);
}

.filmstrip-thumb:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.filmstrip-thumb.active {
  opacity: 1;
  border-color: var(--emerald-glow);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.filmstrip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   SEARCH MODAL
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}

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

.search-modal-box {
  width: 90%;
  max-width: 680px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.search-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.search-close-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--border-subtle);
  color: var(--text-muted);
}

.search-quick-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.quick-tag-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tag-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.tag-pill:hover {
  background: var(--emerald-subtle);
  border-color: var(--border-active);
  color: var(--emerald-glow);
}

.search-results-list {
  max-height: 420px;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.search-result-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateX(4px);
}

.result-thumb {
  width: 48px;
  height: 64px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.result-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--emerald-glow);
}

.result-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-snippet {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   LIGHTBOX FULL-SCREEN VIEW
   ========================================================================== */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(16px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-close-btn {
  position: absolute;
  top: 24px;
  right: 28px;
  font-size: 2.2rem;
  color: #ffffff;
  opacity: 0.75;
  transition: opacity 0.2s ease;
  z-index: 1010;
}

.lightbox-close-btn:hover {
  opacity: 1;
}

.lightbox-content {
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 2000;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: var(--transition-smooth);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  z-index: 90;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px;
}

.bottom-nav-item.active {
  color: var(--emerald-glow);
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (Mobile & Tablet)
   ========================================================================== */

@media (max-width: 1200px) {
  .reader-workspace {
    grid-template-columns: 240px 1fr;
  }
  .reader-notes-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .reader-workspace {
    grid-template-columns: 1fr;
  }
  .reader-drawer {
    display: none; /* Collapsed on mobile, accessible via dropdown */
  }
  .search-trigger-btn {
    min-width: unset;
  }
  .search-btn-text, .search-kbd {
    display: none;
  }
  .pdf-btn .btn-label {
    display: none;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .main-content {
    padding-bottom: 90px;
  }
  .dashboard-hero {
    padding: 24px;
  }
  .hero-title {
    font-size: 1.8rem;
  }
  .stage-nav-btn {
    width: 38px;
    height: 38px;
  }
}
