/* ==========================================================================
   Endocrinology Vault — Obsidian-Style Modern Medical Theme
   ========================================================================== */

:root {
  --bg-primary: #121215;
  --bg-secondary: #18181d;
  --bg-tertiary: #202028;
  --bg-elevated: #282834;
  --bg-glass: rgba(24, 24, 29, 0.85);
  
  --border-subtle: #262632;
  --border-strong: #363646;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;
  
  --accent-purple: #8b5cf6;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  --sidebar-width: 300px;
  --inspector-width: 320px;
  --header-height: 54px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

.theme-light {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-elevated: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.9);
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3af;
  --text-inverse: #f8fafc;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

/* Reset & Basics */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* App Container Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Sidebar Styling */
.app-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 30;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container.sidebar-collapsed .app-sidebar {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  padding: 16px 18px 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vault-branding {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vault-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  letter-spacing: -0.01em;
}

.theme-light .vault-title {
  color: #0f172a;
}

.vault-author {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Search bar in sidebar */
.sidebar-search-box {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 32px 8px 30px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.search-input:focus {
  border-color: var(--accent-purple);
  background: var(--bg-elevated);
}

.search-icon-left {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 13px;
}

.search-shortcut-badge {
  position: absolute;
  right: 8px;
  background: var(--border-subtle);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  pointer-events: none;
}

/* Sidebar Nav Tabs */
.sidebar-nav-tabs {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.nav-tab-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-tab-btn.active {
  background: var(--accent-purple);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-tab-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
}

/* Sidebar Tree Content */
.sidebar-tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.tree-folder {
  margin-bottom: 4px;
}

.tree-folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  user-select: none;
  transition: background 0.15s;
}

.tree-folder-header:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.tree-folder-chevron {
  font-size: 10px;
  width: 12px;
  transition: transform 0.2s ease;
  display: inline-block;
  color: var(--text-muted);
}

.tree-folder.collapsed .tree-folder-chevron {
  transform: rotate(-90deg);
}

.tree-folder.collapsed .tree-folder-items {
  display: none;
}

.tree-folder-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.tree-folder-items {
  padding-left: 14px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.tree-note-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-note-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.tree-note-item.active {
  background: var(--bg-elevated);
  color: var(--accent-purple);
  font-weight: 600;
  border-left: 2px solid var(--accent-purple);
}

.tree-note-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
}

/* Main Viewport */
.app-main {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Viewport Header */
.main-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
  z-index: 20;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumbs .sep {
  color: var(--text-muted);
}

.breadcrumbs .current {
  color: var(--text-primary);
  font-weight: 600;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.btn-header-action:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* View Panels Container — Absolute Panel Isolation */
.view-panel {
  display: none !important;
  width: 100%;
  height: calc(100% - var(--header-height));
  position: relative;
  overflow: hidden;
  flex: 1;
}

.view-panel.active {
  display: flex !important;
}

#graph-view-panel.active {
  display: block !important;
}

#reader-view-panel.active {
  display: flex !important;
}

#fastlanes-view-panel.active {
  display: block !important;
}

#flashcards-view-panel.active {
  display: flex !important;
  flex-direction: column;
  align-items: center;
}

/* 1. GRAPH VIEW STYLING — Pure Obsidian Dark Minimalist */
#graph-view-panel {
  position: relative;
  width: 100%;
  height: 100%;
  background: #141418;
  overflow: hidden;
}

#graph-view-panel.is-fullscreen,
#graph-view-panel:fullscreen,
#graph-view-panel:-webkit-full-screen {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999999 !important;
  background: #141418 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.graph-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.graph-canvas:active {
  cursor: grabbing;
}

/* Sleek Obsidian Top-Right Toolbar */
.graph-toolbar {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 60;
}

.graph-controls-group {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(20, 20, 25, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.btn-graph-tool {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-graph-tool:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-graph-tool.active-tool {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
}

.btn-graph-tool.primary-tool {
  background: var(--accent-purple);
  color: #fff;
  font-weight: 600;
}

.btn-graph-tool.primary-tool:hover {
  background: #7c3aed;
}

.btn-graph-tool.active-fullscreen {
  background: #ef4444 !important;
  color: #fff !important;
}

/* Collapsible Obsidian Filter & Search Popover (Starts Closed) */
.graph-flyout-drawer {
  display: none;
  flex-direction: column;
  gap: 10px;
  width: 310px;
  max-height: calc(100vh - 120px);
  background: rgba(20, 20, 26, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  overflow-y: auto;
}

.graph-flyout-drawer.open {
  display: flex;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-purple);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
}

.drawer-close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
}

.graph-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
  box-sizing: border-box;
}

.graph-search-input:focus {
  border-color: var(--accent-purple);
  background: rgba(255, 255, 255, 0.09);
}

.graph-subject-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 180px;
  overflow-y: auto;
}

.subject-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  transition: all 0.12s;
}

.subject-filter-pill:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
}

.subject-filter-pill.active {
  border-color: currentColor;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.subject-filter-pill.inactive {
  opacity: 0.35;
  text-decoration: line-through;
}

/* Physics & Appearance Settings Drawer */
.setting-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-slider-row label {
  color: var(--text-secondary);
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
}

.setting-slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

/* Floating Node Hover Card / Tooltip */
.graph-node-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 100;
  background: rgba(20, 20, 26, 0.95);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 12px 16px;
  max-width: 300px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: translate(-50%, -120%);
  display: none;
}

.tooltip-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tooltip-subject {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}

.tooltip-summary {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tooltip-footer {
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* 2. NOTE READER VIEW STYLING */
#reader-view-panel {
  width: 100%;
  height: 100%;
}

.note-scroll-pane {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 36px 54px;
}

.note-content-wrapper {
  max-width: 820px;
  margin: 0 auto;
}

.note-header-banner {
  margin-bottom: 24px;
}

.note-badges-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.subject-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-high-yield {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  letter-spacing: 0.04em;
}

.note-page-title {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.note-aliases {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.alias-tag {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* Markdown Rendering Engine Styling */
.markdown-rendered h1 { font-size: 26px; font-weight: 700; margin: 28px 0 14px 0; border-bottom: 1px solid var(--border-subtle); padding-bottom: 8px; }
.markdown-rendered h2 { font-size: 20px; font-weight: 700; margin: 24px 0 12px 0; }
.markdown-rendered h3 { font-size: 16px; font-weight: 600; margin: 20px 0 10px 0; }
.markdown-rendered p { margin-bottom: 14px; line-height: 1.68; color: var(--text-primary); }
.markdown-rendered strong { font-weight: 600; color: #fff; }
.theme-light .markdown-rendered strong { color: #0f172a; }
.markdown-rendered em { font-style: italic; }
.markdown-rendered code { font-family: var(--font-mono); background: var(--bg-elevated); padding: 2px 5px; border-radius: 4px; font-size: 13px; color: #f43f5e; }

.vault-list {
  padding-left: 24px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vault-list li {
  line-height: 1.6;
}

/* Callout Styling (Obsidian Grade) */
.callout {
  border-radius: 8px;
  margin: 18px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent-purple);
  background: rgba(139, 92, 246, 0.08);
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}

.callout-content p:last-child {
  margin-bottom: 0;
}

.callout-summary { border-left-color: #6366f1; background: rgba(99, 102, 241, 0.08); }
.callout-danger { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.callout-danger .callout-title { color: #f87171; }
.callout-warning { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }
.callout-tip { border-left-color: #10b981; background: rgba(16, 185, 129, 0.08); }
.callout-quote { border-left-color: #a855f7; background: rgba(168, 85, 247, 0.08); font-style: italic; }
.callout-question { border-left-color: #ec4899; background: rgba(236, 72, 153, 0.09); }
.callout-example { border-left-color: #06b6d4; background: rgba(6, 182, 212, 0.08); }

/* Table Styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-secondary);
}

.vault-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.vault-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.vault-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.vault-table tr:hover td {
  background: var(--bg-elevated);
}

/* Wikilinks */
.internal-link {
  color: #818cf8;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dashed rgba(129, 140, 248, 0.4);
  padding: 1px 2px;
  border-radius: 3px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.internal-link:hover {
  background: rgba(129, 140, 248, 0.15);
  color: #a5b4fc;
  border-bottom-style: solid;
}

/* Verification Badge */
.verify-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin: 0 4px;
  vertical-align: middle;
  font-family: var(--font-mono);
}

/* Right Inspector Panel (Local Graph, Backlinks, TOC) */
.note-inspector-pane {
  width: var(--inspector-width);
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex-shrink: 0;
}

.inspector-section-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Local Mini-Graph Container */
.local-graph-box {
  width: 100%;
  height: 190px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.local-graph-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Backlinks list */
.backlink-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backlink-card {
  padding: 10px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s;
}

.backlink-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.backlink-header {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.backlink-snippet {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Outgoing links list */
.outgoing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.outgoing-tag {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s;
}

.outgoing-tag:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* TOC Outline */
.toc-outline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-item {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12.5px;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.toc-item:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.toc-level-1 { font-weight: 600; }
.toc-level-2 { padding-left: 12px; }
.toc-level-3 { padding-left: 20px; font-size: 11.5px; }

/* 3. HIGH YIELD FAST LANES VIEW */
#fastlanes-view-panel {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 32px 48px;
}

.fastlanes-container {
  max-width: 1000px;
  margin: 0 auto;
}

.fastlanes-hero {
  margin-bottom: 28px;
}

.fastlanes-hero h1 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 8px;
}

.fastlanes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.fastlane-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s;
  cursor: pointer;
}

.fastlane-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-purple);
  box-shadow: var(--shadow-md);
}

.fastlane-icon {
  font-size: 24px;
}

.fastlane-title {
  font-size: 16px;
  font-weight: 700;
}

.fastlane-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.fastlane-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 8px;
}

/* 4. VIVA FLASHCARDS VIEW */
#flashcards-view-panel {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 32px 48px;
}

.flashcard-stage {
  max-width: 680px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 10px;
}

.flashcard-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.fc-filter-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.fc-filter-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.fc-filter-btn.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #fff;
  font-weight: 600;
}

.flashcard-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.flashcard-box {
  width: 100%;
  min-height: 290px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-strong);
  border-radius: 16px;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.flashcard-box:hover {
  border-color: var(--accent-purple);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.flashcard-q-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flashcard-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-label {
  color: #ec4899;
}

.answer-label {
  color: #10b981;
}

.flashcard-question-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
}

.theme-light .flashcard-question-text {
  color: #0f172a;
}

.flashcard-a-section {
  margin-top: 24px;
}

.flashcard-unrevealed-prompt {
  display: flex;
  justify-content: center;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--bg-tertiary);
  transition: all 0.15s;
}

.flashcard-box:hover .flashcard-unrevealed-prompt {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.08);
}

.btn-reveal-pill {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-purple);
}

.flashcard-revealed-box {
  display: none;
  background: rgba(16, 185, 129, 0.08);
  border: 1.5px solid #10b981;
  border-radius: 12px;
  padding: 18px 22px;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.2s ease-out;
}

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

.flashcard-box.flipped .flashcard-unrevealed-prompt {
  display: none;
}

.flashcard-box.flipped .flashcard-revealed-box {
  display: flex;
}

.flashcard-box.flipped {
  border-color: #10b981;
}

.flashcard-answer-text {
  font-size: 18px;
  font-weight: 600;
  color: #34d399;
  line-height: 1.45;
}

.theme-light .flashcard-answer-text {
  color: #047857;
}

.flashcard-controls {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.btn-flashcard {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  transition: all 0.15s;
}

.btn-flashcard:hover {
  background: var(--bg-elevated);
}

.btn-flashcard.primary {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
  color: #fff;
}

/* Viva Interactive Box in Notes */
.viva-box {
  border-left-color: #ec4899 !important;
  background: rgba(236, 72, 153, 0.08) !important;
  border-radius: 10px;
  padding: 16px;
  margin: 24px 0;
}

.viva-box .callout-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.btn-toggle-all-viva {
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.35);
  color: #f472b6;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-toggle-all-viva:hover {
  background: #ec4899;
  color: #fff;
}

.viva-interactive-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.viva-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.viva-item:hover {
  border-color: rgba(236, 72, 153, 0.4);
  background: var(--bg-tertiary);
}

.viva-question-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}

.viva-q-num {
  font-weight: 700;
  color: #ec4899;
  font-size: 12px;
  background: rgba(236, 72, 153, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.viva-q-text {
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.viva-hint-pill {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.15s;
}

.viva-item:hover .viva-hint-pill {
  color: #f472b6;
}

.viva-answer-drawer {
  display: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
  font-size: 13.5px;
  align-items: baseline;
  gap: 8px;
}

.viva-item.revealed .viva-answer-drawer {
  display: flex;
}

.viva-item.revealed {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.viva-item.revealed .viva-hint-pill {
  display: none;
}

.viva-ans-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}

.viva-ans-text {
  color: #ecfdf5;
  font-weight: 500;
  line-height: 1.5;
}

.theme-light .viva-ans-text {
  color: #065f46;
}

/* 5. SEARCH MODAL */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
}

.search-modal-backdrop.open {
  display: flex;
}

.search-modal-card {
  width: 90%;
  max-width: 620px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-search-input {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

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

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.search-result-item:hover, .search-result-item.selected {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .note-inspector-pane {
    display: none;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  
  .app-sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .note-scroll-pane {
    padding: 20px;
  }
  
  .note-page-title {
    font-size: 26px;
  }
  
  .graph-filter-overlay {
    max-width: 90%;
  }
  
  .graph-search-input {
    width: 180px;
  }
}
