/* Nextra-Inspired Documentation Site Styles */
:root {
  /* Dark theme (default) - Nextra inspired */
  --bg-primary: #111111;
  --bg-secondary: #171717;
  --bg-tertiary: #1f1f1f;
  --bg-quaternary: #262626;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border-color: #2a2a2a;
  --border-light: #404040;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.1);
  --code-bg: #0a0a0a;
  --code-border: #262626;
  --search-bg: #171717;
  --nav-hover: #1f1f1f;
  --nav-active: #262626;
  --toc-bg: #111111;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --client-badge: #3b82f6;
  --server-badge: #ef4444;
  --shared-badge: #f59e0b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f5f5f5;
  --bg-quaternary: #e5e5e5;
  --text-primary: #171717;
  --text-secondary: #525252;
  --text-muted: #737373;
  --border-color: #e5e5e5;
  --border-light: #d4d4d8;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.1);
  --code-bg: #f8f8f8;
  --code-border: #e5e5e5;
  --search-bg: #ffffff;
  --nav-hover: #f5f5f5;
  --nav-active: #e5e5e5;
  --toc-bg: #ffffff;
  --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.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --client-badge: #3b82f6;
  --server-badge: #ef4444;
  --shared-badge: #f59e0b;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
}

/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  font-feature-settings: 'cv11', 'ss01';
  font-variant-numeric: tabular-nums;
}

/* Header - Nextra style */
.header {
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px;
  transition: all 0.2s ease;
}

[data-theme="dark"] .header {
  background-color: rgba(17, 17, 17, 0.8);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Search - Nextra style improved */
.search-container {
  position: relative;
}

.search-input {
  background-color: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px 10px 40px;
  color: var(--text-primary);
  font-size: 14px;
  width: 280px;
  transition: all 0.2s ease;
  font-family: inherit;
  font-weight: 400;
  box-shadow: var(--shadow-sm);
}

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

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle:hover {
  background-color: var(--nav-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Discord Button */
.discord-button {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.discord-button:hover {
  background-color: var(--nav-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  color: var(--text-primary);
}

.discord-button i {
  font-size: 16px;
  color: #5865f2; /* Keep Discord purple for the icon */
}

/* Discord button click effect */
.discord-button.clicked {
  animation: discordClick 0.3s ease-out;
}

@keyframes discordClick {
  0% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }
  50% {
    transform: scale(0.95);
    box-shadow: 0 4px 16px rgba(88, 101, 242, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(88, 101, 242, 0.2);
  }
}

/* CSS Confetti fallback effect - full page coverage */
.discord-button.confetti-fallback {
  position: relative;
  overflow: visible;
}

.discord-button.confetti-fallback::before,
.discord-button.confetti-fallback::after {
  content: "🎉🎊✨🎉�✨�🎉🎊✨";
  position: fixed;
  top: 0;
  width: 100vw;
  text-align: center;
  font-size: 24px;
  animation: confettiFallback 3s ease-out;
  pointer-events: none;
  z-index: 10000;
  letter-spacing: 50px;
}

.discord-button.confetti-fallback::before {
  left: 0;
  animation-delay: 0s;
}

.discord-button.confetti-fallback::after {
  left: 0;
  animation-delay: 0.5s;
  content: "🌟💫🎈🌟💫🎈🌟💫🎈";
}

@keyframes confettiFallback {
  0% {
    opacity: 1;
    transform: translateY(-50px) scale(0.5) rotate(0deg);
  }
  25% {
    opacity: 1;
    transform: translateY(20vh) scale(1.2) rotate(180deg);
  }
  50% {
    opacity: 0.8;
    transform: translateY(50vh) scale(1) rotate(360deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) scale(0.5) rotate(540deg);
  }
}

/* Layout - Nextra style */
.container {
  display: flex;
  margin-top: 64px;
  min-height: calc(100vh - 64px);
}

/* Sidebar Navigation - Nextra style */
.sidebar {
  width: 280px;
  background-color: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  overflow: hidden; /* Changed from overflow-y: auto */
  position: fixed;
  left: 0;
  top: 64px;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

#nav-menu {
  flex: 1;
  padding: 1.5rem 1.5rem 0 1.5rem;
  position: relative;
  min-height: 0; /* Allow shrinking */
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 1.5rem;
  position: relative;
}

/* Remove section dividers - only keep page-level dividers */
/* .nav-section:not(:first-child) - commented out */

/* Add subtle background for main sections */
.nav-section {
  border-radius: 8px;
  padding: 8px 0;
  transition: all 0.2s ease;
}

.nav-section:hover {
  background-color: rgba(var(--accent-rgb), 0.08);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-section-header {
  padding: 12px 24px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
  margin-bottom: 8px;
}

.nav-section-header::after {
  content: "▼";
  position: absolute;
  right: 24px;
  font-size: 10px;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.nav-section.collapsed .nav-section-header::after {
  transform: rotate(-90deg);
}

.nav-section-header:hover {
  color: var(--text-primary);
  background-color: rgba(var(--accent-rgb), 0.06);
  border-radius: 6px;
  transform: translateX(2px);
}

.nav-section-header:hover::after {
  opacity: 1;
}

.nav-items {
  display: block;
}

.nav-section.collapsed .nav-items {
  display: none;
}

.nav-item {
  padding: 8px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 400;
  border-radius: 0;
  margin: 1px 12px;
  border-radius: 6px;
}

.nav-item:hover {
  background-color: var(--nav-hover);
  color: var(--text-primary);
  transform: translateX(4px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.nav-item.active {
  background-color: var(--accent-light);
  color: var(--accent-color);
  font-weight: 500;
}

/* Navigation item badges */
.nav-badges {
  display: flex;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-badges .badge {
  font-size: 9px;
  padding: 1px 4px;
  min-width: 12px;
  text-align: center;
}

/* Main Content - Nextra style */
.main-content {
  flex: 1;
  margin-left: 280px;
  margin-right: 280px;
  padding: 2rem 3rem;
  max-width: none;
  min-height: calc(100vh - 64px);
}

.content-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.content-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.content-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 65ch;
}

/* Function Documentation - Nextra style */
.function-section {
  margin-bottom: 4rem;
}

.function-section h2 {
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.function-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.function-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.function-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.function-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Cascadia Code', monospace;
  letter-spacing: -0.025em;
  margin: 0;
}

/* Function header title styling */
.function-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Cascadia Code', monospace;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.3;
}

.function-badges {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge.client {
  background-color: var(--client-badge);
  color: white;
}

.badge.server {
  background-color: var(--server-badge);
  color: white;
}

.badge.shared {
  background-color: var(--shared-badge);
  color: white;
}

.function-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.7;
  font-size: 15px;
}

/* Enhanced function card text styling */
.function-card p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.function-syntax h4,
.function-parameters h4,
.function-example h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 13px;
    color: var(--text-muted);
}

.function-parameters ul {
    margin: 1rem 0 0 0;
    padding: 0;
    list-style: none;
}

.function-parameters li {
    margin-bottom: 0.75rem;
    font-size: 14px;
    line-height: 1.6;
    padding: 12px 16px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.function-parameters code {
    background: var(--accent-light);
    color: var(--accent-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
}

/* Code blocks - Nextra style */
.function-syntax .code-block,
.function-example .code-block {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
}

.function-syntax .code-block code,
.function-example .code-block code {
    color: var(--text-primary);
    background: none;
    border: none;
    padding: 0;
}

/* Table of Contents - Nextra style */
.toc {
  width: 280px;
  background-color: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  position: fixed;
  right: 0;
  top: 64px;
  bottom: 0;
  overflow-y: auto;
  padding: 1.5rem 0;
}

.toc-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding: 0 24px 8px 24px;
  border-bottom: 1px solid var(--border-color);
}

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

.toc-item {
    margin: 0;
    padding: 0;
}

.toc-link {
    display: block;
    padding: 6px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0;
    transition: all 0.2s ease;
    font-size: 14px;
    line-height: 1.5;
}

.toc-link:hover {
    background: var(--nav-hover);
    color: var(--text-primary);
    transform: translateX(3px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.toc-link.active {
    background: var(--accent-light);
    color: var(--accent-color);
    font-weight: 500;
}

.toc-level-1 .toc-link {
    font-weight: 500;
    font-size: 14px;
}

.toc-level-2 .toc-link {
    font-weight: 400;
    padding-left: 36px;
    font-size: 13px;
}

.toc-level-3 .toc-link,
.toc-level-4 .toc-link,
.toc-level-5 .toc-level-6 {
    font-weight: 400;
    padding-left: 48px;
    font-size: 13px;
    opacity: 0.8;
}

/* TOC Category Styles */
.toc-category {
    margin-bottom: 1.5rem;
}

.toc-category-header {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
}

.toc-category-icon {
    margin-right: 0.5rem;
}

.toc-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
}

.toc-category-list {
    margin: 0;
    padding-left: 0;
}

.toc-category-list .toc-link {
    padding-left: 1.5rem;
    position: relative;
}

.toc-category-list .toc-link::before {
    content: "•";
    position: absolute;
    left: 0.7rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.toc-category-list .toc-link[data-side="client"]::before {
    color: #4a9eff;
}

.toc-category-list .toc-link[data-side="server"]::before {
    color: #ff6b6b;
}

.toc-category-list .toc-link[data-side="shared"]::before {
    color: #ffd93d;
}

.toc-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

/* Enhanced Navigation Styling */
.nav-section-header .icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    opacity: 0.7;
}

.nav-section.collapsed .icon {
    transform: rotate(-90deg);
}

.nav-section-header:hover .icon {
    opacity: 1;
}

.nav-subsection-header {
    position: relative;
    padding: 8px 24px;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
    border-left: 3px solid transparent;
    cursor: pointer;
    margin: 4px 0;
}

/* Remove dividers between individual pages */
/* .nav-item:not(:last-child) {
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
    margin-bottom: 6px;
    padding-bottom: 6px;
} */

/* Add flat dividers between main sections only */
.nav-section:not(:first-child) {
    border-top: 1px solid var(--border-light);
    border-radius: 0; /* Ensure completely flat edges */
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

/* Alternative flat line implementation using pseudo-element */
.nav-section:not(:first-child)::before {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background-color: var(--border-light);
    margin: -1.5rem 0 1.5rem 0;
    border-radius: 0; /* Perfectly flat line */
}

/* Remove dividers between subsections - commented out */
/* .nav-subsection:not(:last-child) {
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 8px;
    padding-bottom: 8px;
} */

.nav-subsection-header:hover {
    background-color: var(--nav-hover);
    border-left-color: var(--accent-color);
    transform: translateX(2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Items inside subsections should be more indented */
.nav-subsection .nav-items .nav-item {
    padding-left: 40px; /* More indented than the subsection header */
}

/* Ensure hover effects work on nested nav items */
.nav-items .nav-item:hover {
    background-color: var(--nav-hover);
    color: var(--text-primary);
    transform: translateX(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.nav-section .nav-items .nav-item:hover {
    background-color: var(--nav-hover);
    color: var(--text-primary);
    transform: translateX(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Specific hover effects for subsection items */
.nav-subsection .nav-items .nav-item:hover {
    background-color: var(--nav-hover);
    color: var(--text-primary);
    transform: translateX(6px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border-left: 3px solid var(--accent-color);
}

.nav-subsection-header::after {
    content: "▼";
    position: absolute;
    right: 1rem;
    font-size: 0.7rem;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.nav-subsection.collapsed .nav-subsection-header::after {
    transform: rotate(-90deg);
}

.nav-subsection-header:hover::after {
    opacity: 1;
}

/* Active navigation item */
.nav-item.active {
    background: var(--accent-color);
    color: white;
    font-weight: 500;
}

.nav-item.active:hover {
    background: var(--accent-color);
    transform: none;
}

/* Better scrollbar for TOC */
.toc-list::-webkit-scrollbar {
    width: 6px;
}

.toc-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.toc-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

/* Smooth transitions for collapsing */
.nav-items {
    transition: all 0.3s ease;
    overflow: hidden;
    display: block;
}

.nav-section.collapsed .nav-items {
    display: none !important;
}

.nav-subsection.collapsed .nav-items {
    display: none !important;
}

/* Icon rotation for collapsed state */
.nav-section.collapsed .nav-section-header .icon {
    transform: rotate(-90deg);
}

/* Bottom navigation section for Contributors */
.nav-bottom-section {
  flex-shrink: 0;
  padding: 8px 0; /* Match other sections padding */
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  background-color: var(--bg-primary);
}

.nav-item-bottom {
    background-color: rgba(var(--accent-rgb), 0.06);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: 8px;
    padding: 12px 24px !important; /* Match other nav items padding */
    margin: 1px 12px; /* Match other nav items margin */
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item-bottom:hover {
    background-color: rgba(var(--accent-rgb), 0.12);
    border-color: rgba(var(--accent-rgb), 0.4);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.nav-item-bottom .nav-icon {
    color: var(--accent-color);
}

.nav-item-bottom .nav-title {
    font-weight: 500;
    color: var(--text-primary);
}

/* Enhanced emoji styling with colors and effects */
.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
}

/* Make emojis more vibrant and add subtle effects */
.nav-icon:not(:has(i)) {
    filter: brightness(1.2) saturate(1.3);
    transform: scale(1.1);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.nav-icon:not(:has(i)):hover {
    filter: brightness(1.4) saturate(1.5);
    transform: scale(1.2);
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

/* Search Results - Improved Nextra style */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    backdrop-filter: blur(12px);
}

/* Search results scrollbar styling */
.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

[data-theme="dark"] .search-results {
    background: rgba(23, 23, 23, 0.95);
    border-color: var(--border-light);
}

[data-theme="light"] .search-results {
    background: rgba(255, 255, 255, 0.95);
}

.search-results-header {
    padding: 16px 20px 12px 20px;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-close {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.search-results-list {
    max-height: none;
    overflow-y: visible;
    padding: 8px 0;
}

.search-result-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin: 2px 8px;
    border-radius: 8px;
}

.search-result-item:hover {
    background: var(--nav-hover);
    border-left-color: var(--accent-color);
    transform: translateX(2px);
}

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

.search-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.search-result-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.3;
}

.search-result-path {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.search-result-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.search-no-results {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.search-no-results::before {
    content: "🔍";
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Highlight matched text - improved */
.search-result-item mark {
    background: var(--accent-color);
    color: white;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

[data-theme="light"] .search-result-item mark {
    background: var(--accent-color);
    color: white;
}

/* Module badge in search results - improved */
.badge.module {
    background: var(--bg-quaternary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Search loading state */
.search-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.search-loading::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    margin-right: 8px;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}

/* Loading States */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-secondary);
  animation: pulse 2s infinite;
  text-align: center;
  font-size: 1.1rem;
}

.loading::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-top: 2px solid var(--accent-color);
  border-radius: 50%;
  margin-right: 1rem;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Error States */
.error {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
}

.error h2 {
  color: #c33;
  margin: 0 0 1rem 0;
}

.error p {
  color: #666;
  margin: 0.5rem 0;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

.empty-state h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Keyboard shortcuts overlay */
.shortcuts-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.shortcuts-modal {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

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

.shortcuts-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.shortcuts-close:hover {
    background-color: var(--nav-hover);
    color: var(--text-primary);
}

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

.shortcuts-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.shortcuts-description {
    color: var(--text-primary);
    font-size: 14px;
}

.shortcuts-keys {
    display: flex;
    gap: 4px;
}

.shortcuts-key {
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 11px;
    color: var(--text-primary);
    min-width: 20px;
    text-align: center;
}

/* Export functionality */
.export-container {
    position: relative;
}

.export-button {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.export-button:hover {
    background-color: var(--nav-hover);
    border-color: var(--accent-color);
}

.export-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 0;
    min-width: 150px;
    z-index: 1001;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.export-option {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.export-option:hover {
    background-color: var(--nav-hover);
}

/* Version info */
.version-info {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 100;
}

.version-info:hover {
    opacity: 1;
}

/* Enhanced syntax highlighting */
.syntax-code {
    position: relative;
    background: linear-gradient(135deg, var(--code-bg), var(--bg-tertiary));
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    padding: 1rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 14px;
    color: var(--text-primary);
    overflow-x: auto;
    white-space: pre-wrap;
    position: relative;
}

.syntax-code .language-label {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

/* Copy button for code blocks */
.code-block-container {
    position: relative;
}

.copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.code-block-container:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: var(--nav-hover);
    color: var(--text-primary);
    transform: scale(1.05);
}

/* Search improvements */
.search-input:focus {
    box-shadow: 0 0 0 3px rgba(35, 134, 54, 0.1);
    border-color: var(--accent-color);
}

.search-suggestions {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 8px 12px;
    display: none;
    font-size: 12px;
    color: var(--text-secondary);
}

.search-suggestion {
    margin: 2px 0;
}

/* Better loading states */
.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

.skeleton-line {
    height: 1rem;
    margin: 0.5rem 0;
    border-radius: 4px;
}

.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.long { width: 100%; }

/* Responsive Design - Nextra style */
@media (max-width: 1200px) {
  .toc {
    display: none;
  }

  .main-content {
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  /* Force hide TOC on mobile */
  .toc {
    display: none !important;
  }

  /* Mobile navigation overlay */
  .mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
  }

  .sidebar.open ~ .mobile-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    position: fixed;
  }

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

  .main-content {
    margin-left: 0;
    margin-right: 0;
    padding: 1.5rem 1rem;
    width: 100%;
  }

  .header {
    padding: 0 1rem;
    height: 56px;
  }

  .container {
    margin-top: 56px;
    min-height: calc(100vh - 56px);
  }

  .sidebar {
    top: 56px;
  }

  .search-input {
    width: 200px;
    font-size: 14px;
    padding: 8px 12px 8px 36px;
  }

  .search-results {
    left: -100px;
    right: -20px;
    max-height: 300px;
    overflow-y: auto;
  }

  .search-result-item {
    padding: 10px 16px;
    margin: 1px 4px;
  }

  .search-result-name {
    font-size: 14px;
  }

  .search-result-description {
    font-size: 12px;
  }

  .mobile-nav-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
  }

  .mobile-nav-toggle:hover {
    background-color: var(--nav-hover);
    border-color: var(--border-light);
  }

  .mobile-nav-toggle:active {
    transform: scale(0.95);
  }

  .mobile-nav-toggle svg {
    width: 20px;
    height: 20px;
  }

  .header h1 {
    font-size: 1.125rem;
  }

  .header-controls {
    gap: 0.5rem;
  }

  .nav-badges {
    display: none;
  }

  .content-title {
    font-size: 2rem;
  }

  .function-card {
    padding: 1.5rem;
  }

  .function-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .function-badges {
    margin-top: 0;
  }

  /* Mobile-specific layout fixes */
  .content-area {
    max-width: 100%;
    overflow-x: hidden;
  }

  .content-area pre {
    margin: 1rem -1rem;
    border-radius: 0;
    padding: 1rem;
  }

  .content-area .function-card {
    margin: 1rem -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* Improve mobile typography */
  .content-area h1 {
    font-size: 1.875rem;
    line-height: 1.2;
  }

  .content-area h2 {
    font-size: 1.5rem;
  }

  .content-area h3 {
    font-size: 1.25rem;
  }

  /* Better mobile search */
  .header-controls {
    gap: 0.25rem;
  }

  .search-container {
    position: static;
  }

  /* Hide any potential overflow issues */
  body {
    overflow-x: hidden;
  }
}

/* Tablet-specific adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
  .toc {
    width: 240px;
  }

  .main-content {
    margin-right: 240px;
    padding: 2rem 2rem;
  }

  .search-input {
    width: 240px;
  }
}

/* JSON Module Styles */
.module-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.module-header h1 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 2.5rem;
}

.module-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.functions-section, .events-section, .config-section {
    margin: 3rem 0;
}

.functions-section h2, .events-section h2, .config-section h2 {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.functions-grid, .events-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(600px, 1fr));
}

.function-card, .event-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.function-card:hover, .event-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(35, 134, 54, 0.1);
}

.function-header, .event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.function-name, .event-name {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.function-description, .event-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.function-syntax, .function-parameters, .function-returns, .function-example,
.event-parameters, .event-example {
    margin: 1rem 0;
}

.function-syntax h4, .function-parameters h4, .function-returns h4, .function-example h4,
.event-parameters h4, .event-example h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.function-parameters ul, .function-returns ul, .event-parameters ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.function-parameters li, .function-returns li, .event-parameters li {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.param-type, .return-type {
    color: var(--accent-color);
    font-weight: 500;
}

.badge.event {
    background-color: #8b5cf6;
    color: white;
}

.config-content {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}

.config-content .code-block {
    background: none;
    margin: 0;
    padding: 0;
}

/* ================================
   Markdown Documentation Styles - Nextra Inspired
   ================================ */

.content-area {
  padding: 0;
}

.content-area h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.content-area h2 {
  font-size: 1.875rem;
  font-weight: 600;
  margin: 3rem 0 1.5rem 0;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.content-area h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem 0;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.content-area h4 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem 0;
  color: var(--text-primary);
}

.content-area h5,
.content-area h6 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem 0;
  color: var(--text-primary);
}

.content-area p {
  margin-bottom: 1.5rem;
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 15px;
}

.content-area ul,
.content-area ol {
  margin: 1.5rem 0;
  padding-left: 1.5rem;
}

.content-area li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.content-area code {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-family: 'JetBrains Mono', 'Fira Code', Monaco, Consolas, monospace;
  font-size: 13px;
  color: var(--accent-color);
  font-weight: 500;
}

.content-area pre {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}

.content-area pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-weight: 400;
}

.content-area blockquote {
  border-left: 3px solid var(--accent-color);
  background: var(--bg-secondary);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}

.content-area a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.content-area a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.content-area strong {
  color: var(--text-primary);
  font-weight: 600;
}

.content-area em {
  color: var(--text-secondary);
  font-style: italic;
}

/* Nextra-style callouts */
.content-area .callout {
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  border-radius: 8px;
  border-left: 4px solid;
}

.content-area .callout-info {
  background: rgba(59, 130, 246, 0.1);
  border-left-color: var(--accent-color);
  color: var(--text-primary);
}

.content-area .callout-warning {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: var(--warning-color);
  color: var(--text-primary);
}

.content-area .callout-error {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: var(--error-color);
  color: var(--text-primary);
}

.content-area .callout-success {
  background: rgba(16, 185, 129, 0.1);
  border-left-color: var(--success-color);
  color: var(--text-primary);
}

/* Enhanced tables */
.content-area table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.content-area th {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}

.content-area td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.content-area tr:last-child td {
  border-bottom: none;
}

.content-area tr:hover {
  background: var(--nav-hover);
}

/* Better keyboard shortcuts styling */
.content-area kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Function Documentation Styles */
.content-area h3[id] {
  position: relative;
  scroll-margin-top: 80px; /* Account for fixed header */
}

.content-area h3[id]:hover::after {
  content: "🔗";
  position: absolute;
  left: -30px;
  opacity: 0.5;
  cursor: pointer;
}

/* Syntax Highlighting */
.content-area .language-lua .keyword {
  color: #ff7b72;
  font-weight: bold;
}

.content-area .language-lua .string {
  color: #a5d6ff;
}

.content-area .language-lua .comment {
  color: #8b949e;
  font-style: italic;
}

/* Navigation Styles for Markdown */
.nav-category {
  margin-bottom: 0.5rem;
}

.nav-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.nav-category-header:hover {
  background: var(--nav-hover);
}

.nav-category-content {
  margin-top: 0.5rem;
  padding-left: 1rem;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  margin: 0.2rem 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: var(--nav-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-color);
  color: white;
}

.nav-subfolder {
  margin: 0.5rem 0;
}

.nav-subfolder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--bg-tertiary);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-subfolder-header:hover {
  background: var(--nav-hover);
}

.nav-subfolder-content {
  margin-top: 0.3rem;
  padding-left: 1rem;
}

.nav-icon {
  margin-right: 0.5rem;
  font-size: 1.1rem;
}

.nav-title {
  flex: 1;
}

.nav-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

/* TOC Styles for Markdown */
.toc-content .toc-list {
  list-style: none;
  padding: 0;
}

.toc-content .toc-list li {
  margin: 0.3rem 0;
}

.toc-content .toc-list a {
  display: block;
  padding: 0.4rem 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.toc-content .toc-list a:hover {
  background: var(--nav-hover);
  color: var(--text-primary);
}

.toc-level-1 a {
  font-weight: 600;
  font-size: 1rem;
}

.toc-level-2 a {
  padding-left: 1rem;
}

.toc-level-3 a {
  padding-left: 1.5rem;
  font-size: 0.85rem;
}

.toc-level-4 a {
  padding-left: 2rem;
  font-size: 0.8rem;
}

/* Search Results Styles */
.search-results-area {
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 2rem;
}

.search-results-container {
  padding: 1.5rem;
}

.search-results-container h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.search-result-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-result-item:hover {
  border-color: var(--accent-color);
  background: var(--bg-primary);
}

.search-result-item h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.search-result-item .result-path {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.search-result-item .result-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Function and Module specific search result styles */
.function-result {
  border-left: 3px solid var(--accent-color);
}

.module-result {
  border-left: 3px solid var(--text-secondary);
}

.function-icon, .module-icon {
  margin-right: 0.5rem;
}

.match-type {
  font-size: 0.7rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 0.5rem;
  font-weight: normal;
}

.function-result .match-type {
  background: var(--accent-color-alpha);
  color: var(--accent-color);
}

/* Error Message Styles */
.error-message {
  background: var(--bg-secondary);
  border: 1px solid #da3633;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  margin: 2rem 0;
}

.error-message h2 {
  color: #da3633;
  margin-bottom: 1rem;
}

.error-message p {
  color: var(--text-secondary);
}

/* Loading Animation */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.loading::after {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-top: 2px solid var(--accent-color);
  border-radius: 50%;
  margin-left: 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design for Markdown */
@media (max-width: 768px) {
  .content-area h1 {
    font-size: 2rem;
  }

  .content-area h2 {
    font-size: 1.5rem;
  }

  .content-area h3 {
    font-size: 1.3rem;
  }

  .nav-category-header,
  .nav-subfolder-header {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
  }

  .nav-item {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }
}

/* Context Badges */
.content-area p strong:contains("Context:") {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* Section Headers (h4) with special styling */
.content-area h4.section-header {
  font-size: 1.4rem;
  margin: 2rem 0 1.5rem 0;
  color: var(--accent-color);
  font-weight: 600;
  padding: 0.8rem 1.2rem;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border-left: 4px solid var(--accent-color);
  border-radius: 6px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.content-area h4.section-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent-color) 0%, var(--accent-hover) 100%);
  border-radius: 0 0 0 6px;
}

/* Table Styling */
.table-container {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
}

.content-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-secondary);
  font-size: 0.95rem;
}

.content-table th {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
  color: white;
  font-weight: 600;
  padding: 1rem 1.2rem;
  text-align: left;
  border-bottom: 2px solid var(--accent-hover);
  position: relative;
}

.content-table th:first-child {
  border-radius: 8px 0 0 0;
}

.content-table th:last-child {
  border-radius: 0 8px 0 0;
}

.content-table td {
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: top;
  line-height: 1.5;
}

.content-table tr:nth-child(even) {
  background-color: var(--bg-tertiary);
}

.content-table tr:hover {
  background-color: var(--nav-hover);
  transition: background-color 0.2s ease;
}

.content-table tr:last-child td:first-child {
  border-radius: 0 0 0 8px;
}

.content-table tr:last-child td:last-child {
  border-radius: 0 0 8px 0;
}

/* Status badges in tables */
.content-table td:contains("✅") {
  color: var(--accent-color);
  font-weight: 500;
}

.content-table td:contains("❌") {
  color: var(--server-badge);
  font-weight: 500;
}

/* Bold text in table cells */
.content-table td strong,
.content-table th strong {
  color: var(--text-primary);
}

/* Code in tables */
.content-table code {
  background-color: var(--code-bg);
  color: var(--accent-color);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
  border: 1px solid var(--code-border);
}

/* Highlight.js Theme Overrides */
[data-theme="dark"] .hljs {
  background: var(--code-bg) !important;
  color: var(--text-primary) !important;
}

[data-theme="light"] .hljs {
  background: var(--code-bg) !important;
  color: var(--text-primary) !important;
}

/* Ensure code blocks in our containers work with highlight.js */
.code-block-container .hljs {
  background: transparent !important;
  padding: 0 !important;
}

/* Override highlight.js colors to match our theme */
[data-theme="dark"] .hljs-keyword,
[data-theme="dark"] .hljs-selector-tag,
[data-theme="dark"] .hljs-literal,
[data-theme="dark"] .hljs-section,
[data-theme="dark"] .hljs-link {
  color: #f47067 !important;
}

[data-theme="dark"] .hljs-string {
  color: #a5d6ff !important;
}

[data-theme="dark"] .hljs-comment {
  color: var(--text-muted) !important;
}

[data-theme="dark"] .hljs-number {
  color: #79c0ff !important;
}

[data-theme="light"] .hljs-keyword,
[data-theme="light"] .hljs-selector-tag,
[data-theme="light"] .hljs-literal,
[data-theme="light"] .hljs-section,
[data-theme="light"] .hljs-link {
  color: #cf222e !important;
}

[data-theme="light"] .hljs-string {
  color: #0a3069 !important;
}

[data-theme="light"] .hljs-comment {
  color: var(--text-muted) !important;
}

[data-theme="light"] .hljs-number {
  color: #0969da !important;
}

/* Collapsible TOC Styles */
.toc-collapsible {
    margin-bottom: 0.5rem;
}

.toc-no-toggle {
    margin-bottom: 0.5rem;
    margin-left: 20px; /* Align with toggled items */
}

.toc-header-with-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toc-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    order: -1; /* Move to the left */
}

.toc-toggle:hover {
    background: var(--nav-hover);
    color: var(--text-primary);
}

.toc-toggle.expanded {
    transform: rotate(0deg);
}

.toc-toggle.collapsed {
    transform: rotate(0deg);
}

.toc-children {
    margin-left: 1.25rem; /* Reduced to account for toggle button */
    margin-top: 0.5rem;
    padding-left: 0;
    list-style: none;
    border-left: 2px solid var(--border-color);
    padding-left: 0.75rem;
    transition: all 0.3s ease;
    overflow: hidden;
}

.toc-children.collapsed {
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    opacity: 0;
}

.toc-children.expanded {
    max-height: 1000px;
    opacity: 1;
}

.toc-children .toc-link {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
}

.toc-children .toc-nested .toc-link {
    font-size: 0.82rem;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding: 0.3rem 0.6rem;
    margin-left: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.toc-link.main-header {
    font-weight: 600;
    flex: 1;
}

.toc-link.sub-header {
    font-weight: 500;
    flex: 1;
}

.toc-link.nested {
    font-weight: 450;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

/* Enhanced hover states for nested TOC items */
.toc-children .toc-nested .toc-link:hover,
.toc-link.nested:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-left-color: var(--accent-color);
    transform: translateX(3px);
    font-weight: 500;
}

.toc-children .toc-nested .toc-link:hover {
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===== NEXTRA-STYLE ENHANCEMENTS ===== */

/* Nextra-style scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Better selection styling */
::selection {
  background: var(--accent-light);
  color: var(--accent-color);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Enhanced keyboard shortcuts styling */
.content-area kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Loading states improvements */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-secondary);
  font-size: 1rem;
  text-align: center;
  font-weight: 500;
}

.loading::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--accent-color);
  border-radius: 50%;
  margin-right: 0.75rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Enhanced focus styles */
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Better transition for theme switch */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Nextra-style breadcrumb (if needed) */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 14px;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

.breadcrumb-separator {
  color: var(--text-muted);
}

/* Footer styling */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

/* Better mobile nav toggle */
.mobile-nav-toggle svg {
  width: 18px;
  height: 18px;
}

/* Enhanced search styling */
.search-icon svg {
  width: 16px;
  height: 16px;
}

/* Improve theme toggle icons */
.theme-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.theme-toggle:hover svg {
  transform: scale(1.1);
}

/* Better code block styling */
.content-area pre {
  position: relative;
}

.content-area pre:hover::after {
  content: "Copy";
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border-color);
  opacity: 0.8;
  cursor: pointer;
}

/* Nextra-style section dividers */
.content-area hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 3rem 0;
}

/* Better inline code */
.content-area :not(pre) > code {
  background: var(--accent-light);
  color: var(--accent-color);
  font-weight: 600;
}

/* Enhanced list styling */
.content-area ul li::marker {
  color: var(--accent-color);
}

.content-area ol li::marker {
  color: var(--accent-color);
  font-weight: 600;
}

/* Documentation buttons (GitHub, Releases, etc.) */
.button-group {
  display: flex;
  gap: 12px;
  margin: 24px 0;
  flex-wrap: wrap;
}

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

.doc-button:hover {
  border-color: var(--border-light);
  background: var(--nav-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.doc-button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.doc-button i {
  font-size: 16px;
  flex-shrink: 0;
}

.github-button {
  border-color: #333;
  background: #24292f;
  color: white;
}

.github-button:hover {
  background: #32383f;
  border-color: #444;
  color: white;
}

[data-theme="light"] .github-button {
  border-color: #d0d7de;
  background: #f6f8fa;
  color: #24292f;
}

[data-theme="light"] .github-button:hover {
  background: #f3f4f6;
  border-color: #d0d7de;
  color: #24292f;
}

.releases-button {
  border-color: var(--accent-color);
  background: var(--accent-light);
  color: var(--accent-color);
}

.releases-button:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-hover);
}

/* Mobile button adjustments */
@media (max-width: 768px) {
  .button-group {
    gap: 8px;
  }
  
  .doc-button {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .doc-button svg {
    width: 14px;
    height: 14px;
  }
  
  .doc-button i {
    font-size: 14px;
  }
}

/* Font Awesome icons in content */
.content-area h1 i,
.content-area h2 i,
.content-area h3 i,
.content-area h4 i,
.content-area h5 i,
.content-area h6 i {
  margin-right: 0.5rem;
  color: var(--accent-color);
}

.content-area li strong i {
  margin-right: 0.5rem;
  color: var(--accent-color);
  width: 16px;
  text-align: center;
}