/* Docs Page Specific Styles */

:root {
    --sidebar-width: 280px;
    --header-height: 72px;
}

/* Navbar border on docs pages */
.docs-layout ~ #navbar,
body:has(.docs-layout) #navbar {
    border-bottom-color: var(--gray-200);
}

/* Documentation label above title */
.docs-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 1rem;
}

.docs-label:hover {
    color: var(--primary-dark, #3730a3);
}

/* Docs layout */
.docs-layout {
    display: flex;
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* Sidebar */
.docs-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
    padding: 0 0 2rem;
    overflow-y: auto;
    z-index: 50;
}

.sidebar-brand {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.sidebar-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar-search {
    display: none;
}

.sidebar-search .pagefind-search-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

.sidebar-search .pagefind-results {
    position: relative;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

@media (max-width: 900px) {
    .sidebar-search {
        display: block;
    }
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-heading {
    font-family: 'Cal Sans', 'Red Hat Text', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 1.5rem;
    margin-bottom: 0.5rem;
}

.sidebar-nav + .sidebar-heading {
    margin-top: 1.5rem;
}

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

.sidebar-nav li {
    margin: 0;
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem 1.5rem;
    color: var(--slate);
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

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

.sidebar-nav a.active {
    background: white;
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

/* Main content */
.docs-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
}

.docs-content {
    flex: 1;
    max-width: 800px;
    padding: 2rem 4rem 3rem;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-height));
}

.docs-body {
    flex: 1;
}

.docs-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.docs-content h2 {
    font-size: 1.75rem;
    margin-top: 3rem;
    margin-bottom: 1rem;
}

.docs-content h3 {
    font-size: 1.35rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.docs-content p {
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

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

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

/* Images */
.docs-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 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 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.docs-content th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.docs-content tr:hover {
    background: var(--gray-50);
}

.docs-content td {
    color: var(--slate);
}

/* Callout boxes */
.callout {
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
}

.callout svg {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-top: 0.1rem;
}

.callout-content p {
    margin-bottom: 0;
}

.callout-info {
    background: var(--slate);
    border: 1px solid var(--slate);
    color: white;
}

.callout-info svg {
    color: white;
}

.callout-info p {
    color: rgba(255, 255, 255, 0.9);
}

.callout-tip {
    background: rgba(60, 202, 71, 0.08);
    border: 1px solid rgba(60, 202, 71, 0.2);
}

.callout-tip svg {
    color: var(--secondary-dark);
}

/* Blockquote tips */
.docs-content blockquote {
    background: rgba(60, 202, 71, 0.08);
    border: 1px solid rgba(60, 202, 71, 0.2);
    border-left: 4px solid var(--secondary);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.docs-content blockquote p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.docs-content blockquote p:not(:last-child) {
    margin-bottom: 0.75rem;
}

/* Table of Contents */
.docs-toc {
    width: 260px;
    padding: 2rem 1.5rem;
    position: sticky;
    top: var(--header-height);
    height: fit-content;
    max-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
}

.docs-toc .toc-nav {
    overflow-y: auto;
    flex: 1;
    max-height: calc(100vh - var(--header-height) - 180px);
}

/* Pagefind Search */
#search {
    position: relative;
    margin-bottom: 1.5rem;
    z-index: 101;
}

.pagefind-search-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.pagefind-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 56, 203, 0.1);
}

.pagefind-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    margin-top: 0.5rem;
    z-index: 100;
    max-height: 500px;
    overflow-y: auto;
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    margin-top: 0.5rem;
    z-index: 100;
    max-height: 500px;
    overflow-y: auto;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s ease;
}

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

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-title {
    display: block;
    font-weight: 500;
    color: var(--ink);
    font-size: 0.9rem;
}

.search-result-cat {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.search-result-excerpt {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.search-result-excerpt mark {
    background: rgba(67, 56, 203, 0.15);
    color: var(--primary);
    padding: 0 0.15rem;
    border-radius: 2px;
}

.search-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.toc-title {
    font-family: 'Cal Sans', 'Red Hat Text', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.toc-nav {
    list-style: none;
}

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

.toc-nav a {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.25rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    margin-left: -0.75rem;
    transition: all 0.2s ease;
}

.toc-nav a:hover {
    color: var(--primary);
}

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

.toc-nav li.toc-indent {
    margin-left: 0.75rem;
}

.toc-nav li.toc-indent a {
    font-size: 0.85rem;
}

/* Heading anchors */
.heading-anchor {
    color: var(--gray-300);
    margin-left: 0.5rem;
    font-weight: 400;
    opacity: 0;
    transition: opacity 0.2s ease;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
    opacity: 1;
}

.heading-anchor:hover {
    color: var(--primary);
}

/* Page navigation */
.page-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

.page-nav-link {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    max-width: 45%;
    transition: all 0.3s ease;
    background: white;
}

.page-nav-link:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(67, 56, 203, 0.1);
}

.page-nav-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.page-nav-title {
    font-family: 'Cal Sans', 'Red Hat Text', sans-serif;
    font-size: 1rem;
    color: var(--ink);
}

.page-nav-link.next {
    text-align: right;
    margin-left: auto;
}

/* Mobile toggle */
.docs-mobile-toggle {
    display: none;
    position: fixed;
    top: calc(var(--header-height) + 1rem);
    right: 1rem;
    width: 44px;
    height: 44px;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(67, 56, 203, 0.3);
    z-index: 60;
    transition: transform 0.2s ease;
}

.docs-mobile-toggle:hover {
    transform: scale(1.05);
}

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

/* Overlay for mobile sidebar */
.docs-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 45;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.docs-overlay.visible {
    display: block;
    opacity: 1;
}

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

@media (max-width: 900px) {
    .docs-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .docs-main {
        margin-left: 0;
    }

    .docs-content {
        padding: 2rem;
    }

    .docs-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .docs-content {
        padding: 1.5rem;
    }

    .docs-content h1 {
        font-size: 2rem;
    }
}

/* Docs page footer - offset to align with main content */
footer {
    margin-left: var(--sidebar-width);
}

@media (max-width: 900px) {
    footer {
        margin-left: 0;
    }
}
