/* Documentation Page Styles */

* {
    box-sizing: border-box;
}

/* Layout */

.doc-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "left"
        "content"
        "right";
    gap: 2rem;
    position: relative;
    max-width: 100%;
    width: 100%;
    align-items: start;
}

.doc-content {
    grid-area: content;
    align-self: start;
}

@media (min-width: 768px) {
    .doc-layout {
        grid-template-columns: 280px 1fr;
        grid-template-areas:
            "left content"
            "left content";
    }
}

@media (min-width: 1280px) {
    .doc-layout {
        grid-template-columns: 280px minmax(0, 1fr) 280px;
        grid-template-areas: "left content right";
        gap: 2rem;
    }
}

/* Sidebars */

.doc-sidebar {
    position: sticky;
    top: 5rem;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    scrollbar-width: thin;
}

.doc-sidebar::-webkit-scrollbar,
.doc-toc::-webkit-scrollbar {
    width: 4px;
}

.doc-sidebar::-webkit-scrollbar-track,
.doc-toc::-webkit-scrollbar-track {
    background: #020617;
}

.doc-sidebar::-webkit-scrollbar-thumb,
.doc-toc::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.35);
    border-radius: 999px;
}

/* Left navigation */

.doc-section-link {
    position: relative;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.doc-section-link.active {
    border-left-color: #38bdf8;
    background: rgba(56, 189, 248, 0.10);
    color: #bae6fd !important;
    padding-left: 1rem !important;
}

.doc-section-link.active:hover {
    background: rgba(56, 189, 248, 0.14) !important;
    color: #e0f2fe !important;
}

.doc-heading-label {
    opacity: 0.95;
    user-select: none;
    position: relative;
}

.doc-heading-label::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, transparent 0%, rgba(56, 189, 248, 0.08) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.doc-heading-label:hover::after {
    opacity: 1;
}

/* Content */

.doc-content-container {
    min-height: 500px;
    overflow: hidden;
}

.doc-content-section {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Right TOC */

#toc-sidebar {
    overflow-y: hidden;
}

.doc-toc-container {
    width: 100%;
    position: relative;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(15, 23, 42, 0.85);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
}

.doc-toc {
    padding: 1.25rem;
    max-height: calc(100vh - 7.5rem);
    overflow-y: auto;
    scrollbar-width: thin;
}

.doc-toc-title {
    margin-bottom: 0.75rem;
    color: #cbd5e1;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.doc-toc-item {
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.doc-toc-link {
    display: block;
    margin-left: -0.5rem;
    padding: 0.25rem 0 0.25rem 0.5rem;
    border-left: 2px solid transparent;
    color: #94a3b8;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.doc-toc-link.toc-h1 {
    font-size: 0.95rem;
    font-weight: 600;
}

.doc-toc-link.toc-h2 {
    font-size: 0.875rem;
    font-weight: 500;
}

.doc-toc-link.toc-h3 {
    font-size: 0.85rem;
}

.doc-toc-link.toc-h4,
.doc-toc-link.toc-h5 {
    color: #64748b;
    font-size: 0.8rem;
}

.doc-toc-link:hover,
.doc-toc-link.active {
    color: #7dd3fc;
    border-left-color: #38bdf8;
    font-weight: 500;
}

/* Code blocks */

pre {
    position: relative;
    margin: 1.5rem 0 !important;
    padding: 1.25rem !important;
    overflow-x: auto;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: #020617 !important;
}

pre code {
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Inline code */

.prose :where(code):not(:where([class~="not-prose"] *)) {
    color: #7dd3fc;
}

.markdown-content :not(pre) > code {
    border-radius: 0.45rem;
    border: 1px solid rgba(56, 189, 248, 0.18);
    background: rgba(2, 6, 23, 0.75);
    padding: 0.18rem 0.42rem;
    color: #7dd3fc;
    font-size: 0.9em;
    font-weight: 600;
}

.markdown-content :not(pre) > code::before,
.markdown-content :not(pre) > code::after {
    content: "";
}

/* Copy button */

.copy-button {
    position: absolute !important;
    top: 0.5rem;
    right: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 0.5rem;
    background-color: rgba(15, 23, 42, 0.9);
    color: #cbd5e1;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background-color: rgba(56, 189, 248, 0.12);
    color: #e0f2fe;
}

/* Markdown typography */

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    scroll-margin-top: 5rem;
    position: relative;
}

.markdown-content h1 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    color: #f8fafc;
    font-size: 2rem;
    font-weight: 700;
}

.markdown-content h2 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #f8fafc;
    font-size: 1.5rem;
    font-weight: 600;
}

.markdown-content h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: #f8fafc;
    font-size: 1.25rem;
    font-weight: 600;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
    font-weight: 500;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content li {
    color: #cbd5e1;
    line-height: 1.7;
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 1.5rem;
}

.markdown-content ul {
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content li {
    margin-bottom: 0.5rem;
    display: list-item;
}

.markdown-content a {
    color: #7dd3fc;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content blockquote {
    margin-left: 0;
    border-left: 4px solid #38bdf8;
    border-radius: 0 0.5rem 0.5rem 0;
    background: rgba(56, 189, 248, 0.08);
    color: #cbd5e1;
    padding: 0.75rem 1rem;
    font-style: italic;
}

/* Tables */

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    color: #cbd5e1;
}

.markdown-content table th {
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(15, 23, 42, 0.95);
    color: #f8fafc;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
}

.markdown-content table td {
    border: 1px solid rgba(255, 255, 255, 0.10);
    padding: 0.75rem;
}

.markdown-content table tr:nth-child(even),
.markdown-content table tr:nth-child(odd) {
    background: rgba(15, 23, 42, 0.55);
}

/* Callouts */

.markdown-content .callout {
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1.5rem 0;
    border-left: 4px solid;
}

.markdown-content .callout.info {
    background-color: rgba(59, 130, 246, 0.10);
    border-left-color: #3b82f6;
}

.markdown-content .callout.warning {
    background-color: rgba(245, 158, 11, 0.10);
    border-left-color: #f59e0b;
}

.markdown-content .callout.danger {
    background-color: rgba(239, 68, 68, 0.10);
    border-left-color: #ef4444;
}

.markdown-content .callout.success {
    background-color: rgba(16, 185, 129, 0.10);
    border-left-color: #10b981;
}

/* Mobile */

@media (max-width: 768px) {
    .doc-layout {
        width: 100%;
        overflow-x: hidden;
        padding: 0;
        gap: 1rem;
    }

    .doc-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        padding-top: 0;
    }

    .doc-sidebar > div {
        padding: 0.75rem;
    }

    .doc-toc-container {
        position: relative;
        top: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .doc-content,
    .doc-content-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .doc-content-container {
        padding: 0.75rem;
    }

    .markdown-content h1 {
        font-size: 1.75rem;
    }

    .markdown-content h2 {
        font-size: 1.35rem;
    }

    .markdown-content h3 {
        font-size: 1.15rem;
    }
}
