/* Documentation Specific Styles */
:root {
    --sidebar-width: 260px;
    --navigator-width: 240px;
    --header-height: 72px;
}

.docs-body {
    background-color: var(--surface);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Adjustments */
.nav-container {
    max-width: 1400px;
}

.docs-search-container {
    position: relative;
    width: 300px;
    margin: 0 1.5rem;
}

.docs-search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    background: var(--surface-low);
    border: 1px solid var(--surface-high);
    border-radius: var(--radius-md);
    color: var(--on-surface);
    font-size: 0.9rem;
    transition: var(--transition);
}

.docs-search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface-lowest);
    box-shadow: 0 0 0 4px var(--primary-container);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--on-surface-muted);
    pointer-events: none;
}

/* Mobile Menu Toggle */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--on-surface);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 0.5rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 26, 0.5);
    backdrop-filter: blur(4px);
    z-index: 900;
}

.sidebar-overlay.active {
    display: block;
}

/* Docs Container Layout */
.docs-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--navigator-width);
    gap: var(--space-xl);
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
    width: 100%;
    position: relative;
}

/* Sidebar */
.docs-sidebar {
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: var(--space-lg) var(--space-md) var(--space-xl) 0;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-high) transparent;
}

.docs-sidebar::-webkit-scrollbar {
    width: 4px;
}

.docs-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--surface-high);
    border-radius: 20px;
}

.sidebar-nav h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--on-surface-muted);
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.sidebar-nav h4:first-child { margin-top: 0; }

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--on-surface-muted);
}

.sidebar-nav a:hover {
    background: var(--surface-low);
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary-container);
    color: var(--primary);
    font-weight: 700;
}

/* Main Content */
.docs-content {
    max-width: 800px;
    width: 100%;
    min-width: 0; /* Prevents flex/grid overflow */
}

.docs-content h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 1.5rem;
}

.docs-content h2 {
    font-size: clamp(1.5rem, 4vw, 1.75rem);
    margin-top: 3rem;
    margin-bottom: 1.25rem;
    scroll-margin-top: 100px;
}

.docs-content h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    scroll-margin-top: 100px;
}

.docs-content p {
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    color: var(--on-surface);
}

.docs-content ul, .docs-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.docs-content li {
    margin-bottom: 0.5rem;
}

.docs-content img {
    border-radius: var(--radius-md);
    margin: 2rem 0;
    max-width: 100%;
    height: auto;
}

/* Responsive Tables */
.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.docs-content th, .docs-content td {
    padding: 0.75rem;
    border: 1px solid var(--surface-high);
    text-align: left;
}

.docs-content th {
    background: var(--surface-low);
    font-weight: 700;
}

.table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* Code Blocks */
pre {
    background: var(--surface-low);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1.5rem 0;
    border-left: 4px solid var(--primary);
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    background: var(--surface-low);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

pre code {
    padding: 0;
    background: none;
}

/* Navigator (On This Page) */
.docs-navigator {
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
    height: fit-content;
}

.navigator-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--on-surface-muted);
    margin-bottom: 1rem;
    font-weight: 700;
}

.navigator-list {
    list-style: none;
    border-left: 1px solid var(--surface-high);
}

.navigator-list li {
    padding-left: 1rem;
}

.navigator-list a {
    display: block;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--on-surface-muted);
}

.navigator-list a:hover {
    color: var(--primary);
}

/* Search Modal */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 26, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
}

.search-modal-container {
    max-width: 600px;
    width: 90%;
    margin: 100px auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-high);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--surface-high);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.modal-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--on-surface);
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
}

.search-modal-body {
    max-height: 450px;
    overflow-y: auto;
    padding: 0.5rem;
}

.search-results-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    padding: 1rem 0.75rem 0.5rem;
    font-weight: 700;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.search-result-item:hover, .search-result-item.selected {
    background: var(--primary-container);
}

.search-result-item h4 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--on-surface);
}

.search-result-item p {
    font-size: 0.8rem;
    margin: 0;
    color: var(--on-surface-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-modal-footer {
    padding: 0.75rem 1.25rem;
    background: var(--surface-low);
    border-top: 1px solid var(--surface-high);
    display: flex;
    gap: 1.5rem;
    font-size: 0.7rem;
    color: var(--on-surface-muted);
}

.search-modal-footer kbd {
    background: var(--surface-high);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

/* Footer */
.docs-footer {
    border-top: 1px solid var(--surface-high);
    background: var(--surface-low);
    padding: var(--space-xl) 0 var(--space-lg);
    margin-top: auto;
    width: 100%;
}

.docs-footer .footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.docs-footer .footer-brand p {
    color: var(--on-surface-muted);
    margin-top: 1rem;
    max-width: 300px;
}

.docs-footer .footer-links {
    display: flex;
    gap: var(--space-xl);
}

.docs-footer h4 {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.docs-footer .link-group a {
    display: block;
    color: var(--on-surface-muted);
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: var(--transition);
}

.docs-footer .link-group a:hover {
    color: var(--primary);
}

.docs-footer .footer-bottom {
    border-top: 1px solid var(--surface-high);
    padding-top: var(--space-lg);
    display: flex;
    justify-content: space-between;
    color: var(--on-surface-muted);
    font-size: 0.875rem;
}

/* Breakpoints */

@media (max-width: 1200px) {
    .docs-container {
        grid-template-columns: var(--sidebar-width) 1fr;
        gap: var(--space-lg);
    }
    .docs-navigator {
        display: none;
    }
}

@media (max-width: 992px) {
    .docs-search-container {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .docs-search-container {
        display: none; /* Hide standard search, maybe add a search button instead */
    }

    .docs-container {
        grid-template-columns: 1fr;
        padding-top: var(--space-lg);
    }

    .docs-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--sidebar-width);
        background: var(--surface);
        z-index: 1000;
        padding: 2rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        height: 100vh;
    }

    .docs-sidebar.active {
        transform: translateX(0);
    }

    .docs-footer .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .docs-footer .footer-links {
        flex-direction: column;
        gap: var(--space-lg);
    }

    .docs-footer .footer-bottom {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo-text {
        display: none;
    }
    
    .docs-content h1 {
        font-size: 2rem;
    }

    .docs-body header .container {
        padding: 0 var(--space-md);
    }
}
