/* Table of Contents Styles */

.toc-container {
    position: fixed;
    right: 20px;
    top: 15%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100;
}

/* Mobile TOC Toggle Button */
.toc-toggle {
    display: none;
    position: fixed;
    right: 20px;
    top: 120px;
    background: #002956;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    z-index: 101;
    font-size: 14px;
}

.toc-toggle:hover {
    background: #004a9f;
}

/* TOC Header */
.toc-header {
    font-size: 16px;
    font-weight: bold;
    color: #002956;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f5c8bb;
}

/* Simple TOC item style */
.toc-item {
    display: block;
    padding: 8px 10px;
    background: #f8f8f8;
    border-left: 3px solid transparent;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toc-item:hover {
    background: #e9f5ff;
    border-left-color: #004a9f;
    padding-left: 15px;
}

.toc-item.active {
    background: #002956;
    color: white;
    border-left-color: #f5c8bb;
}

/* TOC List Styles */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list > li {
    margin-bottom: 10px;
}

.toc-list > li > a {
    display: block;
    padding: 8px 10px;
    background: #f8f8f8;
    border-left: 3px solid transparent;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toc-list > li > a:hover {
    background: #e9f5ff;
    border-left-color: #004a9f;
    padding-left: 15px;
}

/* Active Section */
.toc-list > li > a.active {
    background: #002956;
    color: white;
    border-left-color: #f5c8bb;
}

/* Sub-sections */
.toc-sublist {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.toc-sublist.expanded {
    max-height: 300px;
}

.toc-sublist li {
    margin: 0;
}

.toc-sublist a {
    display: block;
    padding: 5px 10px 5px 25px;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}

.toc-sublist a:hover {
    color: #004a9f;
    background: #f0f8ff;
    padding-left: 30px;
}

/* Expand/Collapse Icon */
.toc-expand-icon {
    float: right;
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease;
}

.toc-expand-icon.expanded {
    transform: rotate(90deg);
}

/* Color-coded sections matching table headers */
.toc-risk-explorer {
    border-left-color: #f5c8bb !important;
}

.toc-risk-assessment {
    border-left-color: #ffbb99 !important;
}

.toc-dashboards {
    border-left-color: #b8862b !important;
}

.toc-visualizations {
    border-left-color: #a87324 !important;
}

.toc-methodology {
    border-left-color: #e9b366 !important;
}

.toc-framework {
    border-left-color: #e9f5c8 !important;
}

/* Scroll Spy Indicator */
.toc-progress {
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    background: #004a9f;
    transition: height 0.3s ease;
    border-radius: 1px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .toc-container {
        right: 10px;
        width: 220px;
        padding: 15px;
    }
}

@media (max-width: 992px) {
    .toc-toggle {
        display: block;
    }
    
    .toc-container {
        display: none;
        position: fixed;
        top: 60px;
        right: 0;
        width: 280px;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        padding: 20px;
    }
    
    .toc-container.mobile-open {
        display: block;
    }
    
    /* Overlay when TOC is open on mobile */
    .toc-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    
    .toc-overlay.active {
        display: block;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Add scroll padding to account for fixed header */
.resource-table {
    scroll-margin-top: 80px;
}

/* Quick Links Style (Alternative TOC) */
.quick-links-bar {
    background: #f8f8f8;
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    text-align: center;
    position: sticky;
    top: 60px;
    z-index: 50;
}

.quick-links-bar a {
    display: inline-block;
    padding: 5px 15px;
    margin: 0 5px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
}

.quick-links-bar a:hover {
    background: #004a9f;
    color: white;
    border-color: #004a9f;
}

.quick-links-bar a.active {
    background: #002956;
    color: white;
    border-color: #002956;
}