@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

/* CSS Variables for Light/Dark Themes */
:root[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #22223b;
  --text-secondary: #586069;
  --accent-color: #6c63ff;
  --border-color: #e1e4e8;
  --shadow-light: rgba(64, 87, 109, 0.07);
  --shadow-medium: rgba(91, 114, 191, 0.11);
  --shadow-hover: rgba(100, 92, 235, 0.15);
  --gradient-bg: linear-gradient(120deg, #e0e7ff 0%, #ffffff 100%);
  --card-bg: #ffffff;
  --sidebar-bg: rgba(135, 123, 255, 0.14);
  --sidebar-shadow: rgba(91, 114, 191, 0.17);
  --hover-bg: #efedff;
  --hover-text: #2b2362;
  --button-hover: #433fad;
  --input-border: #c7cffc;
  --input-focus: #8663fd;
}

:root[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --accent-color: #8b7cf8;
  --border-color: #404040;
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --shadow-hover: rgba(139, 124, 248, 0.3);
  --gradient-bg: linear-gradient(120deg, #2a2a2a 0%, #1a1a1a 100%);
  --card-bg: #2d2d2d;
  --sidebar-bg: rgba(139, 124, 248, 0.1);
  --sidebar-shadow: rgba(0, 0, 0, 0.5);
  --hover-bg: #3a3a3a;
  --hover-text: #8b7cf8;
  --button-hover: #6c5ce7;
  --input-border: #505050;
  --input-focus: #8b7cf8;
}

/* Initialize default theme */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #22223b;
  --text-secondary: #586069;
  --accent-color: #6c63ff;
  --border-color: #e1e4e8;
  --shadow-light: rgba(64, 87, 109, 0.07);
  --shadow-medium: rgba(91, 114, 191, 0.11);
  --shadow-hover: rgba(100, 92, 235, 0.15);
  --gradient-bg: linear-gradient(120deg, #e0e7ff 0%, #ffffff 100%);
  --card-bg: #ffffff;
  --sidebar-bg: rgba(135, 123, 255, 0.14);
  --sidebar-shadow: rgba(91, 114, 191, 0.17);
  --hover-bg: #efedff;
  --hover-text: #2b2362;
  --button-hover: #433fad;
  --input-border: #c7cffc;
  --input-focus: #8663fd;
}

/* Base styles */
body {
  font-family: 'Inter', Arial, sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Card styles for main content */
.card, .post, .content {
  background: var(--card-bg);
  border-radius: 1rem;
  box-shadow: 0 4px 24px var(--shadow-light), 0 1.5px 8px var(--shadow-medium);
  margin: 1.3rem auto;
  padding: 2rem;
  max-width: 700px;
  transition: box-shadow 0.2s, background 0.4s ease;
  color: var(--text-primary);
}

.card:hover, .post:hover {
  box-shadow: 0 8px 32px var(--shadow-hover), 0 1.5px 8px var(--shadow-medium);
}

/* Sidebar styles */
.sidebar {
  background: var(--sidebar-bg);
  backdrop-filter: blur(6px);
  box-shadow: 2px 0 16px var(--sidebar-shadow);
  border-radius: 0 1.5rem 1.5rem 0;
  overflow-y: auto;
  padding: 32px 28px 28px 36px !important;
  font-weight: 600;
  min-width: 230px;
  transition: background 0.4s ease;
}

.sidebar a {
  display: block;
  color: var(--accent-color);
  background: transparent;
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 7px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.sidebar a:hover {
  background: var(--hover-bg);
  color: var(--hover-text);
}

.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  background: var(--accent-color);
  color: #fff;
  border: none;
  font-size: 28px;
  padding: 8px 12px;
  border-radius: 40px;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow-medium);
  transition: background 0.3s ease;
}

.sidebar-toggle:hover {
  background: var(--button-hover);
}

/* Headers */
h1, h2, h3, h4, h5 {
  font-family: 'Inter', Arial, sans-serif;
  color: var(--accent-color);
  letter-spacing: -0.5px;
  transition: color 0.4s ease;
}

/* Buttons and Inputs */
button, input[type='submit'] {
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 0.7rem;
  padding: 0.6rem 1.4rem;
  font-weight: 700;
  font-family: inherit;
  transition: background 0.2s;
  cursor: pointer;
}

button:hover, input[type='submit']:hover {
  background: var(--button-hover);
}

input, textarea {
  border: 1.5px solid var(--input-border);
  border-radius: 0.7rem;
  padding: 0.7rem;
  margin-bottom: 1rem;
  width: 100%;
  transition: border 0.2s;
  font-size: 1rem;
  background: var(--bg-primary);
  color: var(--text-primary);
}

input:focus, textarea:focus {
  border-color: var(--input-focus);
  outline: none;
}

/* Text elements */
p, li, span, div {
  color: var(--text-primary);
  transition: color 0.4s ease;
}

/* Links */
a {
  color: var(--accent-color);
  transition: color 0.2s ease;
}

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

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 60px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--bg-secondary);
  z-index: 1000;
}

.reading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-color), #ff6b6b);
  width: 0%;
  transition: width 0.1s ease;
}

/* Table of Contents */
.toc-container {
  position: fixed !important;
  top: 80px !important;
  right: 20px !important;
  width: 280px !important;
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px var(--shadow-medium) !important;
  z-index: 2147483647 !important; /* Maximum possible z-index */
  max-height: 70vh !important;
  overflow: hidden !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  backdrop-filter: blur(10px) !important;
}

.toc-container:hover {
  box-shadow: 0 12px 48px var(--shadow-hover);
}

.toc-toggle {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s ease;
  border-radius: 12px 12px 0 0;
}

.toc-toggle:hover {
  background: var(--hover-bg);
  color: var(--accent-color);
}

.toc-toggle .toc-icon {
  font-size: 16px;
  transition: transform 0.2s ease;
}

.toc {
  max-height: 0;
  overflow-y: auto;
  padding: 0 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.toc.visible {
  max-height: 70vh;
  padding: 16px;
  opacity: 1;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin: 4px 0;
}

.toc a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.4;
  display: block;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.toc a:hover {
  color: var(--accent-color);
  background: var(--hover-bg);
}

.toc ul ul {
  margin-left: 16px;
}

/* Mobile responsiveness for TOC */
@media (max-width: 768px) {
  .toc-container {
    position: fixed;
    top: auto;
    bottom: 20px;
    right: 20px;
    left: 20px;
    width: auto;
    max-width: none;
    max-height: 40vh;
    z-index: 9999 !important;
  }

  .toc-toggle {
    padding: 10px 12px;
    font-size: 14px;
  }

  .toc {
    max-height: calc(40vh - 45px);
  }
}

@media (max-width: 480px) {
  .toc-container {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-height: 35vh;
  }

  .toc {
    max-height: calc(35vh - 40px);
  }
}

/* Social Sharing */
.social-share {
  margin-top: 40px;
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.social-share h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: var(--text-primary);
}

.share-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-btn.twitter:hover { border-color: #1da1f2; color: #1da1f2; }
.share-btn.linkedin:hover { border-color: #0077b5; color: #0077b5; }
.share-btn.facebook:hover { border-color: #4267b2; color: #4267b2; }
.share-btn.copy:hover { border-color: var(--accent-color); color: var(--accent-color); }

/* Enhanced Code Blocks */
pre {
  position: relative;
  margin: 1.5em 0;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

pre:hover .code-copy-btn {
  opacity: 1;
}

/* Enhanced Line Numbering for Code Blocks */
.line-numbers {
  counter-reset: line;
  position: relative;
  padding-left: 50px !important;
  margin: 0 !important;
}

.line-numbers .line-number {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 100%;
  text-align: right;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  font-family: 'Fira Code', 'Monaco', 'Consolas', monospace !important;
  user-select: none;
  opacity: 0.7;
  padding-right: 10px;
  border-right: 1px solid var(--border-color);
  background: var(--bg-secondary);
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
}

.line-numbers .line-number::before {
  counter-increment: line;
  content: counter(line);
}

/* ===== RELIABLE CSS LINE NUMBERING SYSTEM ===== */

/* Basic highlight container */
.highlight {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  padding: 0 !important;
  margin: 1.2em 0 !important;
  overflow: hidden !important;
  color: var(--text-primary) !important;
  position: relative !important;
  font-size: 14px !important;
}

.highlight:hover {
  box-shadow: 0 2px 8px var(--shadow-light) !important;
}

/* Line numbering implementation */
.highlight pre {
  background: transparent !important;
  margin: 0 !important;
  padding: 1em 1em 1em 4em !important;
  border-radius: 0 !important;
  color: var(--text-primary) !important;
  font-family: 'Fira Code', 'Monaco', 'Consolas', monospace !important;
  font-size: inherit !important;
  line-height: 1.5 !important;
  tab-size: 4 !important;
  white-space: pre !important;
  word-wrap: normal !important;
  overflow-x: auto !important;
  counter-reset: line-numbering !important;
  position: relative !important;
}

.highlight pre code {
  font-family: inherit !important;
  font-size: inherit !important;
  color: inherit !important;
  background: transparent !important;
  padding: 0 !important;
  display: block !important;
}

/* Line numbering for each line */
.highlight pre code .line,
.highlight pre > code > .line {
  counter-increment: line-numbering !important;
  position: relative !important;
}

.highlight pre code .line::before,
.highlight pre > code > .line::before {
  content: counter(line-numbering) !important;
  position: absolute !important;
  left: -3.5em !important;
  top: 0 !important;
  width: 2.5em !important;
  text-align: right !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  font-family: inherit !important;
  user-select: none !important;
  opacity: 0.7 !important;
  padding-right: 0.5em !important;
  border-right: 1px solid var(--border-color) !important;
  background: var(--bg-secondary) !important;
  line-height: 1.5 !important;
}

/* Alternative: Line numbering for code without .line wrapper */
.highlight pre code:not(.language-plaintext) {
  background-image: linear-gradient(
    transparent 0%,
    transparent calc(1.5em - 1px),
    var(--border-color) calc(1.5em - 1px),
    var(--border-color) 1.5em
  ) !important;
  background-size: 1px 1.5em !important;
  background-repeat: repeat-y !important;
  background-position: 3.5em 0 !important;
}

.highlight pre code:not(.language-plaintext)::before {
  content: "1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9\A 10\A 11\A 12\A 13\A 14\A 15\A 16\A 17\A 18\A 19\A 20\A 21\A 22\A 23\A 24\A 25\A 26\A 27\A 28\A 29\A 30\A 31\A 32\A 33\A 34\A 35\A 36\A 37\A 38\A 39\A 40\A 41\A 42\A 43\A 44\A 45\A 46\A 47\A 48\A 49\A 50" !important;
  position: absolute !important;
  left: 0 !important;
  top: 1em !important;
  width: 3.5em !important;
  text-align: right !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  font-family: inherit !important;
  user-select: none !important;
  opacity: 0.7 !important;
  padding-right: 0.5em !important;
  background: var(--bg-secondary) !important;
  line-height: 1.5 !important;
  white-space: pre !important;
  pointer-events: none !important;
}

/* Theme-specific line number colors */
:root[data-theme="light"] .highlight pre code::before,
:root[data-theme="light"] .highlight pre code .line::before {
  color: #6b7280 !important;
  background: #f9fafb !important;
}

:root[data-theme="dark"] .highlight pre code::before,
:root[data-theme="dark"] .highlight pre code .line::before {
  color: #9ca3af !important;
  background: #1f2937 !important;
}

/* ===== CLEAN REMOVAL OF OLD LINE NUMBER CSS ===== */

/* All old line number CSS removed - using Rouge table-based system above */

/* Lazy Loading Images */
img.lazy {
  opacity: 0;
  transition: opacity 0.3s ease;
}

img.lazy.loaded {
  opacity: 1;
}

/* Print Styles */
@media print {
  .reading-progress,
  .toc-container,
  .social-share,
  .code-copy-btn,
  .share-btn {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  body {
    font-size: 12pt !important;
    line-height: 1.4 !important;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  pre, code {
    background: #f5f5f5 !important;
    color: #333 !important;
  }
}

/* Mobile Enhancements */
@media (max-width: 768px) {
  .toc-container {
    position: static;
    width: 100%;
    margin: 20px 0;
    max-height: none;
  }

  .reading-progress {
    top: 60px;
  }

  .share-buttons {
    flex-direction: column;
  }

  .share-btn {
    justify-content: center;
  }
}

/* Dark Theme Enhancements */
:root[data-theme="dark"] .code-copy-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

:root[data-theme="dark"] pre {
  background: #1a1a1a;
}

/* Dark theme line numbers */
:root[data-theme="dark"] .line-numbers .line-number {
  color: #9ca3af !important;
  border-right-color: #374151;
  background: #1f2937;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  .reading-progress-bar,
  .toc-toggle,
  .share-btn,
  .code-copy-btn {
    transition: none;
  }
}

/* Focus Styles */
.share-btn:focus,
.code-copy-btn:focus,
.toc-toggle:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .reading-progress-bar {
    background: #000;
  }

  .toc-container,
  .social-share {
    border: 2px solid;
  }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transform: translateY(100px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Micro-interactions */
.share-btn {
  position: relative;
  overflow: hidden;
}

.share-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}

.share-btn:active::before {
  width: 300px;
  height: 300px;
}

.theme-toggle {
  position: relative;
  overflow: hidden;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.theme-toggle:hover::before {
  left: 100%;
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.search-loading,
.toc-loading {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Success Animation */
@keyframes success {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.share-btn.success {
  animation: success 0.3s ease;
}

/* Smooth Page Transitions */
* {
  transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

/* Focus improvements */
*:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Copy button for code blocks */
.highlight::before {
  content: "📋 Copy";
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 4px !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  opacity: 0 !important;
  transition: all 0.2s ease !important;
  z-index: 10 !important;
  color: var(--text-secondary) !important;
}

.highlight:hover::before {
.highlight:hover::before {
  opacity: 1 !important;
}

.highlight::before:hover {
  background: var(--hover-bg) !important;
  color: var(--accent-color) !important;
  transform: scale(1.05) !important;
}
  transform: scale(1.05) !important;
}

/* Syntax highlighting colors for light theme */
:root[data-theme="light"] .highlight .hll { background-color: #fef3c7; }
:root[data-theme="light"] .highlight .c { color: #6b7280; font-style: italic; } /* Comment */
:root[data-theme="light"] .highlight .err { color: #dc2626; background-color: #fef2f2; } /* Error */
:root[data-theme="light"] .highlight .k { color: #1e40af; font-weight: bold; } /* Keyword */
:root[data-theme="light"] .highlight .o { color: #1f2937; font-weight: bold; } /* Operator */
:root[data-theme="light"] .highlight .cm { color: #6b7280; font-style: italic; } /* Comment.Multiline */
:root[data-theme="light"] .highlight .cp { color: #374151; font-weight: bold; } /* Comment.Preproc */
:root[data-theme="light"] .highlight .c1 { color: #6b7280; font-style: italic; } /* Comment.Single */
:root[data-theme="light"] .highlight .cs { color: #374151; font-weight: bold; font-style: italic; } /* Comment.Special */
:root[data-theme="light"] .highlight .gd { color: #1f2937; background-color: #fee2e2; } /* Generic.Deleted */
:root[data-theme="light"] .highlight .ge { font-style: italic; } /* Generic.Emph */
:root[data-theme="light"] .highlight .gr { color: #dc2626; } /* Generic.Error */
:root[data-theme="light"] .highlight .gh { color: #374151; } /* Generic.Heading */
:root[data-theme="light"] .highlight .gi { color: #1f2937; background-color: #dcfce7; } /* Generic.Inserted */
:root[data-theme="light"] .highlight .go { color: #6b7280; } /* Generic.Output */
:root[data-theme="light"] .highlight .gp { color: #374151; } /* Generic.Prompt */
:root[data-theme="light"] .highlight .gs { font-weight: bold; } /* Generic.Strong */
:root[data-theme="light"] .highlight .gu { color: #6b7280; } /* Generic.Subheading */
:root[data-theme="light"] .highlight .gt { color: #dc2626; } /* Generic.Traceback */
:root[data-theme="light"] .highlight .kc { color: #1e40af; font-weight: bold; } /* Keyword.Constant */
:root[data-theme="light"] .highlight .kd { color: #1e40af; font-weight: bold; } /* Keyword.Declaration */
:root[data-theme="light"] .highlight .kn { color: #1e40af; font-weight: bold; } /* Keyword.Namespace */
:root[data-theme="light"] .highlight .kp { color: #1e40af; font-weight: bold; } /* Keyword.Pseudo */
:root[data-theme="light"] .highlight .kr { color: #1e40af; font-weight: bold; } /* Keyword.Reserved */
:root[data-theme="light"] .highlight .kt { color: #059669; font-weight: bold; } /* Keyword.Type */
:root[data-theme="light"] .highlight .m { color: #0891b2; } /* Literal.Number */
:root[data-theme="light"] .highlight .s { color: #dc2626; } /* Literal.String */
:root[data-theme="light"] .highlight .na { color: #059669; } /* Name.Attribute */
:root[data-theme="light"] .highlight .nb { color: #1e40af; } /* Name.Builtin */
:root[data-theme="light"] .highlight .nc { color: #059669; font-weight: bold; } /* Name.Class */
:root[data-theme="light"] .highlight .no { color: #dc2626; } /* Name.Constant */
:root[data-theme="light"] .highlight .nd { color: #7c3aed; } /* Name.Decorator */
:root[data-theme="light"] .highlight .ni { color: #0891b2; } /* Name.Entity */
:root[data-theme="light"] .highlight .ne { color: #dc2626; font-weight: bold; } /* Name.Exception */
:root[data-theme="light"] .highlight .nf { color: #7c3aed; font-weight: bold; } /* Name.Function */
:root[data-theme="light"] .highlight .nl { color: #7c3aed; } /* Name.Label */
:root[data-theme="light"] .highlight .nn { color: #059669; font-weight: bold; } /* Name.Namespace */
:root[data-theme="light"] .highlight .nt { color: #059669; font-weight: bold; } /* Name.Tag */
:root[data-theme="light"] .highlight .nv { color: #7c3aed; } /* Name.Variable */
:root[data-theme="light"] .highlight .ow { color: #1e40af; font-weight: bold; } /* Operator.Word */
:root[data-theme="light"] .highlight .w { color: #1f2937; } /* Text.Whitespace */
:root[data-theme="light"] .highlight .mf { color: #0891b2; } /* Literal.Number.Float */
:root[data-theme="light"] .highlight .mh { color: #0891b2; } /* Literal.Number.Hex */
:root[data-theme="light"] .highlight .mi { color: #0891b2; } /* Literal.Number.Integer */
:root[data-theme="light"] .highlight .mo { color: #0891b2; } /* Literal.Number.Oct */
:root[data-theme="light"] .highlight .sb { color: #dc2626; } /* Literal.String.Backtick */
:root[data-theme="light"] .highlight .sc { color: #dc2626; } /* Literal.String.Char */
:root[data-theme="light"] .highlight .sd { color: #6b7280; font-style: italic; } /* Literal.String.Doc */
:root[data-theme="light"] .highlight .s2 { color: #dc2626; } /* Literal.String.Double */
:root[data-theme="light"] .highlight .se { color: #dc2626; } /* Literal.String.Escape */
:root[data-theme="light"] .highlight .sh { color: #dc2626; } /* Literal.String.Herald */
:root[data-theme="light"] .highlight .si { color: #dc2626; } /* Literal.String.Interpol */
:root[data-theme="light"] .highlight .sx { color: #dc2626; } /* Literal.String.Other */
:root[data-theme="light"] .highlight .sr { color: #0891b2; } /* Literal.String.Regex */
:root[data-theme="light"] .highlight .s1 { color: #dc2626; } /* Literal.String.Single */
:root[data-theme="light"] .highlight .ss { color: #7c3aed; } /* Literal.String.Symbol */
:root[data-theme="light"] .highlight .bp { color: #6b7280; } /* Name.Builtin.Pseudo */
:root[data-theme="light"] .highlight .vc { color: #7c3aed; } /* Name.Variable.Class */
:root[data-theme="light"] .highlight .vg { color: #7c3aed; } /* Name.Variable.Global */
:root[data-theme="light"] .highlight .vi { color: #7c3aed; } /* Name.Variable.Instance */
:root[data-theme="light"] .highlight .il { color: #0891b2; } /* Literal.Number.Integer.Long */

/* Syntax highlighting colors for dark theme */
:root[data-theme="dark"] .highlight .hll { background-color: #374151; }
:root[data-theme="dark"] .highlight .c { color: #9ca3af; font-style: italic; } /* Comment */
:root[data-theme="dark"] .highlight .err { color: #f87171; background-color: #451a1a; } /* Error */
:root[data-theme="dark"] .highlight .k { color: #60a5fa; font-weight: bold; } /* Keyword */
:root[data-theme="dark"] .highlight .o { color: #f3f4f6; font-weight: bold; } /* Operator */
:root[data-theme="dark"] .highlight .cm { color: #9ca3af; font-style: italic; } /* Comment.Multiline */
:root[data-theme="dark"] .highlight .cp { color: #d1d5db; font-weight: bold; } /* Comment.Preproc */
:root[data-theme="dark"] .highlight .c1 { color: #9ca3af; font-style: italic; } /* Comment.Single */
:root[data-theme="dark"] .highlight .cs { color: #d1d5db; font-weight: bold; font-style: italic; } /* Comment.Special */
:root[data-theme="dark"] .highlight .gd { color: #f3f4f6; background-color: #451a1a; } /* Generic.Deleted */
:root[data-theme="dark"] .highlight .ge { font-style: italic; } /* Generic.Emph */
:root[data-theme="dark"] .highlight .gr { color: #f87171; } /* Generic.Error */
:root[data-theme="dark"] .highlight .gh { color: #d1d5db; } /* Generic.Heading */
:root[data-theme="dark"] .highlight .gi { color: #f3f4f6; background-color: #14532d; } /* Generic.Inserted */
:root[data-theme="dark"] .highlight .go { color: #9ca3af; } /* Generic.Output */
:root[data-theme="dark"] .highlight .gp { color: #d1d5db; } /* Generic.Prompt */
:root[data-theme="dark"] .highlight .gs { font-weight: bold; } /* Generic.Strong */
:root[data-theme="dark"] .highlight .gu { color: #9ca3af; } /* Generic.Subheading */
:root[data-theme="dark"] .highlight .gt { color: #f87171; } /* Generic.Traceback */
:root[data-theme="dark"] .highlight .kc { color: #60a5fa; font-weight: bold; } /* Keyword.Constant */
:root[data-theme="dark"] .highlight .kd { color: #60a5fa; font-weight: bold; } /* Keyword.Declaration */
:root[data-theme="dark"] .highlight .kn { color: #60a5fa; font-weight: bold; } /* Keyword.Namespace */
:root[data-theme="dark"] .highlight .kp { color: #60a5fa; font-weight: bold; } /* Keyword.Pseudo */
:root[data-theme="dark"] .highlight .kr { color: #60a5fa; font-weight: bold; } /* Keyword.Reserved */
:root[data-theme="dark"] .highlight .kt { color: #10b981; font-weight: bold; } /* Keyword.Type */
:root[data-theme="dark"] .highlight .m { color: #06b6d4; } /* Literal.Number */
:root[data-theme="dark"] .highlight .s { color: #f87171; } /* Literal.String */
:root[data-theme="dark"] .highlight .na { color: #10b981; } /* Name.Attribute */
:root[data-theme="dark"] .highlight .nb { color: #60a5fa; } /* Name.Builtin */
:root[data-theme="dark"] .highlight .nc { color: #10b981; font-weight: bold; } /* Name.Class */
:root[data-theme="dark"] .highlight .no { color: #f87171; } /* Name.Constant */
:root[data-theme="dark"] .highlight .nd { color: #a78bfa; } /* Name.Decorator */
:root[data-theme="dark"] .highlight .ni { color: #06b6d4; } /* Name.Entity */
:root[data-theme="dark"] .highlight .ne { color: #f87171; font-weight: bold; } /* Name.Exception */
:root[data-theme="dark"] .highlight .nf { color: #a78bfa; font-weight: bold; } /* Name.Function */
:root[data-theme="dark"] .highlight .nl { color: #a78bfa; } /* Name.Label */
:root[data-theme="dark"] .highlight .nn { color: #10b981; font-weight: bold; } /* Name.Namespace */
:root[data-theme="dark"] .highlight .nt { color: #10b981; font-weight: bold; } /* Name.Tag */
:root[data-theme="dark"] .highlight .nv { color: #a78bfa; } /* Name.Variable */
:root[data-theme="dark"] .highlight .ow { color: #60a5fa; font-weight: bold; } /* Operator.Word */
:root[data-theme="dark"] .highlight .w { color: #f3f4f6; } /* Text.Whitespace */
:root[data-theme="dark"] .highlight .mf { color: #06b6d4; } /* Literal.Number.Float */
:root[data-theme="dark"] .highlight .mh { color: #06b6d4; } /* Literal.Number.Hex */
:root[data-theme="dark"] .highlight .mi { color: #06b6d4; } /* Literal.Number.Integer */
:root[data-theme="dark"] .highlight .mo { color: #06b6d4; } /* Literal.Number.Oct */
:root[data-theme="dark"] .highlight .sb { color: #f87171; } /* Literal.String.Backtick */
:root[data-theme="dark"] .highlight .sc { color: #f87171; } /* Literal.String.Char */
:root[data-theme="dark"] .highlight .sd { color: #9ca3af; font-style: italic; } /* Literal.String.Doc */
:root[data-theme="dark"] .highlight .s2 { color: #f87171; } /* Literal.String.Double */
:root[data-theme="dark"] .highlight .se { color: #f87171; } /* Literal.String.Escape */
:root[data-theme="dark"] .highlight .sh { color: #f87171; } /* Literal.String.Herald */
:root[data-theme="dark"] .highlight .si { color: #f87171; } /* Literal.String.Interpol */
:root[data-theme="dark"] .highlight .sx { color: #f87171; } /* Literal.String.Other */
:root[data-theme="dark"] .highlight .sr { color: #06b6d4; } /* Literal.String.Regex */
:root[data-theme="dark"] .highlight .s1 { color: #f87171; } /* Literal.String.Single */
:root[data-theme="dark"] .highlight .ss { color: #a78bfa; } /* Literal.String.Symbol */
:root[data-theme="dark"] .highlight .bp { color: #9ca3af; } /* Name.Builtin.Pseudo */
:root[data-theme="dark"] .highlight .vc { color: #a78bfa; } /* Name.Variable.Class */
:root[data-theme="dark"] .highlight .vg { color: #a78bfa; } /* Name.Variable.Global */
:root[data-theme="dark"] .highlight .vi { color: #a78bfa; } /* Name.Variable.Instance */
:root[data-theme="dark"] .highlight .il { color: #06b6d4; } /* Literal.Number.Integer.Long */
.highlight .nb { color: #0086b3; } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold; } /* Name.Class */
.highlight .no { color: #008080; } /* Name.Constant */
.highlight .ni { color: #800080; } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold; } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold; } /* Name.Function */
.highlight .nn { color: #555555; } /* Name.Namespace */
.highlight .nt { color: #000080; } /* Name.Tag */
.highlight .nv { color: #008080; } /* Name.Variable */
.highlight .ow { color: #000000; font-weight: bold; } /* Operator.Word */
.highlight .w { color: #bbb; } /* Text.Whitespace */
.highlight .mf { color: #099; } /* Literal.Number.Float */
.highlight .mh { color: #099; } /* Literal.Number.Hex */
.highlight .mi { color: #099; } /* Literal.Number.Integer */
.highlight .mo { color: #099; } /* Literal.Number.Oct */
.highlight .sb { color: #d14; } /* Literal.String.Backtick */
.highlight .sc { color: #d14; } /* Literal.String.Char */
.highlight .sd { color: #d14; } /* Literal.String.Doc */
.highlight .s2 { color: #d14; } /* Literal.String.Double */
.highlight .se { color: #d14; } /* Literal.String.Escape */
.highlight .sh { color: #d14; } /* Literal.String.Herald */
.highlight .si { color: #d14; } /* Literal.String.Interpol */
.highlight .sx { color: #d14; } /* Literal.String.Other */
.highlight .sr { color: #009926; } /* Literal.String.Regex */
.highlight .s1 { color: #d14; } /* Literal.String.Single */
.highlight .ss { color: #990073; } /* Literal.String.Symbol */
.highlight .bp { color: #999; } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080; } /* Name.Variable.Class */
.highlight .vg { color: #008080; } /* Name.Variable.Global */
.highlight .vi { color: #008080; } /* Name.Variable.Instance */
.highlight .il { color: #099; } /* Literal.Number.Integer.Long */

/* ===== SEARCH FUNCTIONALITY ===== */

.search-container {
    position: relative;
    max-width: 300px;
    width: 100%;
}

#search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.3s ease;
}

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

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 8px 8px 0 0;
}

.search-results-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.search-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.search-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.search-results-list {
    max-height: 350px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
}

.search-result-item h4 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.search-result-item h4 a:hover {
    color: var(--accent-color);
}

.search-snippet {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.search-snippet mark {
    background: var(--accent-color);
    color: white;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 500;
}

.search-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-secondary);
}

.search-category {
    background: var(--accent-color);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: capitalize;
}

.search-score {
    font-style: italic;
}

.search-no-results {
    padding: 20px 15px;
    text-align: center;
    color: var(--text-secondary);
}

.search-no-results p {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.search-no-results strong {
    color: var(--text-primary);
}

.search-loading {
    padding: 20px 15px;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.search-filters {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.search-container.search-active .search-filters {
    display: flex;
}

.filter-btn {
    padding: 4px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

