/* ==========================================================================
   AlgoVault CP - Design System & Styling
   Modern Dark/Light Glassmorphism Theme
   ========================================================================== */

:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --bg-input: #111827;
  --bg-code: #0d1117;
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --border-hover: rgba(255, 255, 255, 0.16);
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #06b6d4;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;

  --platform-leetcode: #f59e0b;
  --platform-codeforces: #3b82f6;
  --platform-atcoder: #06b6d4;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-width: 320px;
  --nav-height: 64px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(241, 245, 249, 0.95);
  --bg-input: #ffffff;
  --bg-code: #1e293b;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: #4f46e5;
  --border-hover: rgba(0, 0, 0, 0.16);

  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Base Styles & Reset
   ========================================================================== */

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

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

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font-family: inherit;
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

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

.mobile-menu-btn {
  display: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
}

.logo-badge {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow);
}

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

.logo-title {
  font-family: var(--font-heading);
  font-size: 18px;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #f9fafb, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-secondary);
  font-weight: 600;
}

.nav-center {
  flex: 1;
  max-width: 540px;
  margin: 0 24px;
}

.search-trigger-btn {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0 16px;
  color: var(--text-secondary);
  font-size: 13.5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.kbd-shortcut {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

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

.global-progress-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: #a5b4fc;
}

.progress-ring-mini {
  width: 20px;
  height: 20px;
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 3.8;
}

.ring-stroke {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 3.8;
  stroke-linecap: round;
  transition: stroke-dasharray var(--transition-normal);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

[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 Layout & Sidebar
   ========================================================================== */

.app-layout {
  display: flex;
  padding-top: var(--nav-height);
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - var(--nav-height));
  position: fixed;
  top: var(--nav-height);
  left: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 90;
  transition: transform var(--transition-normal);
}

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

.sidebar-roadmap-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.sidebar-roadmap-link:hover, .sidebar-roadmap-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.2));
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.sidebar-search-box input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.sidebar-search-box input:focus {
  border-color: var(--border-focus);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  scrollbar-width: thin;
}

.sidebar-group {
  margin-bottom: 6px;
}

.sidebar-topic-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.sidebar-topic-btn.expanded {
  color: var(--text-primary);
}

.topic-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-chevron {
  font-size: 10px;
  transition: transform var(--transition-fast);
  color: var(--text-muted);
}

.sidebar-topic-btn.expanded .topic-chevron {
  transform: rotate(90deg);
}

.topic-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  white-space: nowrap;
}

.topic-badge.complete {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
}

.sidebar-subtopics {
  padding-left: 18px;
  margin-top: 2px;
  border-left: 2px solid var(--border-color);
  margin-left: 16px;
}

.sidebar-subtopic-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12.5px;
  transition: all var(--transition-fast);
}

.sidebar-subtopic-link:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-subtopic-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  font-weight: 600;
}

.subtopic-prob-count {
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.sidebar-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.sidebar-stat-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.sidebar-stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

.sidebar-stat-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ==========================================================================
   Main Content Viewport
   ========================================================================== */

.main-viewport {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: calc(100vh - var(--nav-height));
  padding: 36px 48px 80px;
  max-width: 1100px;
}

/* ==========================================================================
   Dashboard View
   ========================================================================== */

.dashboard-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 720px;
  line-height: 1.6;
}

/* Stats Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

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

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

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon-indigo { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.stat-icon-cyan { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.stat-icon-emerald { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

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

.stat-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Section Headings */
.section-title-wrap {
  margin-bottom: 24px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

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

/* Roadmap Grid */
.roadmap-stages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  transition: all var(--transition-fast);
}

.stage-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-md);
}

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

.stage-pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--accent-secondary);
}

.stage-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

.stage-topics-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-topic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.stage-topic-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateX(4px);
}

/* Topics Explorer Grid */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.topic-overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.topic-overview-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.toc-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.toc-card-title-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.toc-card-title-link:hover .toc-card-title {
  color: var(--accent-primary);
  transition: color var(--transition-fast);
}

.toc-card-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-overview-link {
  font-weight: 500;
  opacity: 0.85;
}

.sidebar-overview-link:hover {
  opacity: 1;
}

.toc-card-stats {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.toc-card-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 16px;
}

.toc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  border-radius: var(--radius-full);
}

.toc-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.btn-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition-fast);
}

.btn-link:hover {
  gap: 8px;
  color: #818cf8;
}

/* ==========================================================================
   Markdown Document View
   ========================================================================== */

.doc-wrapper {
  animation: fadeIn 0.2s ease;
}

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

.doc-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.doc-breadcrumbs a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.doc-breadcrumbs a:hover {
  color: var(--text-primary);
}

.doc-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.doc-title {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  font-weight: 500;
}

/* Markdown Content Styling */
.markdown-body {
  font-size: 15.5px;
  color: #e2e8f0;
  line-height: 1.75;
}

.markdown-body h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.markdown-body h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--text-primary);
}

.markdown-body p {
  margin-bottom: 18px;
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent-primary);
  padding: 12px 18px;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

/* Code Block with Copy Button */
.code-block-wrapper {
  position: relative;
  margin: 24px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-code);
  border: 1px solid var(--border-color);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.code-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.code-copy-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.4);
}

.markdown-body pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.5;
}

/* Math styling */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 0;
}

/* Practice Questions Section */
.problems-section {
  margin-top: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
}

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

.problems-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.problems-count-tag {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.problems-filter-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.filter-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

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

.problem-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.problem-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.problem-card.solved {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.custom-checkbox:hover {
  border-color: var(--accent-primary);
}

.problem-card.solved .custom-checkbox {
  background: var(--accent-success);
  border-color: var(--accent-success);
  color: #ffffff;
}

.problem-platform-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.badge-leetcode { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-codeforces { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-atcoder { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-other { background: rgba(156, 163, 175, 0.15); color: #9ca3af; border: 1px solid rgba(156, 163, 175, 0.3); }

.problem-title-link {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.problem-card.solved .problem-title-link {
  color: var(--text-muted);
  text-decoration: line-through;
}

.external-icon {
  opacity: 0.4;
  transition: opacity var(--transition-fast);
}

.problem-card:hover .external-icon {
  opacity: 1;
}

/* Document Bottom Navigation */
.doc-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 48px;
}

.pagination-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.pagination-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.pagination-card.next {
  text-align: right;
  grid-column: 2;
}

.pagination-direction {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.pagination-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

.search-modal-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 540px;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.search-modal-header input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

.search-close-btn, .data-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.search-close-btn:hover, .data-close-btn:hover {
  color: var(--text-primary);
}

.search-modal-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-item:hover, .search-item.selected {
  background: var(--bg-tertiary);
}

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

.search-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.search-item-context {
  font-size: 12px;
  color: var(--text-muted);
}

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

.search-modal-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  font-size: 12px;
  color: var(--text-muted);
}

.search-modal-footer kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* Data Backup Modal */
.data-modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.data-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
}

.data-modal-header h3 {
  font-family: var(--font-heading);
  font-size: 18px;
}

.data-modal-body {
  padding: 24px;
}

.data-modal-body p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

.data-actions-row {
  display: flex;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
}

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

.btn-secondary {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
}

.btn-danger:hover {
  background: var(--accent-danger);
  color: #ffffff;
}

.modal-divider {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 24px 0;
}

.danger-zone h4 {
  font-size: 15px;
  color: var(--accent-danger);
  margin-bottom: 6px;
}

.danger-zone p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
}

.toast {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInUp 0.25s ease;
}

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

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 80;
    display: none;
  }

  .sidebar.open + .sidebar-overlay {
    display: block;
  }

  .main-viewport {
    margin-left: 0;
    padding: 24px 20px 60px;
  }

  .nav-center {
    display: none;
  }

  .doc-pagination {
    grid-template-columns: 1fr;
  }

  .pagination-card.next {
    grid-column: 1;
    text-align: left;
  }
}

/* ==========================================================================
   Solved Questions & Endpoints Styling
   ========================================================================== */

.solved-question-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(99, 102, 241, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  backdrop-filter: blur(8px);
}

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

.badge-solved-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--accent-success);
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.badge-topic-tag {
  display: inline-flex;
  align-items: center;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.banner-endpoint-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.endpoint-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.endpoint-code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-secondary);
  background: transparent;
  padding: 0;
}

.question-files-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 32px;
  margin-bottom: 24px;
}

.files-card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.files-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.file-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  color: #fff;
  transform: translateY(-1px);
}

.file-chip-ext {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.file-chip-name {
  font-family: var(--font-mono);
  font-weight: 500;
}

.sidebar-questions-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-success);
  padding: 10px 14px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-question-link {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 2px solid transparent;
}

.sidebar-question-link:hover,
.sidebar-question-link.active {
  border-left-color: var(--accent-success);
  color: var(--accent-success) !important;
  background: rgba(16, 185, 129, 0.08);
}

.question-check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-success);
  font-size: 10px;
  font-weight: bold;
  flex-shrink: 0;
}

