/* Sticky Table of Contents */
.doc-toc {
    position: sticky;
    top: 100px; /* Below header */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Smooth scrolling for TOC links */
.doc-toc a {
    scroll-margin-top: 100px;
}

/* Highlight active TOC item based on scroll position */
.doc-toc-link.active {
    color: var(--color-accent, #6366f1) !important;
    font-weight: 600;
}

.doc-toc-link.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--color-accent, #6366f1);
    border-radius: 2px;
}

/* Reading position indicator in TOC */
.doc-toc-link {
    position: relative;
    transition: all 0.2s ease;
}

.doc-toc-link:hover {
    color: var(--color-accent, #6366f1) !important;
}

/* Scrollbar styling for TOC */
.doc-toc::-webkit-scrollbar {
    width: 6px;
}

.doc-toc::-webkit-scrollbar-track {
    background: transparent;
}

.doc-toc::-webkit-scrollbar-thumb {
    background: var(--color-border, #e2e8f0);
    border-radius: 3px;
}

.doc-toc::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted, #64748b);
}

/* Hide TOC on mobile if needed */
@media (max-width: 1024px) {
    .doc-toc {
        position: static;
        max-height: none;
    }
}
