:root {
    --bg-color: #050505;
    --sidebar-bg: #0d1117;
    --glass-bg: rgba(22, 27, 34, 0.85);
    --glass-border: rgba(48, 54, 61, 0.6);
    --primary: #3fb950;
    --primary-glow: rgba(63, 185, 80, 0.3);
    --secondary: #58a6ff;
    --text-main: #e6edf3;
    --text-dim: #8b949e;
    --code-bg: #161b22;
    --accent: #bc8cff;
    --warning: #d29922;
    --danger: #f85149;
    --sidebar-width: 300px;
    
    /* Flowchart Variables */
    --color-border-primary: rgba(48, 54, 61, 0.8);
    --color-border-secondary: rgba(88, 166, 255, 0.4);
    --color-border-tertiary: rgba(255, 255, 255, 0.1);
    --color-text-secondary: #8b949e;
}

/* Flowchart SVG Classes */
.c-gray rect { stroke: #8b949e; fill: rgba(139, 148, 158, 0.1); }
.c-blue rect { stroke: #58a6ff; fill: rgba(88, 166, 255, 0.1); }
.c-teal rect { stroke: #3fb950; fill: rgba(63, 185, 80, 0.1); }
.c-purple rect { stroke: #bc8cff; fill: rgba(188, 140, 255, 0.1); }
.c-amber rect { stroke: #d29922; fill: rgba(210, 153, 34, 0.1); }
.c-green rect { stroke: #3fb950; fill: rgba(63, 185, 80, 0.2); }
.c-coral rect { stroke: #f85149; fill: rgba(248, 81, 73, 0.1); }

.th { fill: #e6edf3; font-weight: 600; font-size: 13px; }
.ts { fill: #8b949e; font-size: 11px; }

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, .logo-text { font-family: 'Outfit', sans-serif; color: #f0f6fc; }

#neural-bg {
    position: fixed; inset: 0; z-index: -1; opacity: 0.15; pointer-events: none;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    background: var(--sidebar-bg);
    z-index: 1000;
    flex-shrink: 0;
}

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

.logo-area {
    padding: 1.25rem 1rem;
    display: flex; align-items: center; gap: 0.6rem;
    border-bottom: 1px solid var(--glass-border);
}
.logo-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    transition: opacity 0.2s;
}
.logo-link:hover { opacity: 0.85; }
.logo-img { height: 28px; width: auto; }
.logo-text { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.5px; }
.version-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: rgba(63, 185, 80, 0.15);
    color: var(--primary);
    border-radius: 4px;
    margin-left: auto;
}

.sidebar-search { padding: 0.75rem 1rem; position: relative; }
.sidebar-search input {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 2rem;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: #fff;
    font-size: 0.85rem;
}
.sidebar-search input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}
.search-hint {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    color: var(--text-dim);
    background: var(--code-bg);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    border: 1px solid var(--glass-border);
    pointer-events: none;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.5rem 0.75rem 1.5rem; }
.nav-group { margin-bottom: 1.25rem; }
.nav-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
    padding: 0 0.5rem;
}
.nav-list { list-style: none; }
.nav-list a {
    display: block;
    padding: 0.35rem 0.5rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.82rem;
    border-radius: 4px;
    transition: all 0.15s;
}
.nav-list a:hover { color: var(--secondary); background: rgba(88, 166, 255, 0.08); }
.nav-list a.active {
    color: var(--primary);
    background: rgba(63, 185, 80, 0.1);
    font-weight: 500;
}

/* Search results dropdown */
.search-results {
    display: none;
    position: absolute;
    left: 1rem; right: 1rem;
    top: calc(100% - 0.25rem);
    max-height: 280px;
    overflow-y: auto;
    background: var(--sidebar-bg);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    z-index: 1001;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.search-results.visible { display: block; }
.search-result-item {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(48, 54, 61, 0.3);
}
.search-result-item:hover { background: rgba(88, 166, 255, 0.08); color: #fff; }
.search-result-item strong { color: var(--secondary); display: block; font-size: 0.75rem; }

/* Mobile toggle */
.mobile-nav-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1002;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #000;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--primary-glow);
}

/* Main content */
.main-content {
    flex: 1;
    padding: 3rem 4rem 6rem;
    max-width: 960px;
    min-width: 0;
}

.doc-block { margin-bottom: 5rem; scroll-margin-top: 2rem; }
.page-title { font-size: 2.75rem; font-weight: 800; margin-bottom: 1rem; line-height: 1.15; }
.lead { font-size: 1.1rem; color: var(--text-dim); margin-bottom: 2rem; max-width: 720px; }

.section-title {
    font-size: 1.75rem;
    margin: 2.5rem 0 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    scroll-margin-top: 2rem;
}
.section-title .anchor-link,
.subsection-title .anchor-link {
    opacity: 0;
    margin-left: 0.5rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85em;
}
.section-title:hover .anchor-link,
.subsection-title:hover .anchor-link { opacity: 1; }

.subsection-title {
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
    color: #c9d1d9;
    scroll-margin-top: 2rem;
}

p { margin-bottom: 1rem; color: var(--text-dim); }
p strong, li strong { color: var(--text-main); }
a { color: var(--secondary); }
code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88em;
    background: rgba(255,255,255,0.06);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    color: var(--accent);
}

/* Cards & grids */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.info-card { padding: 1.25rem; }
.info-card h3 { margin-bottom: 0.5rem; color: var(--primary); font-size: 1rem; }
.info-card p { font-size: 0.88rem; margin: 0; }

/* Method blocks */
.method-block {
    padding: 1.5rem;
    margin: 1.5rem 0;
}
.method-sig {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: var(--secondary);
    background: rgba(0,0,0,0.35);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.method-desc { margin-bottom: 1rem; font-size: 0.92rem; }

/* Tables */
.param-table, .exhaustive-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 1rem 0; }
.param-table th, .exhaustive-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--glass-border);
    color: #fff;
    font-weight: 600;
    background: rgba(255,255,255,0.02);
}
.param-table td, .exhaustive-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid rgba(48, 54, 61, 0.35);
    vertical-align: top;
}
.param-table td:first-child, .exhaustive-table td:first-child {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    white-space: nowrap;
}
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.group-row td {
    background: rgba(56, 139, 253, 0.08);
    color: var(--secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

/* Callouts */
.callout {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-size: 0.9rem;
    border-left: 3px solid;
}
.callout-info { background: rgba(88, 166, 255, 0.08); border-color: var(--secondary); }
.callout-warning { background: rgba(210, 153, 34, 0.08); border-color: var(--warning); }
.callout-danger { background: rgba(248, 81, 73, 0.08); border-color: var(--danger); }
.callout-title { font-weight: 600; color: #fff; margin-bottom: 0.35rem; }

/* Code blocks */
.code-example {
    margin: 1rem 0;
    background: var(--code-bg);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.72rem;
    color: var(--text-dim);
}
.copy-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
}
.copy-btn:hover { color: #fff; border-color: var(--secondary); }
.copy-btn.copied { color: var(--primary); border-color: var(--primary); }
pre { padding: 1rem !important; margin: 0 !important; background: transparent !important; overflow-x: auto; }
pre code { background: none; padding: 0; color: inherit; font-size: 0.82rem; }

/* Mermaid & Diagrams */
.mermaid-wrap {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

/* Lists */
.step-list, .field-list { margin: 1rem 0 1rem 1.25rem; color: var(--text-dim); }
.step-list li, .field-list li { margin-bottom: 0.5rem; }
.step-list li::marker { color: var(--primary); }

/* Compare table */
.compare-table td:nth-child(2),
.compare-table td:nth-child(3),
.compare-table td:nth-child(4) { text-align: center; }
.yes { color: var(--primary); }
.no { color: var(--danger); }
.partial { color: var(--warning); }

/* Footer */
.main-footer {
    padding: 3rem 0 2rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 1100px) {
    .main-content { padding: 2rem 1.5rem 4rem; }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.25s ease;
        width: min(320px, 85vw);
    }
    .sidebar.open { left: 0; }
    .sidebar-overlay.visible { display: block; }
    .mobile-nav-toggle { display: flex; align-items: center; justify-content: center; }
    .main-content { padding: 1.5rem 1rem 5rem; }
    .page-title { font-size: 2rem; }
}
