/* ============================================================
   Developer Notes - Documentation Portal
   Styles
   ============================================================ */

/* === CSS Custom Properties === */
:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: rgba(37, 99, 235, 0.1);
  --primary-glow: rgba(37, 99, 235, 0.3);
  --accent: #0EA5E9;
  --accent-hover: #0284C7;

  --bg-primary: #F8FAFC;
  --bg-secondary: #F1F5F9;
  --bg-tertiary: #E2E8F0;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-glass-border: rgba(255, 255, 255, 0.3);
  --bg-sidebar: #FFFFFF;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --text-inverse: #FFFFFF;
  --text-link: #2563EB;

  --border-color: #E2E8F0;
  --border-light: rgba(226, 232, 240, 0.5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);

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

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

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

  --header-height: 64px;
  --sidebar-width: 280px;
  --max-width: 1280px;
  --z-header: 100;
  --z-sidebar: 90;
  --z-overlay: 200;
  --z-modal: 300;
  --z-palette: 400;
  --z-toast: 500;
}

/* === Dark Mode Variables === */
[data-theme="dark"] {
  --bg-primary: #0F172A;
  --bg-secondary: #1E293B;
  --bg-tertiary: #334155;
  --bg-card: #1E293B;
  --bg-glass: rgba(30, 41, 59, 0.7);
  --bg-glass-border: rgba(51, 65, 85, 0.3);
  --bg-sidebar: #1E293B;

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --text-inverse: #0F172A;
  --text-link: #60A5FA;

  --border-color: #334155;
  --border-light: rgba(51, 65, 85, 0.5);
  --shadow-sm: 0 1px 2px 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.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--primary);
  color: var(--text-inverse);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p { margin-bottom: 1rem; }

small { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 2rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }

/* === Utility === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* === Glassmorphism === */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--bg-glass-border);
}

/* === Icons (inline SVG) === */
.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--text-inverse);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

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

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* === Reading Progress Bar === */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: var(--z-header);
  width: 0%;
  transition: width 100ms linear;
}

/* === Header === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  z-index: var(--z-header);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1rem;
}

.header-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  display: none;
}

.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
  margin: 0 auto;
}

.header-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: var(--bg-card);
}

.header-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

.header-search .kbd-hint {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--text-tertiary);
  font-size: 0.625rem;
  font-weight: 600;
}

.header-search .kbd-hint kbd {
  background: var(--bg-tertiary);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  font-family: inherit;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Theme Toggle */
.theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

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

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
  position: absolute;
  transition: all var(--transition-base);
}

[data-theme="dark"] .theme-toggle .sun-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-toggle .moon-icon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

.theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.theme-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* GitHub Button */
.github-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

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

.github-btn .icon { width: 18px; height: 18px; }

/* Mobile Menu Toggle */
.menu-toggle {
  display: flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.menu-toggle:hover {
  background: var(--bg-tertiary);
}

/* === Sidebar === */
.sidebar-overlay {
  display: none;
}

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  z-index: var(--z-sidebar);
  overflow-y: auto;
  padding: 1rem 0;
  transition: transform var(--transition-base), background var(--transition-base);
}

.sidebar-section {
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.sidebar-section-title:hover {
  color: var(--text-primary);
}

.sidebar-section-title .collapse-icon {
  transition: transform var(--transition-fast);
}

.sidebar-section-title.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

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

.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link .cat-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sidebar-link .cat-count {
  margin-left: auto;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-link.active .cat-count {
  background: var(--primary);
  color: var(--text-inverse);
}

/* === Main Layout === */
.main-wrapper {
  margin-top: var(--header-height);
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - var(--header-height));
  transition: margin-left var(--transition-base);
}

.main-content {
  padding: 2rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* === Hero Section === */
.hero {
  position: relative;
  padding: 4rem 0 3rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, var(--primary-light) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(14, 165, 233, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
}

.hero-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.hero-search .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

/* === Statistics === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  transition: all var(--transition-base);
}

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

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.25rem;
}

.stat-card .stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-card .stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card.notes .stat-icon { background: rgba(37, 99, 235, 0.1); color: var(--primary); }
.stat-card.categories .stat-icon { background: rgba(14, 165, 233, 0.1); color: var(--accent); }
.stat-card.pdf .stat-icon { background: rgba(239, 68, 68, 0.1); color: #EF4444; }
.stat-card.images .stat-icon { background: rgba(34, 197, 94, 0.1); color: #22C55E; }

/* === Section Headers === */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2.5rem 0 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.section-header .section-action {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: gap var(--transition-fast);
}

.section-header .section-action:hover {
  gap: 0.5rem;
}

/* === Category Cards === */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.category-card .cc-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.category-card .cc-info h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.category-card .cc-info span {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Category Card Colors */
.category-card:nth-child(24n+1) .cc-icon { background: rgba(37, 99, 235, 0.1); color: #2563EB; }
.category-card:nth-child(24n+2) .cc-icon { background: rgba(14, 165, 233, 0.1); color: #0EA5E9; }
.category-card:nth-child(24n+3) .cc-icon { background: rgba(6, 182, 212, 0.1); color: #06B6D4; }
.category-card:nth-child(24n+4) .cc-icon { background: rgba(20, 184, 166, 0.1); color: #14B8A6; }
.category-card:nth-child(24n+5) .cc-icon { background: rgba(34, 197, 94, 0.1); color: #22C55E; }
.category-card:nth-child(24n+6) .cc-icon { background: rgba(132, 204, 22, 0.1); color: #84CC16; }
.category-card:nth-child(24n+7) .cc-icon { background: rgba(234, 179, 8, 0.1); color: #EAB308; }
.category-card:nth-child(24n+8) .cc-icon { background: rgba(245, 158, 11, 0.1); color: #F59E0B; }
.category-card:nth-child(24n+9) .cc-icon { background: rgba(239, 68, 68, 0.1); color: #EF4444; }
.category-card:nth-child(24n+10) .cc-icon { background: rgba(236, 72, 153, 0.1); color: #EC4899; }
.category-card:nth-child(24n+11) .cc-icon { background: rgba(168, 85, 247, 0.1); color: #A855F7; }
.category-card:nth-child(24n+12) .cc-icon { background: rgba(99, 102, 241, 0.1); color: #6366F1; }

/* === Filter Bar === */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-bar .filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-bar label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-bar select {
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: all var(--transition-fast);
}

.filter-bar select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-bar .filter-separator {
  width: 1px;
  height: 24px;
  background: var(--border-color);
}

.filter-bar .clear-filters {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  margin-left: auto;
}

.filter-bar .clear-filters:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* Results info */
.results-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* === Notes Grid === */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.notes-grid.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.notes-grid.empty .empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--text-tertiary);
}

.notes-grid.empty h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.notes-grid.empty p {
  color: var(--text-secondary);
  max-width: 300px;
}

/* === Note Card === */
.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

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

.note-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.note-card-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.note-card-badges .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-category {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-level {
  background: rgba(245, 158, 11, 0.1);
  color: #D97706;
}

.badge-level.beginner { background: rgba(34, 197, 94, 0.1); color: #16A34A; }
.badge-level.intermediate { background: rgba(245, 158, 11, 0.1); color: #D97706; }
.badge-level.advanced { background: rgba(239, 68, 68, 0.1); color: #DC2626; }

.badge-type {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.note-card-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.note-card-actions button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.note-card-actions button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.note-card-actions button.bookmarked {
  color: #F59E0B;
}

.note-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.note-card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.note-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.note-card-tags .tag {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  font-weight: 500;
}

.note-card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.note-card-footer .note-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-right: auto;
}

.note-card-footer .btn-card {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.note-card-parts {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  width: 100%;
}

.note-card-part {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.note-card-part .part-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.note-card-part .part-pages {
  color: var(--text-tertiary);
  font-size: 0.7rem;
  margin-left: 0.25rem;
}

.note-card-part .part-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.note-card-part .part-actions .btn-card {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}

/* === Preview Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 200ms ease-out;
}

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: slideUp 300ms ease-out;
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 1rem;
}

.modal-header .modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.modal-body {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
  min-height: 300px;
}

.modal-body iframe {
  width: 100%;
  height: 70vh;
  border: none;
  border-radius: var(--radius-md);
}

.modal-body .pdf-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  text-align: center;
  color: var(--text-secondary);
}

.modal-body .pdf-fallback .icon-xl {
  margin-bottom: 1rem;
  color: var(--text-tertiary);
}

.modal-body .markdown-content {
  line-height: 1.8;
}

.modal-body .markdown-content h1,
.modal-body .markdown-content h2,
.modal-body .markdown-content h3,
.modal-body .markdown-content h4 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.modal-body .markdown-content h1 { font-size: 1.75rem; }
.modal-body .markdown-content h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.25rem; }
.modal-body .markdown-content h3 { font-size: 1.25rem; }
.modal-body .markdown-content p { margin-bottom: 1em; color: var(--text-secondary); }
.modal-body .markdown-content ul, 
.modal-body .markdown-content ol { margin-bottom: 1em; padding-left: 1.5rem; color: var(--text-secondary); }
.modal-body .markdown-content ul { list-style: disc; }
.modal-body .markdown-content ol { list-style: decimal; }
.modal-body .markdown-content li { margin-bottom: 0.25em; }
.modal-body .markdown-content code {
  background: var(--bg-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.875em;
}
.modal-body .markdown-content pre {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: 1em;
  border: 1px solid var(--border-color);
}
.modal-body .markdown-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}
.modal-body .markdown-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  margin: 1em 0;
  color: var(--text-secondary);
  font-style: italic;
}
.modal-body .markdown-content a { color: var(--primary); text-decoration: underline; }
.modal-body .markdown-content img { border-radius: var(--radius-md); margin: 1em 0; }
.modal-body .markdown-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.modal-body .markdown-content th,
.modal-body .markdown-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  text-align: left;
}
.modal-body .markdown-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}
.modal-body .markdown-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.5em 0;
}

/* === Image Viewer === */
.image-viewer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.image-viewer.active {
  display: flex;
}

.image-viewer img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  cursor: default;
  transition: transform var(--transition-base);
}

.image-viewer .iv-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.image-viewer .iv-close:hover {
  background: rgba(255,255,255,0.2);
}

.image-viewer .iv-download {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.1);
  color: white;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background var(--transition-fast);
}

.image-viewer .iv-download:hover {
  background: rgba(255,255,255,0.2);
}

/* === Command Palette === */
.palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: var(--z-palette);
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.palette-overlay.active {
  display: flex;
}

.palette {
  width: 100%;
  max-width: 600px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: slideUp 200ms ease-out;
}

.palette-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
}

.palette-input::placeholder {
  color: var(--text-tertiary);
}

.palette-input:focus {
  outline: none;
}

.palette-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 0.5rem;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.palette-item:hover,
.palette-item.selected {
  background: var(--bg-secondary);
}

.palette-item .pi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.palette-item .pi-info {
  flex: 1;
  min-width: 0;
}

.palette-item .pi-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-item .pi-sub {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.palette-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-tertiary);
}

.palette-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.palette-footer kbd {
  background: var(--bg-secondary);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  font-family: inherit;
}

/* === Toast === */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideIn 300ms ease-out;
  pointer-events: auto;
}

.toast .toast-icon {
  color: var(--primary);
}

.toast.fade-out {
  animation: slideOut 300ms ease-in forwards;
}

/* === Breadcrumbs === */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

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

.breadcrumbs .separator {
  color: var(--text-tertiary);
}

.breadcrumbs .current {
  color: var(--text-secondary);
  font-weight: 500;
}

/* === Scroll to Top === */
.scroll-top {
  position: fixed;
  bottom: 1.5rem;
  left: calc(var(--sidebar-width) + 1.5rem);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-sidebar);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all var(--transition-base);
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* === Footer === */
.footer {
  margin-top: 3rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer p {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  margin-bottom: 0;
}

.footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.footer .footer-links a {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.footer .footer-links a:hover {
  color: var(--primary);
}

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100px); }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.animate-fade-in {
  animation: fadeIn 500ms ease-out;
}

.animate-slide-up {
  animation: slideUp 500ms ease-out;
}

.stagger > * {
  opacity: 0;
  animation: fadeIn 400ms ease-out forwards;
}

.stagger > *:nth-child(1) { animation-delay: 50ms; }
.stagger > *:nth-child(2) { animation-delay: 100ms; }
.stagger > *:nth-child(3) { animation-delay: 150ms; }
.stagger > *:nth-child(4) { animation-delay: 200ms; }
.stagger > *:nth-child(5) { animation-delay: 250ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(7) { animation-delay: 350ms; }
.stagger > *:nth-child(8) { animation-delay: 400ms; }
.stagger > *:nth-child(9) { animation-delay: 450ms; }
.stagger > *:nth-child(10) { animation-delay: 500ms; }
.stagger > *:nth-child(11) { animation-delay: 550ms; }
.stagger > *:nth-child(12) { animation-delay: 600ms; }
.stagger > *:nth-child(13) { animation-delay: 650ms; }
.stagger > *:nth-child(14) { animation-delay: 700ms; }
.stagger > *:nth-child(15) { animation-delay: 750ms; }
.stagger > *:nth-child(16) { animation-delay: 800ms; }
.stagger > *:nth-child(17) { animation-delay: 850ms; }
.stagger > *:nth-child(18) { animation-delay: 900ms; }
.stagger > *:nth-child(19) { animation-delay: 950ms; }
.stagger > *:nth-child(20) { animation-delay: 1000ms; }

/* === Skeleton Loading === */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

/* === Sidebar collapsed state === */
.sidebar-section .sidebar-nav.collapsed-content {
  display: none;
}
