/* ============================================
   Docs Page Layout
   ============================================ */
.docs-body {
    overflow: hidden;
}

.docs-layout {
    display: flex;
    height: 100vh;
    padding-top: var(--nav-height);
}

/* ============================================
   Sidebar
   ============================================ */
.docs-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--color-bg-white);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    position: sticky;
    top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
}

.docs-sidebar-inner {
    padding: 24px 16px 40px;
}

.docs-nav-section {
    margin-bottom: 28px;
}

.docs-nav-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: 10px;
    padding: 0 10px;
}

.docs-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 2px;
}

.docs-nav-item:hover {
    color: var(--color-text);
    background: var(--color-bg-alt);
}

.docs-nav-item.active {
    color: var(--color-primary);
    background: rgba(217, 119, 87, 0.08);
    font-weight: 600;
}

.docs-nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.65;
}

.docs-nav-item.active .docs-nav-icon {
    opacity: 1;
    stroke: var(--color-primary);
}

/* TOC */
.docs-toc-section {
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
}

.docs-toc-item {
    display: block;
    font-size: 0.825rem;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 4px 10px;
    border-left: 2px solid transparent;
    transition: var(--transition);
    line-height: 1.5;
    margin-bottom: 1px;
}

.docs-toc-item:hover {
    color: var(--color-text-secondary);
    border-left-color: var(--color-border);
}

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

.docs-toc-item.toc-h3 {
    padding-left: 22px;
    font-size: 0.8rem;
}

/* ============================================
   Content Area
   ============================================ */
.docs-content {
    flex: 1;
    overflow-y: auto;
    background: var(--color-bg);
}

.docs-content-inner {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 48px 80px;
}

/* Loading */
.docs-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.docs-loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error */
.docs-error {
    text-align: center;
    padding: 80px 0;
}

.docs-error h2 {
    text-align: center;
    color: var(--color-text);
}

.docs-error-detail {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ============================================
   Markdown Content Styling
   ============================================ */
.docs-article {
    color: var(--color-text);
    line-height: 1.75;
    font-size: 0.95rem;
}

.docs-article h1 {
    font-size: 2rem;
    font-weight: 750;
    color: var(--color-text);
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-border);
    letter-spacing: -0.02em;
}

.docs-article h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 48px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
    letter-spacing: -0.01em;
    text-align: left;
}

.docs-article h3 {
    font-size: 1.2rem;
    font-weight: 650;
    color: var(--color-text);
    margin: 32px 0 12px;
}

.docs-article h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 24px 0 8px;
}

.docs-article p {
    margin: 0 0 16px;
}

.docs-article a {
    color: var(--color-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

.docs-article a:hover {
    border-bottom-color: var(--color-primary);
}

.docs-article strong {
    font-weight: 650;
    color: var(--color-text);
}

.docs-article img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: 8px 0;
}

/* Lists */
.docs-article ul,
.docs-article ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.docs-article li {
    margin-bottom: 6px;
}

.docs-article li > ul,
.docs-article li > ol {
    margin-top: 6px;
    margin-bottom: 0;
}

/* Code */
.docs-article code {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.85em;
    background: var(--color-bg-alt);
    color: var(--color-primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.docs-article pre {
    margin: 0 0 16px;
    padding: 16px 20px;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
    border: 1px solid rgba(255,255,255,0.06);
}

.docs-article pre code {
    background: none;
    color: inherit;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: inherit;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    margin: 0 0 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.docs-article table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.docs-article thead {
    background: var(--color-bg-alt);
}

.docs-article th {
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    white-space: nowrap;
}

.docs-article td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

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

.docs-article tr:hover td {
    background: rgba(245, 243, 237, 0.5);
}

/* Blockquotes */
.docs-article blockquote {
    margin: 0 0 16px;
    padding: 12px 20px;
    border-left: 4px solid var(--color-primary);
    background: rgba(217, 119, 87, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-text-secondary);
}

.docs-article blockquote p:last-child {
    margin-bottom: 0;
}

/* Horizontal rule */
.docs-article hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 32px 0;
}

/* ============================================
   Nav active link
   ============================================ */
.nav-link-active {
    color: var(--color-primary) !important;
    font-weight: 600 !important;
}

/* ============================================
   Mobile sidebar toggle
   ============================================ */
.docs-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 50;
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.docs-sidebar-toggle svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .docs-sidebar {
        width: 260px;
    }

    .docs-content-inner {
        padding: 32px 28px 60px;
    }
}

@media (max-width: 768px) {
    .docs-sidebar {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        bottom: 0;
        z-index: 40;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: none;
    }

    .docs-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    }

    .docs-sidebar-toggle {
        display: flex;
    }

    .docs-content-inner {
        padding: 24px 20px 60px;
    }

    .docs-article h2 {
        font-size: 1.3rem;
        margin-top: 36px;
    }

    .docs-article h3 {
        font-size: 1.1rem;
    }

    .docs-article pre {
        font-size: 0.8rem;
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    .docs-content-inner {
        padding: 20px 16px 60px;
    }
}
