/* ==========================================================================
   SaveMyNotes - Modern Design System & Offline Styles
   ========================================================================== */

:root {
  /* Dark Theme (Default) */
  --bg-base: #0a0e17;
  --bg-surface: #111827;
  --bg-elevated: #1a2234;
  --bg-hover: #242f46;
  --bg-active: #313f5c;
  --border-subtle: #1e293d;
  --border-strong: #2d3b55;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --callout-tip-bg: rgba(245, 158, 11, 0.08);
  --callout-tip-border: #f59e0b;
  --callout-example-bg: rgba(99, 102, 241, 0.08);
  --callout-example-border: #6366f1;

  --sidebar-width: 320px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px 0 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.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-active: #cbd5e1;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.15);

  --callout-tip-bg: #fffbeb;
  --callout-tip-border: #d97706;
  --callout-example-bg: #eef2ff;
  --callout-example-border: #4f46e5;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container,
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* Top Navigation */
.top-nav {
  height: var(--header-height);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo { font-size: 22px; }
.brand-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.brand-title strong {
  color: var(--accent);
  font-weight: 700;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab-btn:hover,
.nav-tab-btn.active {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.nav-center {
  flex: 1;
  max-width: 540px;
  margin: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 42px 0 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-surface);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--bg-hover);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--text-dim);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
}

.search-dropdown.hidden { display: none; }

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-result-item:hover { background: var(--bg-hover); }
.search-result-title { font-size: 14px; font-weight: 500; color: var(--text-main); }
.search-result-path { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
  border-color: var(--border-strong);
}

[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; }

/* App Body */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s, width 0.25s;
  overflow: hidden;
}

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

.course-selector-wrapper {
  display: none !important;
}

.sidebar-stats {
  padding: 8px 16px;
  background: var(--bg-base);
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sidebar-stats-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.stats-home-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 11.5px;
  white-space: nowrap;
}

.stats-home-link:hover { text-decoration: underline; }

/* Course Tree Navigation */
.course-tree {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

/* Sidebar Levels and Headers */
.tree-level-divider {
  padding: 10px 8px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tree-level-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ==========================================================================
   Multi-Level Syllabus Navigation (Curriculum -> Subject -> Topic)
   ========================================================================== */
.tree-curriculum-group {
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

[data-theme="light"] .tree-curriculum-group {
  background: rgba(0, 0, 0, 0.015);
  border-color: rgba(0, 0, 0, 0.08);
}

.tree-curriculum-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  background: var(--bg-surface);
  border-bottom: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.tree-curriculum-header:hover {
  background: var(--bg-hover);
}

.tree-curriculum-group.open > .tree-curriculum-header {
  border-bottom-color: var(--border-subtle);
}

.tree-curriculum-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}

.tree-curriculum-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-curriculum-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
  flex-shrink: 0;
}

.tree-curriculum-group > .tree-curriculum-header .tree-arrow {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.6;
}

.tree-curriculum-group.open > .tree-curriculum-header .tree-arrow {
  transform: rotate(90deg);
  opacity: 1;
}

.tree-curriculum-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree-curriculum-group.open > .tree-curriculum-body {
  grid-template-rows: 1fr;
}

.tree-curriculum-content {
  overflow: hidden;
  min-height: 0;
  padding: 6px 6px 8px;
}

/* Layer 2: Subject */
.tree-subject-group {
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: background 0.15s ease;
}

.tree-subject-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.tree-subject-header:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.tree-subject-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}

.tree-subject-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.tree-subject-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}

.tree-subject-code {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  flex-shrink: 0;
}

.tree-subject-group > .tree-subject-header .tree-arrow {
  transition: transform 0.2s ease;
  opacity: 0.5;
}

.tree-subject-group.open > .tree-subject-header .tree-arrow {
  transform: rotate(90deg);
  opacity: 1;
}

.tree-subject-group.open > .tree-subject-header {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
}

[data-theme="light"] .tree-subject-group.open > .tree-subject-header {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.05);
}

.tree-subject-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree-subject-group.open > .tree-subject-body {
  grid-template-rows: 1fr;
}

.tree-subject-content {
  overflow: hidden;
  min-height: 0;
  padding-left: 8px;
  margin-top: 2px;
}

.tree-subject-empty {
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 6px 12px;
  font-style: italic;
}

/* Tree Section */
.tree-section {
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.tree-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid transparent;
}

.tree-section-header:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.tree-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex: 1;
}

.tree-section-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}

.tree-section-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.tree-section.open .tree-section-header {
  color: var(--text-main);
}

.tree-section.active-sec .tree-section-header {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--accent);
}

.tree-section.active-sec .tree-section-title {
  font-weight: 700;
}

.tree-arrow {
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.18s ease;
  flex-shrink: 0;
}

.tree-section.open > .tree-section-header .tree-arrow {
  transform: rotate(90deg);
  color: var(--accent);
}

/* Accordion Smooth Grid Transition for Sections */
.tree-section-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree-section.open > .tree-section-body {
  grid-template-rows: 1fr;
}

.tree-section-content {
  overflow: hidden;
  min-height: 0;
  padding-top: 2px;
}

/* Topic Level Grouping */
.tree-topic-group {
  margin-bottom: 2px;
}

.tree-topic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.tree-topic-header:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.tree-topic-left {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  flex: 1;
}

.tree-topic-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.tree-topic-badge {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 5px;
  border-radius: 8px;
  flex-shrink: 0;
}

.tree-topic-group.active-topic > .tree-topic-header {
  color: var(--accent);
  font-weight: 700;
}

.tree-topic-arrow {
  width: 12px;
  height: 12px;
  color: var(--text-dim);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s ease;
  flex-shrink: 0;
}

.tree-topic-group.open > .tree-topic-header .tree-topic-arrow {
  transform: rotate(90deg);
  color: var(--accent);
}

/* Accordion Smooth Grid Transition for Topics */
.tree-topic-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree-topic-group.open > .tree-topic-body {
  grid-template-rows: 1fr;
}

.tree-topic-notes {
  overflow: hidden;
  min-height: 0;
  border-left: 1.5px solid var(--border-subtle);
  margin-left: 18px;
  padding-left: 6px;
  padding-right: 6px;
  padding-top: 2px;
  padding-bottom: 3px;
}

.tree-topic-notes-direct {
  margin-left: 12px;
  border-left: 1.5px solid var(--border-subtle);
  padding-left: 6px;
  padding-right: 6px;
}

/* Individual Note Links */
.tree-note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1.35;
  border: none !important;
  border-left: none !important;
  position: relative;
  box-sizing: border-box;
}

.tree-note-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  transform: none;
}

.tree-note-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tree-note-item.active {
  background: rgba(59, 130, 246, 0.12) !important;
  color: var(--accent) !important;
  font-weight: 600 !important;
  border: none !important;
  border-left: none !important;
  box-shadow: none !important;
  transform: none !important;
}

.tree-note-item.active .tree-note-text {
  color: var(--accent) !important;
  font-weight: 600 !important;
}

[data-theme="light"] .tree-note-item.active {
  background: rgba(37, 99, 235, 0.08) !important;
  color: #1d4ed8 !important;
  border: none !important;
  border-left: none !important;
  box-shadow: none !important;
  transform: none !important;
}

[data-theme="light"] .tree-note-item.active .tree-note-text {
  color: #1d4ed8 !important;
}

/* Content Area */
.content-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.32);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.32);
}

/* ==========================================================================
   HOME SCREEN (Like Save My Exams)
   ========================================================================== */

.home-screen {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  width: 100%;
}

.home-hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.home-hero h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 12px;
}

.home-hero p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 28px;
}

/* Board Selector Tabs */
.board-tabs {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  padding: 4px;
  gap: 4px;
}

.board-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.board-tab:hover {
  color: var(--text-main);
}

.board-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Catalog Section */
.home-catalog-section {
  margin-top: 10px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title-row h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.catalog-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: 6px;
}

/* Subject Cards Grid */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.subject-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.subject-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

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

.subject-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--bg-elevated);
}

.level-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

.subject-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.subject-code {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-bottom: 16px;
}

.card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.card-action-btn {
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

/* ==========================================================================
   NOTE READER VIEW
   ========================================================================== */

.note-view-container {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.content-header {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.breadcrumbs {
  font-size: 13.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.crumb-link,
.crumb-topic {
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.crumb-link:hover,
.crumb-topic:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

/* White URLs in Dark Theme for Breadcrumbs */
[data-theme="dark"] .crumb-link,
:root:not([data-theme="light"]) .crumb-link,
[data-theme="dark"] .crumb-topic,
:root:not([data-theme="light"]) .crumb-topic {
  color: #ffffff !important;
}

[data-theme="dark"] .crumb-link:hover,
:root:not([data-theme="light"]) .crumb-link:hover,
[data-theme="dark"] .crumb-topic:hover,
:root:not([data-theme="light"]) .crumb-topic:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.12) !important;
  text-decoration: underline;
}

.crumb-sep {
  color: var(--text-dim);
  opacity: 0.4;
  user-select: none;
}

[data-theme="dark"] .crumb-sep,
:root:not([data-theme="light"]) .crumb-sep {
  color: rgba(255, 255, 255, 0.5) !important;
  opacity: 0.7;
}

.crumb-current {
  color: var(--text-main);
  font-weight: 600;
  padding: 3px 6px;
}

[data-theme="dark"] .crumb-current,
:root:not([data-theme="light"]) .crumb-current {
  color: #ffffff !important;
}

.content-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.action-btn.btn-pdf {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--accent);
  font-weight: 600;
}

.action-btn.btn-pdf:hover {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .action-btn.btn-pdf,
:root:not([data-theme="light"]) .action-btn.btn-pdf {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

[data-theme="dark"] .action-btn.btn-pdf:hover,
:root:not([data-theme="light"]) .action-btn.btn-pdf:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff !important;
}

.note-viewer {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 32px 60px;
  width: 100%;
}

/* ==========================================================================
   PURE EDUCATIONAL NOTE STYLING (NO COMMERCIAL FLUFF / NO AUTHOR PHOTOS)
   ========================================================================== */

/* HIDE ALL AUTHOR PHOTOS AND COMMERCIAL ELEMENTS */
[class*="AuthorReviewer_"],
[class*="JoinCTA_"],
[class*="FeatureSliderCTA_"],
[class*="Feedback_"],
[class*="NextSteps_"],
[class*="Banner_"],
[class*="Modal_"],
[class*="Paywall_"],
[class*="Upgrade_"],
[class*="Breadcrumbs_"],
[class*="ResourceHeading_"],
img[src*="bw"],
img[src*="Ali"],
img[src*="Naomi"],
img[src*="trustpilot"],
img[src*="high-five"] {
  display: none !important;
}

.note-content-rendered {
  font-size: 16px;
  color: var(--text-main);
  line-height: 1.75;
}

.note-heading-area {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.note-heading-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.note-course-tag {
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
}

.note-meta-sep {
  color: var(--text-dim);
  opacity: 0.5;
}

.note-sec-tag {
  color: var(--text-muted);
  font-weight: 500;
}

.note-exam-tag {
  margin-left: auto;
  font-size: 11px;
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

.note-content-rendered h1,
.note-heading-area h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0;
  line-height: 1.25;
  color: var(--text-main);
}

.note-content-rendered h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.note-content-rendered h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 22px 0 12px;
}

.note-content-rendered p {
  margin-bottom: 18px;
}

.note-content-rendered ul,
.note-content-rendered ol {
  margin: 0 0 20px 24px;
}

.note-content-rendered li {
  margin-bottom: 8px;
}

/* URLs & Hyperlinks in Note Content */
.note-content-rendered a,
.note-body-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: all 0.15s ease;
}

.note-content-rendered a:hover,
.note-body-content a:hover {
  text-decoration-thickness: 2px;
}

/* In Dark Theme: Make all URLs & hyperlinks pure white! */
[data-theme="dark"] .note-content-rendered a,
[data-theme="dark"] .note-body-content a,
[data-theme="dark"] .note-content-rendered a:link,
[data-theme="dark"] .note-body-content a:link,
[data-theme="dark"] .note-content-rendered a:visited,
[data-theme="dark"] .note-body-content a:visited,
[data-theme="dark"] .note-content-rendered [class*="link-"],
[data-theme="dark"] .note-body-content [class*="link-"],
:root:not([data-theme="light"]) .note-content-rendered a,
:root:not([data-theme="light"]) .note-body-content a,
:root:not([data-theme="light"]) .note-content-rendered a:link,
:root:not([data-theme="light"]) .note-body-content a:link,
:root:not([data-theme="light"]) .note-content-rendered a:visited,
:root:not([data-theme="light"]) .note-body-content a:visited,
:root:not([data-theme="light"]) .note-content-rendered [class*="link-"],
:root:not([data-theme="light"]) .note-body-content [class*="link-"] {
  color: #ffffff !important;
  text-decoration-color: rgba(255, 255, 255, 0.65) !important;
}

[data-theme="dark"] .note-content-rendered a:hover,
[data-theme="dark"] .note-body-content a:hover,
:root:not([data-theme="light"]) .note-content-rendered a:hover,
:root:not([data-theme="light"]) .note-body-content a:hover {
  color: #ffffff !important;
  text-decoration-color: #ffffff !important;
  opacity: 0.85;
}

/* Global hyperlinks in Dark Theme */
[data-theme="dark"] a:not(.action-btn):not(.nav-tab-btn):not(.board-tab):not(.brand):not(.queue-action-link):not(.catalog-link),
:root:not([data-theme="light"]) a:not(.action-btn):not(.nav-tab-btn):not(.board-tab):not(.brand):not(.queue-action-link):not(.catalog-link) {
  color: #ffffff;
}

/* Educational Figures, Diagrams & Scientific Visuals */
.note-content-rendered figure,
.note-body-content [data-type="image"],
.note-content-rendered [data-type="image"] {
  margin: 24px auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  clear: both;
}

figure {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 16px auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  max-width: 100% !important;
}

.note-body-content img,
.note-content-rendered img,
.revision-note-content img,
.note-body-content figure img,
.note-content-rendered figure img,
.note-body-content [data-type="image"] img,
.note-content-rendered [data-type="image"] img,
[data-type="image"] img,
img.ContentBlock_figure__vJw2q,
.ContentBlock_figure__vJw2q,
.ContentBlock_content__nsZwk img,
.Card_card__JupYk img,
.card img {
  display: block !important;
  max-width: min(100%, 820px) !important;
  width: auto !important;
  height: auto !important;
  max-height: 560px !important;
  object-fit: contain;
  margin: 16px auto !important;
  border-radius: var(--radius-md) !important;
  /* Crisp pure white background for diagrams so black labels, graphs & axes are crystal clear */
  background: #ffffff !important;
  padding: 14px 18px !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28) !important;
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box !important;
}

figcaption {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

[data-theme="light"] .note-body-content img,
[data-theme="light"] .note-content-rendered img,
[data-theme="light"] .revision-note-content img,
[data-theme="light"] .note-body-content figure img,
[data-theme="light"] .note-content-rendered figure img,
[data-theme="light"] .note-content-rendered [data-type="image"] img,
[data-theme="light"] [data-type="image"] img,
[data-theme="light"] img.ContentBlock_figure__vJw2q,
[data-theme="light"] .ContentBlock_figure__vJw2q,
[data-theme="light"] .ContentBlock_content__nsZwk img,
[data-theme="light"] .Card_card__JupYk img {
  background: #ffffff !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06) !important;
}

.note-body-content img:hover,
.note-content-rendered img:hover,
.note-content-rendered [data-type="image"] img:hover,
img.ContentBlock_figure__vJw2q:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32) !important;
}

/* Card wrappers in notes */
.note-content-rendered .Card_card__JupYk,
.note-content-rendered [class*="Card_card"],
.note-content-rendered .card {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-lg) !important;
  padding: 24px !important;
  margin-bottom: 24px !important;
  color: var(--text-main) !important;
}

.note-content-rendered .bg-body-secondary {
  background: var(--bg-surface) !important;
}

.note-content-rendered figcaption,
.note-body-content [data-type="image"] + p.text-center,
.note-content-rendered [data-type="image"] + p.text-center {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: 20px;
  text-align: center;
  font-style: italic;
}

/* Callouts */
.note-content-rendered blockquote,
.note-content-rendered [class*="callout"],
.note-content-rendered [class*="Callout"] {
  background: var(--callout-tip-bg);
  border-left: 4px solid var(--callout-tip-border);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 15px;
}

.note-content-rendered [class*="worked-example"],
.note-content-rendered [class*="WorkedExample"] {
  background: var(--callout-example-bg);
  border-left: 4px solid var(--callout-example-border);
}

/* Tables */
.note-content-rendered table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.note-content-rendered th,
.note-content-rendered td {
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  text-align: left;
  font-size: 14px;
}

.note-content-rendered th {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text-main);
}

.note-content-rendered tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Bottom Pagination */
.note-pagination {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 32px 60px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--border-subtle);
}

.nav-page-btn {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-page-btn.next { text-align: right; }
.nav-page-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

.dir-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
}

.note-title-preview {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox.hidden { display: none; }
.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}
.lightbox-content {
  position: relative;
  z-index: 1001;
  max-width: 90vw;
  max-height: 90vh;
  text-align: center;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  background: #ffffff !important;
  padding: 16px !important;
  box-sizing: border-box !important;
}
.lightbox-caption {
  margin-top: 12px;
  font-size: 14px;
  color: #fff;
}
.lightbox-close-btn {
  position: absolute;
  top: -40px;
  right: -20px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
}

.hidden { display: none !important; }

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.tree-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  color: var(--text-dim);
  font-size: 13px;
}

/* Print */
@media print {
  .top-nav, .sidebar, .content-header, .note-pagination, .course-subnav-bar {
    display: none !important;
  }
  .app-layout, .app-body, .content-area {
    height: auto !important;
    overflow: visible !important;
  }
  .note-viewer {
    max-width: 100% !important;
    padding: 0 !important;
  }
}

/* ==========================================================================
   Live Download Progress Widget
   ========================================================================== */

.live-progress-widget {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  margin-right: 12px;
  min-width: 220px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 3px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.5s infinite;
  display: inline-block;
  margin-right: 5px;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.progress-course-name {
  color: var(--text-main);
  flex: 1;
}

.progress-percent {
  color: var(--accent);
  font-family: var(--font-mono);
}

.progress-bar-bg {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.progress-note-name {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ==========================================================================
   Course Sub-Navigation: Notes vs Past Papers Tabs
   ========================================================================== */

.course-subnav-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 32px;
  display: flex;
  align-items: center;
}

.subnav-tabs {
  display: flex;
  gap: 8px;
}

.subnav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.subnav-tab:hover {
  color: var(--text-main);
  background: var(--bg-elevated);
}

.subnav-tab.active {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
}

.subnav-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.subnav-tab.active .subnav-badge {
  background: var(--accent);
  color: #fff;
}

/* ==========================================================================
   Past Papers View & Sidebar Navigator
   ========================================================================== */

.past-papers-nav {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1;
}

.pp-sidebar-switch-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.pp-sidebar-switch-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.pp-nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
  padding: 0 4px;
}

.pp-nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pp-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none !important;
}

.pp-nav-item:hover {
  background: var(--bg-hover);
  color: #ffffff;
}

.pp-nav-item.active {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: none !important;
}

.pp-nav-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 10px;
  color: var(--text-dim);
}

.pp-nav-item.active .pp-nav-badge {
  background: var(--accent);
  color: #ffffff;
}

.past-papers-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px;
}

.past-papers-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.past-papers-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.past-papers-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.pp-search-box input {
  width: 280px;
  height: 38px;
  padding: 0 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
}

.pp-search-box input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Year Filter Chips */
.pp-year-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.pp-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pp-chip:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.pp-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Past Papers List View */
.pp-list-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.pp-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.18s ease;
  gap: 18px;
}

.pp-list-row:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  transform: translateX(3px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.pp-list-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  flex-shrink: 0;
}

.pp-year-badge {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  background: var(--bg-hover);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.pp-series-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 9px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

[data-theme="dark"] .pp-series-badge {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.2);
}

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

.pp-list-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .pp-list-title {
  color: #ffffff;
}

.pp-list-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pp-list-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-qp, .btn-ms {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-qp {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

[data-theme="dark"] .btn-qp {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.4);
}

.btn-qp:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-ms {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .btn-ms {
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.4);
}

.btn-ms:hover {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

@media (max-width: 860px) {
  .pp-list-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .pp-list-actions {
    width: 100%;
  }
  .btn-qp, .btn-ms {
    flex: 1;
  }
}

/* ==========================================================================
   Home Screen Live Download Dashboard
   ========================================================================== */

.live-download-banner {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-top: 24px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  animation: fadeIn 0.3s ease;
}

.live-download-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #10b981, var(--accent));
  background-size: 200% 100%;
  animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.banner-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.banner-badge-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-ring {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.banner-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

.banner-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
}

.banner-percent {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent);
}

.banner-progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}

.banner-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6, #10b981);
  border-radius: 4px;
  transition: width 0.4s ease;
  position: relative;
}

.banner-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: moveStripes 2s infinite linear;
}

@keyframes moveStripes {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.banner-details-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 13px;
  flex-wrap: wrap;
}

.banner-current-action {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  max-width: 75%;
}

.action-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.action-label {
  font-weight: 600;
  color: var(--text-dim);
}

.action-note-name {
  color: var(--text-main);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
}

.banner-queue-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.queue-item.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.4);
}

.queue-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
}

.queue-item.active .queue-dot {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.queue-item.ready .queue-dot {
  background: var(--success);
}

.queue-text {
  font-weight: 600;
  color: var(--text-muted);
}

.queue-item.active .queue-text {
  color: var(--text-main);
}

.queue-badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.queue-item.active .queue-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.queue-badge.ready {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
  font-weight: 700;
}

/* ==========================================================================
   Enhanced Subject Cards with Past Papers & Download Status
   ========================================================================== */

.subject-card.is-active-download {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.2);
}


.card-mini-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0 10px 0;
}

.card-mini-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.card-action-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.card-btn-notes, .card-btn-pp {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.card-btn-notes {
  flex: 1.2;
  background: var(--accent);
  color: #fff;
  border: none;
}

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

.card-btn-pp {
  flex: 1;
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.card-btn-pp:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #fff;
  transform: translateY(-1px);
}

/* ==========================================================================
   NETWORK & PAGE LOADERS (Top Progress Bar, Skeletons, Shimmers)
   ========================================================================== */

/* Top Slim Progress Bar */
.top-loader-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #3b82f6, #6366f1);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8), 0 0 5px rgba(99, 102, 241, 0.6);
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
  transition: width 0.2s ease, opacity 0.25s ease;
}

.top-loader-bar.loading {
  opacity: 1;
}

/* Shimmer Animation */
@keyframes skeleton-pulse {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.6s infinite linear;
  border-radius: var(--radius-sm);
}

[data-theme="light"] .skeleton-shimmer {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.04) 25%,
    rgba(0, 0, 0, 0.09) 50%,
    rgba(0, 0, 0, 0.04) 75%
  );
  background-size: 200% 100%;
}

/* Note Content Skeleton Loader */
.note-skeleton-wrapper {
  padding: 36px 40px;
  max-width: 900px;
  margin: 0 auto;
  animation: fadeIn 0.2s ease-in-out;
}

.skeleton-meta {
  width: 200px;
  height: 22px;
  margin-bottom: 16px;
  border-radius: 20px;
}

.skeleton-heading {
  width: 65%;
  height: 38px;
  margin-bottom: 30px;
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 14px;
  margin-bottom: 14px;
  border-radius: 4px;
}

.skeleton-diagram {
  width: 100%;
  height: 300px;
  margin: 28px 0;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-dim);
  font-size: 13px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.skeleton-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Past Papers Skeleton Grid Loader */
.pp-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  width: 100%;
}

.pp-skeleton-card {
  height: 130px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}



