/*
 * ZephyrPHP Documentation Styles
 * Next.js-inspired design with dark header & sidebar
 */

/* ========================================
   CSS Variables / Design Tokens
   ======================================== */
:root {
    /* Colors - Full Dark Mode */
    --color-bg-primary: #0a0a0a;
    --color-bg-secondary: #111111;
    --color-bg-tertiary: #1a1a1a;

    --color-text-primary: #ededed;
    --color-text-secondary: #a1a1a1;
    --color-text-tertiary: #737373;
    --color-text-link: #3b82f6;
    --color-text-link-hover: #60a5fa;

    --color-border-default: #262626;
    --color-border-strong: #333333;

    --color-accent-primary: #3b82f6;
    --color-accent-hover: #60a5fa;
    --color-accent-subtle: #1e3a5f;

    /* Dark surfaces (header, sidebar) */
    --dark-bg: #0a0a0a;
    --dark-bg-secondary: #111111;
    --dark-bg-hover: #1a1a1a;
    --dark-bg-active: #1f1f1f;
    --dark-border: #1f1f1f;
    --dark-border-subtle: #262626;
    --dark-text-primary: #ededed;
    --dark-text-secondary: #888888;
    --dark-text-tertiary: #666666;

    /* Callouts - Dark Mode */
    --color-success: #10b981;
    --color-success-bg: #0a2e1f;
    --color-warning: #f59e0b;
    --color-warning-bg: #2d1f0a;
    --color-error: #ef4444;
    --color-error-bg: #2d0f0f;
    --color-info: #3b82f6;
    --color-info-bg: #0f1e2d;

    /* Code block */
    --code-bg: #0a0a0a;
    --code-header-bg: #111111;
    --code-border: #1f1f1f;
    --code-text: #e5e5e5;

    /* Typography */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-family-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1.0625rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.3;
    --line-height-base: 1.65;
    --line-height-relaxed: 1.75;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Layout */
    --header-height: 56px;
    --sidebar-width: 260px;
    --toc-width: 220px;
    --content-max-width: 768px;

    /* Borders & Shadows */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ========================================
   Base Reset
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body.sidebar-open {
    overflow: hidden;
}

/* ========================================
   Dark Header (Next.js style)
   ======================================== */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--dark-bg);
    border-bottom: 1px solid var(--dark-border);
    z-index: 1000;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 100%;
    padding: 0 var(--space-6);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--dark-text-primary);
    transition: background-color var(--transition-fast);
}

.mobile-toggle:hover {
    background-color: var(--dark-bg-hover);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
}

.brand-logo {
    height: 28px;
    width: auto;
    display: block;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: #ffffff;
    color: var(--dark-bg);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
}

.brand-text {
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
    color: var(--dark-text-primary);
    letter-spacing: -0.01em;
}

.brand-divider {
    width: 1px;
    height: 24px;
    background-color: var(--dark-border-subtle);
}

.brand-section {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--dark-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.brand-section:hover {
    color: var(--dark-text-primary);
}

.brand-version {
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    color: var(--dark-text-tertiary);
    background: var(--dark-bg-hover);
    border: 1px solid var(--dark-border-subtle);
    border-radius: 20px;
    padding: 2px 8px;
    letter-spacing: 0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.header-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--dark-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.header-nav-item:hover {
    color: var(--dark-text-primary);
    background-color: var(--dark-bg-hover);
}

.header-nav-item.active {
    color: var(--dark-text-primary);
}

/* ========================================
   Search Trigger (Dark header)
   ======================================== */
.search-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 7px 14px;
    background: var(--dark-bg-secondary);
    border: 1px solid var(--dark-border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--dark-text-tertiary);
    min-width: 220px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    font-family: var(--font-family-base);
}

.search-trigger:hover {
    border-color: #333;
    background: var(--dark-bg-hover);
}

.search-trigger svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.search-label {
    flex: 1;
    text-align: left;
}

.search-shortcut {
    font-family: var(--font-family-mono);
    font-size: 10px;
    padding: 2px 6px;
    border: 1px solid var(--dark-border-subtle);
    border-radius: var(--radius-sm);
    background: var(--dark-bg);
    color: var(--dark-text-tertiary);
    line-height: 1.3;
}

/* ========================================
   Three-Column Fixed Layout
   ======================================== */
.docs-layout {
    position: relative;
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* ========================================
   Dark Sidebar (Next.js style)
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--dark-bg);
    border-right: 1px solid var(--dark-border);
    z-index: 100;
}

.sidebar-inner {
    padding: var(--space-4) 0 var(--space-8);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Navigation Group */
.nav-group {
    /* No padding - handled by individual elements */
}

/* Section Title (non-accordion) */
.nav-section-title {
    padding: 4px var(--space-4);
    margin-bottom: 2px;
    font-family: var(--font-family-base);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888888;
}

/* Section Header Toggle Button (for accordion sections) */
.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 4px var(--space-4);
    margin-bottom: 2px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-family-base);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888888;
    transition: color var(--transition-fast);
}

.nav-group-toggle:hover {
    color: #ededed;
}

.nav-group-title {
    flex: 1;
    text-align: left;
}

.nav-chevron {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    color: #666666;
}

.nav-group-toggle[aria-expanded="false"] .nav-chevron {
    transform: rotate(-90deg);
}

/* Navigation List */
.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.nav-list.collapsed {
    max-height: 0 !important;
    overflow: hidden;
}

/* Navigation Links - Base Styling */
.nav-link {
    display: block;
    padding: 4px var(--space-4);
    font-size: 13px;
    font-weight: 400;
    color: #888888;
    text-decoration: none;
    transition: color 0.15s ease;
    position: relative;
}

.nav-link:hover {
    color: #ededed;
}

.nav-link.active {
    color: #ffffff;
}

/* Regular Navigation Groups (non-submenu) */
.nav-group:not(.has-submenu) .nav-list {
    margin-top: 4px;
}

.nav-group:not(.has-submenu) .nav-list > li {
    margin-bottom: 0;
}

/* Submenu Navigation Groups */
.nav-group.has-submenu .nav-list {
    margin-top: 4px;
    padding-left: var(--space-4);
    position: relative;
}

/* First item (Overview) in submenu */
.nav-group.has-submenu .nav-list > li:first-child {
    margin-bottom: 4px;
}

.nav-group.has-submenu .nav-list > li:first-child > .nav-link {
    font-weight: 500;
    padding-left: 0;
}

/* Submenu items (not first child) */
.nav-group.has-submenu .nav-list > li:not(:first-child) {
    position: relative;
    margin-bottom: 0;
}

/* Blue vertical line for submenu items */
.nav-group.has-submenu .nav-list > li:not(:first-child)::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #262626;
}

/* Active submenu item - blue line */
.nav-group.has-submenu .nav-list > li:not(:first-child):has(.nav-link.active)::before {
    background: #3b82f6;
}

/* Submenu item links - indented */
.nav-group.has-submenu .nav-list > li:not(:first-child) > .nav-link {
    padding-left: 20px;
    font-size: 13px;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* ========================================
   Main Content Area (Dark)
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-right: var(--toc-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--color-bg-primary);
}

.article {
    flex: 1;
    width: 100%;
    max-width: calc(var(--content-max-width) + var(--space-12) * 2);
    margin: 0 auto;
    padding: var(--space-8) var(--space-10) var(--space-16);
}

.article-content {
    max-width: var(--content-max-width);
}

/* ========================================
   Breadcrumbs
   ======================================== */
.breadcrumbs {
    margin-bottom: var(--space-6);
}

.breadcrumbs ol {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.breadcrumbs li {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    margin: 0;
}

.breadcrumbs a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--color-text-link);
}

.breadcrumb-sep {
    color: var(--color-border-strong);
    margin: 0 2px;
}

.breadcrumb-current {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
}

/* ========================================
   Right TOC Sidebar
   ======================================== */
.toc-sidebar {
    position: fixed;
    right: 0;
    top: var(--header-height);
    width: var(--toc-width);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: var(--space-8) var(--space-4) var(--space-8) var(--space-6);
    background-color: var(--color-bg-primary);
    z-index: 90;
}

.toc-sidebar.hidden {
    display: none;
}

.toc-title {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-primary);
    margin-bottom: var(--space-4);
}

.toc-nav {
    display: flex;
    flex-direction: column;
}

.toc-link {
    display: block;
    padding: 4px 0;
    font-size: 13px;
    color: var(--color-text-tertiary);
    text-decoration: none;
    line-height: 1.5;
    transition: color var(--transition-fast);
}

.toc-link:hover {
    color: var(--color-text-primary);
}

.toc-link.active {
    color: var(--color-accent-primary);
}

.toc-link.toc-h3 {
    padding-left: var(--space-4);
    font-size: 12px;
}

/* ========================================
   Typography
   ======================================== */
.article-content h1 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.03em;
}

.article-content h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-top: var(--space-12);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border-default);
    letter-spacing: -0.01em;
}

.article-content h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-top: var(--space-8);
    margin-bottom: var(--space-3);
}

.article-content h4 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-top: var(--space-6);
    margin-bottom: var(--space-2);
}

.article-content p {
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

.article-content .lead {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
    line-height: var(--line-height-relaxed);
}

.article-content a {
    color: var(--color-text-link);
    text-decoration: underline;
    text-decoration-color: rgba(0, 112, 243, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color var(--transition-fast);
}

.article-content a:hover {
    text-decoration-color: var(--color-text-link);
}

.article-content strong {
    font-weight: var(--font-weight-semibold);
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--color-border-default);
    margin: var(--space-10) 0;
}

/* Lists */
.article-content ul,
.article-content ol {
    margin-bottom: var(--space-4);
    padding-left: var(--space-6);
}

.article-content li {
    margin-bottom: var(--space-2);
    color: var(--color-text-primary);
}

.article-content li::marker {
    color: var(--color-text-tertiary);
}

/* Feature List with Checkmarks */
.feature-list {
    list-style: none;
    padding-left: 0;
}

.feature-list li {
    position: relative;
    padding-left: var(--space-6);
    margin-bottom: var(--space-3);
}

.feature-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.35em;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='3'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* ========================================
   Code Blocks
   ======================================== */
.article-content code {
    font-family: var(--font-family-mono);
    font-size: 0.875em;
}

.article-content :not(pre) > code {
    padding: 0.15em 0.4em;
    background-color: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    color: #60a5fa;
    font-size: 0.85em;
}

.article-content pre {
    position: relative;
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-content pre code {
    display: block;
    padding: 0;
    background: none;
    border: none;
    color: var(--code-text);
    font-size: var(--font-size-sm);
    line-height: 1.7;
}

/* Code Block with Header (filename) */
.code-block {
    position: relative;
    margin-bottom: var(--space-4);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--code-border);
    background: var(--code-bg);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    background: var(--code-header-bg);
    border-bottom: 1px solid var(--code-border);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    color: var(--dark-text-secondary);
}

.code-filename {
    color: var(--dark-text-secondary);
}

.code-lang {
    color: var(--dark-text-tertiary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.code-block pre {
    margin: 0;
    border: none;
    border-radius: 0;
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: #555;
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
    z-index: 2;
}

.code-block .copy-btn {
    top: var(--space-2);
}

pre:hover > .copy-btn,
.code-block:hover > .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: #262626;
    border-color: #333;
    color: #ccc;
}

.copy-btn .check-icon {
    display: none;
}

.copy-btn.copied .copy-icon {
    display: none;
}

.copy-btn.copied .check-icon {
    display: block;
}

.copy-btn.copied {
    opacity: 1;
    color: var(--color-success);
}

/* ========================================
   Tables
   ======================================== */
.article-content table {
    width: 100%;
    margin-bottom: var(--space-4);
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.article-content th,
.article-content td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--color-border-default);
}

.article-content th {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
}

.article-content tr:last-child td {
    border-bottom: none;
}

.article-content tr:hover td {
    background-color: var(--color-bg-secondary);
}

/* ========================================
   Info Boxes / Callouts
   ======================================== */
.info-box {
    margin-bottom: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    border-left: 4px solid;
}

.info-box-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-2);
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box.tip {
    background-color: var(--color-success-bg);
    border-left-color: var(--color-success);
}

.info-box.tip .info-box-title {
    color: #059669;
}

.info-box.warning {
    background-color: var(--color-warning-bg);
    border-left-color: var(--color-warning);
}

.info-box.warning .info-box-title {
    color: #d97706;
}

.info-box.danger {
    background-color: var(--color-error-bg);
    border-left-color: var(--color-error);
}

.info-box.danger .info-box-title {
    color: var(--color-error);
}

.info-box.info {
    background-color: var(--color-info-bg);
    border-left-color: var(--color-info);
}

.info-box.info .info-box-title {
    color: var(--color-accent-primary);
}

/* ========================================
   Method Badges
   ======================================== */
.method-badge {
    display: inline-block;
    padding: 2px 8px;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.method-get { background-color: #0a2e1f; color: #4ade80; border: 1px solid #166534; }
.method-post { background-color: #0f1e2d; color: #60a5fa; border: 1px solid #1e40af; }
.method-put { background-color: #2d1f0a; color: #fb923c; border: 1px solid #9a3412; }
.method-patch { background-color: #1e0f2d; color: #c084fc; border: 1px solid #6b21a8; }
.method-delete { background-color: #2d0f0f; color: #f87171; border: 1px solid #991b1b; }

/* ========================================
   Article Footer Navigation
   ======================================== */
.article-footer {
    margin-top: var(--space-12);
    padding-top: var(--space-8);
    border-top: 1px solid var(--color-border-default);
}

.footer-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
}

.footer-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    text-decoration: none;
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    flex: 0 1 auto;
    max-width: 48%;
}

.footer-nav-link:hover {
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 1px var(--color-accent-primary);
}

.footer-nav-link.next {
    margin-left: auto;
    text-align: right;
}

.footer-nav-link svg {
    flex-shrink: 0;
    color: var(--color-text-tertiary);
}

.footer-nav-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.footer-nav-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-nav-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-accent-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-nav-spacer {
    flex: 1;
}

/* ========================================
   Page Footer
   ======================================== */
.page-footer {
    padding: var(--space-6) var(--space-8);
    border-top: 1px solid var(--color-border-default);
    margin-top: auto;
}

.page-footer .footer-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
}

.page-footer p {
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    text-align: center;
}

/* ========================================
   Search Modal
   ======================================== */
.search-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.search-modal.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: min(20vh, 140px);
}

.search-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.search-dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 0 var(--space-4);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 1;
}

.search-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border-default);
}

.search-header svg {
    flex-shrink: 0;
    color: var(--color-text-tertiary);
}

.search-header input {
    flex: 1;
    border: none;
    outline: none;
    font-size: var(--font-size-base);
    font-family: var(--font-family-base);
    background: transparent;
    color: var(--color-text-primary);
}

.search-header input::placeholder {
    color: var(--color-text-tertiary);
}

.search-esc {
    font-family: var(--font-family-mono);
    font-size: 11px;
    padding: 2px 8px;
    border: 1px solid var(--color-border-default);
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.search-results {
    max-height: 360px;
    overflow-y: auto;
    padding: var(--space-2);
}

.search-empty {
    padding: var(--space-8) var(--space-4);
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
}

.search-result-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-primary);
    transition: background var(--transition-fast);
}

.search-result-item:hover,
.search-result-item.focused {
    background: var(--color-bg-secondary);
}

.search-result-section {
    font-size: var(--font-size-xs);
    color: var(--color-text-tertiary);
    font-weight: var(--font-weight-medium);
}

.search-result-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
}

.search-result-title mark {
    background: #fef08a;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* ========================================
   Responsive
   ======================================== */

/* Hide TOC on smaller screens */
@media (max-width: 1280px) {
    .main-content {
        margin-right: 0;
    }

    .toc-sidebar {
        display: none;
    }
}

@media (max-width: 1024px) {
    .article {
        padding: var(--space-6) var(--space-6) var(--space-12);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        margin-right: 0;
    }

    .mobile-toggle {
        display: flex;
    }

    .brand-divider,
    .brand-section,
    .brand-version {
        display: none;
    }

    .search-trigger {
        min-width: auto;
        padding: 7px 10px;
        background: transparent;
        border-color: transparent;
    }

    .search-label,
    .search-shortcut {
        display: none;
    }

    .header-nav-item:not([target="_blank"]) {
        display: none;
    }

    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform var(--transition-base);
        box-shadow: var(--shadow-lg);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .article {
        padding: var(--space-5);
    }

    .article-content h1 {
        font-size: var(--font-size-2xl);
    }

    .article-content h2 {
        font-size: var(--font-size-lg);
    }

    .breadcrumbs {
        margin-bottom: var(--space-4);
    }

    .footer-nav {
        flex-direction: column;
    }

    .footer-nav-link {
        max-width: 100%;
    }

    .footer-nav-link.next {
        margin-left: 0;
        text-align: left;
        flex-direction: row-reverse;
    }

    .article-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Adjust scroll-to-top button position on mobile */
    .scroll-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .scroll-to-top svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 var(--space-3);
    }

    .article {
        padding: var(--space-4);
    }

    .article-content pre {
        margin-left: calc(var(--space-4) * -1);
        margin-right: calc(var(--space-4) * -1);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .code-block {
        margin-left: calc(var(--space-4) * -1);
        margin-right: calc(var(--space-4) * -1);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .breadcrumbs {
        display: none;
    }
}

/* ========================================
   Scrollbars
   ======================================== */
.sidebar::-webkit-scrollbar,
.toc-sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 4px;
}

.toc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.toc-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--color-border-strong);
    border-radius: 4px;
}

.sidebar {
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.toc-sidebar {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}

pre::-webkit-scrollbar {
    height: 6px;
}

pre::-webkit-scrollbar-track {
    background: #111;
}

pre::-webkit-scrollbar-thumb {
    background-color: #333;
    border-radius: 4px;
}

.search-results::-webkit-scrollbar {
    width: 4px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background-color: var(--color-border-strong);
    border-radius: 4px;
}

/* ========================================
   Scroll to Top Button
   ======================================== */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg-secondary);
    border: 1px solid var(--dark-border-subtle);
    border-radius: var(--radius-lg);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-base);
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.scroll-to-top:hover {
    background: var(--dark-bg-hover);
    border-color: var(--color-accent-primary);
    transform: translateY(0);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top svg {
    width: 20px;
    height: 20px;
    color: var(--dark-text-secondary);
    transition: color var(--transition-fast);
}

.scroll-to-top:hover svg {
    color: var(--color-accent-primary);
}

/* ========================================
   Print
   ======================================== */
@media print {
    .top-header,
    .sidebar,
    .toc-sidebar,
    .article-footer,
    .page-footer,
    .search-modal,
    .copy-btn,
    .breadcrumbs,
    .scroll-to-top {
        display: none !important;
    }

    .docs-layout {
        display: block;
    }

    .main-content {
        border: none;
    }

    .article {
        max-width: 100%;
        padding: 0;
    }

    .article-content pre {
        white-space: pre-wrap;
        word-wrap: break-word;
    }
}
