/* CSS Variables for Theming */
:root {
    /* Light Theme Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-code: #f6f8fa;
    --text-primary: #24292e;
    --text-secondary: #586069;
    --text-muted: #6a737d;
    --border-color: #e1e4e8;
    --link-color: #0366d6;
    --link-hover: #0056b3;
    --accent-color: #0366d6;
    --header-bg: #ffffff;
    --sidebar-bg: #f8f9fa;
    --code-bg: #1e1e1e;
    --inline-code-bg: #f3f4f6;
    --inline-code-text: #d73a49;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark Theme Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-code: #161b22;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --link-color: #58a6ff;
    --link-hover: #79c0ff;
    --accent-color: #58a6ff;
    --header-bg: #161b22;
    --sidebar-bg: #0d1117;
    --code-bg: #1e1e1e;
    --inline-code-bg: #161b22;
    --inline-code-text: #ff7b72;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header Styles */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.125rem;
    transition: color 0.2s;
}

.brand-link:hover {
    color: var(--accent-color);
}

.separator {
    color: var(--text-muted);
    user-select: none;
}

.doc-title {
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent-color);
}

.sun-icon,
.moon-icon {
    display: none;
}

[data-theme="light"] .sun-icon,
[data-theme="dark"] .moon-icon {
    display: block;
}

.cta-button {
    background-color: var(--accent-color);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.cta-button:hover {
    background-color: var(--link-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Container Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    padding: 2rem;
    min-height: calc(100vh - 72px);
}

/* Sidebar Styles */
.sidebar {
    position: sticky;
    top: 88px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background-color: var(--sidebar-bg);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

.sidebar-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.toc {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toc a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

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

.toc a.active {
    background-color: var(--bg-primary);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 500;
}

.toc a.toc-level-2 {
    padding-left: 1.75rem;
    font-size: 0.8125rem;
}

.toc a.toc-level-3 {
    padding-left: 2.75rem;
    font-size: 0.75rem;
}

/* Main Content Styles */
.main-content {
    max-width: 100%;
    overflow-x: hidden;
}

.version-notice {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.version-badge {
    background-color: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.update-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Documentation Content */
.documentation {
    background-color: var(--bg-primary);
    border-radius: 0.5rem;
    padding: 2rem;
}

.documentation h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.documentation h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    scroll-margin-top: 100px;
}

.documentation h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    scroll-margin-top: 100px;
}

.documentation h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.documentation p {
    margin-bottom: 1rem;
    line-height: 1.75;
    color: var(--text-primary);
}

.documentation a {
    color: var(--link-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.documentation a:hover {
    color: var(--link-hover);
    border-bottom-color: var(--link-hover);
}

.documentation ul,
.documentation ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.documentation li {
    margin-bottom: 0.5rem;
    line-height: 1.75;
}

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

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

/* Code Styles */
.documentation code {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.875rem;
}

.documentation p code,
.documentation li code,
.documentation td code {
    background-color: var(--inline-code-bg);
    color: var(--inline-code-text);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.85em;
}

.documentation pre {
    background-color: var(--code-bg);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    position: relative;
}

.documentation pre code {
    background: none;
    color: #d4d4d4;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Copy Button for Code Blocks */
.code-container {
    position: relative;
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: #8b949e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #c9d1d9;
}

.copy-button.copied {
    background-color: #238636;
    color: white;
    border-color: #238636;
}

/* Tables */
.documentation table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    overflow: hidden;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

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

.documentation td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.documentation tbody tr:hover {
    background-color: var(--bg-secondary);
}

/* Blockquotes */
.documentation blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Footer */
.content-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-links {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

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

.footer-copyright {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sidebar {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 2rem;
    }
    
    .documentation h1 {
        font-size: 2rem;
    }
    
    .documentation h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 640px) {
    .nav-container {
        padding: 1rem;
    }
    
    .nav-brand {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .separator {
        display: none;
    }
    
    .container {
        padding: 1rem;
    }
    
    .documentation {
        padding: 1rem;
    }
    
    .documentation h1 {
        font-size: 1.75rem;
    }
}

/* Smooth Scrolling for Anchor Links */
html {
    scroll-padding-top: 100px;
}

/* Print Styles */
@media print {
    .header,
    .sidebar,
    .version-notice,
    .content-footer,
    .copy-button {
        display: none;
    }
    
    .container {
        display: block;
        max-width: 100%;
    }
    
    .documentation {
        padding: 0;
    }
}