/* =============================================
   WBCS MASTER — Premium Study Portal Styles
   ============================================= */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Dark theme (default) */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2035;
  --bg-card-hover: #222b45;
  --bg-glass: rgba(26, 32, 53, 0.75);
  --bg-glass-border: rgba(255, 255, 255, 0.08);

  --text-primary: #f0f2f5;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-dark: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;

  --gradient-hero: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --gradient-card: linear-gradient(145deg, var(--bg-card) 0%, rgba(30, 41, 70, 1) 100%);

  --sidebar-width: 280px;
  --header-height: 60px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
  --shadow-glow: 0 0 25px var(--accent-glow);

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
  --bg-primary: #f5f7fb;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f8;
  --bg-glass: rgba(255, 255, 255, 0.8);
  --bg-glass-border: rgba(0, 0, 0, 0.08);

  --text-primary: #1a1a2e;
  --text-secondary: #4a5568;
  --text-muted: #94a3b8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow: hidden;
  height: 100vh;
}

::selection {
  background: var(--accent);
  color: #fff;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ---------- App Layout ---------- */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- SIDEBAR ---------- */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--bg-glass-border);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), width var(--transition-normal);
  z-index: 100;
  overflow: hidden;
}

#sidebar.collapsed {
  transform: translateX(-100%);
  width: 0;
  min-width: 0;
  border: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--bg-glass-border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.logo-icon { font-size: 1.6rem; }
.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.logo-accent {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: none;
}
.sidebar-close:hover { background: var(--bg-card); color: var(--text-primary); }

/* Search */
.sidebar-search { padding: 12px 14px 8px; }

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  gap: 8px;
  transition: border-color var(--transition-fast);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: var(--shadow-glow); }

.search-icon { font-size: 0.85rem; opacity: 0.5; }

.search-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
}
.search-box input::placeholder { color: var(--text-muted); }

.search-shortcut {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
  border: 1px solid var(--bg-glass-border);
}

/* Search results */
.search-results {
  padding: 0 14px 10px;
  max-height: 300px;
  overflow-y: auto;
}
.search-results.hidden { display: none; }
.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 2px;
  transition: background var(--transition-fast);
}
.search-result-item:hover { background: var(--bg-card-hover); }
.search-result-item .result-subject {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Subject nav */
.subject-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
}

.nav-subject {
  margin-bottom: 2px;
}

.nav-subject-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-align: left;
}
.nav-subject-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}
.nav-subject-btn.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  font-weight: 600;
}

.nav-subject-icon { font-size: 1.1rem; }
.nav-subject-label { flex: 1; }
.nav-subject-progress {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--bg-glass-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-ring-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring { transform: rotate(-90deg); }

.progress-ring-bg {
  fill: none;
  stroke: var(--bg-card);
  stroke-width: 4;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 138.23;
  stroke-dashoffset: 138.23;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.progress-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ---------- MAIN CONTENT ---------- */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
#header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-glass-border);
  z-index: 50;
}

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

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

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.breadcrumb span { cursor: pointer; transition: color var(--transition-fast); }
.breadcrumb span:hover { color: var(--accent-light); }
.breadcrumb .bc-sep { cursor: default; opacity: 0.4; }
.breadcrumb .bc-current { color: var(--text-primary); font-weight: 600; cursor: default; }

/* Icon buttons */
.icon-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  color: var(--text-primary);
}
.icon-btn:hover { background: var(--bg-card); }

.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
}
.badge:empty { display: none; }

/* ---------- CONTENT WRAPPER ---------- */
.content-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* View management */
.view { display: none; }
.view.active { display: block; }

/* ---------- DASHBOARD ---------- */

/* Hero */
.dashboard-hero {
  position: relative;
  background: var(--gradient-hero);
  padding: 56px 40px 48px;
  overflow: hidden;
}

.hero-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  animation: float-particle 6s infinite ease-in-out;
}

@keyframes float-particle {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; }
  50% { transform: translateY(-30px) scale(1.5); opacity: 0.7; }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 900;
  color: #fff;
  letter-spacing: -1px;
  margin-bottom: 8px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.gradient-text {
  background: linear-gradient(135deg, #fcd34d 0%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.85);
  font-weight: 400;
  margin-bottom: 32px;
}
.hero-subtitle strong {
  color: #fcd34d;
  font-weight: 700;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-card {
  padding: 16px 28px;
  border-radius: var(--radius-md);
  text-align: center;
  min-width: 110px;
}
.stat-card.glass {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.15);
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-mono);
  letter-spacing: -1px;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Section titles */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 32px 28px 18px;
  color: var(--text-primary);
}

/* Subject Grid */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding: 0 28px 32px;
}

.subject-card {
  background: var(--gradient-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}
.subject-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent));
  opacity: 0.8;
}
.subject-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--card-accent, var(--accent));
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

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

.card-chapters {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-progress-bar {
  flex: 1;
  max-width: 100px;
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  margin-left: 12px;
  overflow: hidden;
}
.card-progress-fill {
  height: 100%;
  background: var(--card-accent, var(--accent));
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* Strategy cards */
.strategy-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 0 28px 48px;
}

.strategy-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform var(--transition-normal);
}
.strategy-card:hover { transform: translateY(-2px); }

.strategy-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.strategy-card p, .strategy-card li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.strategy-card ul {
  padding-left: 18px;
  margin-top: 6px;
}
.strategy-card li { margin-bottom: 4px; }

/* ---------- STUDY VIEW ---------- */
.study-layout {
  display: flex;
  height: calc(100vh - var(--header-height));
}

/* Chapter sidebar */
.chapter-sidebar {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid var(--bg-glass-border);
  background: var(--bg-secondary);
  overflow-y: auto;
  padding: 16px 0;
}

.chapter-group { margin-bottom: 4px; }

.chapter-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}
.chapter-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.chapter-btn.active { color: var(--accent-light); background: var(--accent-glow); }

.chapter-btn .ch-arrow {
  font-size: 0.6rem;
  transition: transform var(--transition-fast);
}
.chapter-btn.expanded .ch-arrow { transform: rotate(90deg); }

.chapter-topics { display: none; padding-left: 8px; }
.chapter-topics.expanded { display: block; }

.topic-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 18px 7px 32px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.topic-btn:hover { color: var(--text-primary); background: var(--bg-card); }
.topic-btn.active { color: var(--accent-light); font-weight: 600; }

.topic-btn .topic-status {
  font-size: 0.65rem;
  margin-left: auto;
  flex-shrink: 0;
}

/* Topic Content Area */
.topic-content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px 60px;
  max-width: 900px;
}

.topic-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.topic-title-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.topic-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Tabs */
.content-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--bg-glass-border);
  padding-bottom: 0;
}

.tab {
  padding: 10px 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

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

/* Notes content styling */
.tab-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--bg-glass-border);
  padding-bottom: 6px;
}
.tab-content h3:first-child { margin-top: 0; }

.tab-content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 18px 0 8px;
  color: var(--accent-light);
}

.tab-content p {
  margin-bottom: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.tab-content ul, .tab-content ol {
  padding-left: 22px;
  margin-bottom: 14px;
}
.tab-content li {
  margin-bottom: 6px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.tab-content li strong {
  color: var(--text-primary);
}

.tab-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.85rem;
}
.tab-content th {
  background: var(--bg-card);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--accent-light);
  border-bottom: 2px solid var(--accent);
}
.tab-content td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--bg-glass-border);
  color: var(--text-secondary);
}
.tab-content tr:hover td {
  background: var(--bg-card);
}

.tab-content .highlight-box {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
  font-size: 0.88rem;
}

.tab-content .important {
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 14px 0;
}

/* Key Points */
.keypoint-list {
  list-style: none;
  padding: 0;
}

.keypoint-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
  transition: border-color var(--transition-fast);
}
.keypoint-item:hover { border-color: var(--accent); }
.keypoint-bullet {
  color: var(--accent);
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* MCQ styling */
.mcq-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.mcq-question {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  line-height: 1.6;
}
.mcq-question .q-number {
  color: var(--accent-light);
  font-family: var(--font-mono);
  margin-right: 6px;
}

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

.mcq-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--bg-glass-border);
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.mcq-option:hover:not(.selected):not(.correct):not(.wrong) {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.mcq-option.selected { border-color: var(--info); background: rgba(59, 130, 246, 0.1); }
.mcq-option.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
  font-weight: 600;
}
.mcq-option.wrong {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  text-decoration: line-through;
  opacity: 0.7;
}

.mcq-option .opt-letter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.mcq-explanation {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--success-bg);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--success);
  line-height: 1.6;
}
.mcq-explanation.show { display: block; animation: fadeIn 0.3s ease; }

/* Topic navigation */
.topic-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-glass-border);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-dark); box-shadow: var(--shadow-glow); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--bg-glass-border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-light); }
.btn-outline.active { border-color: var(--accent); color: var(--accent-light); background: var(--accent-glow); }

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

.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-success.completed { background: var(--text-muted); }

/* ---------- BOOKMARKS VIEW ---------- */
.bookmarks-header {
  padding: 32px 28px 16px;
}
.bookmarks-header h2 { font-size: 1.4rem; font-weight: 800; }
.muted { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

.bookmarks-list { padding: 0 28px 32px; }

.bookmark-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.bookmark-item:hover { border-color: var(--accent); transform: translateX(4px); }

.bookmark-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.bookmark-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.bookmark-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}
.bookmark-remove:hover { color: var(--danger); background: var(--danger-bg); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state.hidden { display: none; }
.empty-icon { font-size: 3rem; display: block; margin-bottom: 12px; }

/* ---------- QUIZ VIEW ---------- */
.quiz-container {
  max-width: 720px;
  margin: 32px auto;
  padding: 32px;
  border-radius: var(--radius-xl);
}
.quiz-container.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--bg-glass-border);
}

.quiz-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.quiz-score-live {
  font-weight: 700;
  color: var(--success);
  font-family: var(--font-mono);
}

.quiz-progress-bar {
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  margin-bottom: 24px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.quiz-content { min-height: 200px; }

.quiz-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-glass-border);
}

.quiz-results {
  max-width: 720px;
  margin: 24px auto;
  padding: 32px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--bg-glass-border);
  text-align: center;
}
.quiz-results.hidden { display: none; }

.quiz-results .result-score {
  font-size: 3rem;
  font-weight: 900;
  font-family: var(--font-mono);
  margin: 16px 0;
}
.quiz-results .result-score.excellent { color: var(--success); }
.quiz-results .result-score.good { color: var(--info); }
.quiz-results .result-score.average { color: var(--warning); }
.quiz-results .result-score.poor { color: var(--danger); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--bg-glass-border);
  z-index: 1000;
  opacity: 0;
  transition: all var(--transition-normal);
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
  .chapter-sidebar { width: 220px; min-width: 220px; }
  .topic-content-wrapper { padding: 24px 24px 50px; }
}

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  #sidebar.mobile-open {
    transform: translateX(0);
  }
  #sidebar.collapsed { transform: translateX(-100%); }

  .sidebar-close { display: block; }
  .menu-toggle { display: flex; }

  .study-layout { flex-direction: column; height: auto; }

  .chapter-sidebar {
    width: 100%;
    min-width: unset;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--bg-glass-border);
  }

  .topic-content-wrapper { padding: 20px 16px 50px; }

  .dashboard-hero { padding: 36px 20px 32px; }
  .subject-grid { grid-template-columns: 1fr; padding: 0 16px 24px; }
  .section-title { margin: 24px 16px 14px; }
  .strategy-cards { grid-template-columns: 1fr; padding: 0 16px 32px; }

  .hero-stats { gap: 10px; }
  .stat-card { padding: 12px 18px; min-width: 80px; }
  .stat-number { font-size: 1.3rem; }
}

/* ---------- ANIMATIONS ---------- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.subject-card { animation: slideUp 0.4s ease backwards; }
.subject-card:nth-child(1) { animation-delay: 0.05s; }
.subject-card:nth-child(2) { animation-delay: 0.1s; }
.subject-card:nth-child(3) { animation-delay: 0.15s; }
.subject-card:nth-child(4) { animation-delay: 0.2s; }
.subject-card:nth-child(5) { animation-delay: 0.25s; }
.subject-card:nth-child(6) { animation-delay: 0.3s; }
.subject-card:nth-child(7) { animation-delay: 0.35s; }
.subject-card:nth-child(8) { animation-delay: 0.4s; }
.subject-card:nth-child(9) { animation-delay: 0.45s; }

.hidden { display: none !important; }
