/* Table of Contents Styles */
.toc-wrapper {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toc-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
    border-bottom: 2px solid #007cba;
    padding-bottom: 8px;
}

.toc-nav {
    margin: 0;
}

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

.toc-item {
    margin: 0;
    padding: 0;
}

.toc-link {
    display: block;
    padding: 8px 12px;
    color: #495057;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toc-link:hover {
    background-color: #e9ecef;
    color: #212529;
    text-decoration: none;
}

.toc-link.active {
    background-color: #007cba;
    color: white;
    font-weight: 500;
}

.toc-empty {
    color: #6c757d;
    font-style: italic;
    margin: 0;
    text-align: center;
    padding: 20px;
}

.toc-loading {
    color: #6c757d;
    font-style: italic;
    margin: 0;
    text-align: center;
    padding: 20px;
}

/* Sticky TOC */
.toc-sticky {
    position: sticky;
    top: 20px;
    z-index: 100;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toc-wrapper {
        padding: 15px;
        margin: 15px 0;
    }

    .toc-title {
        font-size: 1.1rem;
    }

    .toc-link {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

/* Scrollbar styling for TOC with max-height */
.toc-wrapper::-webkit-scrollbar {
    width: 6px;
}

.toc-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.toc-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.toc-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation for smooth transitions */
.toc-link {
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.toc-link:hover {
    transform: translateX(2px);
}

/* Focus states for accessibility */
.toc-link:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .toc-wrapper {
        break-inside: avoid;
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
    }

    .toc-link {
        color: #333;
    }

    .toc-link:hover,
    .toc-link.active {
        background: none;
        color: #333;
    }
}

