/* Universal Table of Contents Styles
   ========================================== */

/* Desktop TOC Styles */
.toc-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.toc-sidebar h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold);
    margin-bottom: 1rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    color: #808080;
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 0.25rem 0;
    border-left: 2px solid transparent;
    padding-left: 1rem;
    transition: all 0.2s ease;
}

.toc-list a:hover {
    color: var(--gold);
    border-left-color: rgba(198, 156, 63, 0.3);
}

.toc-list a.active {
    color: var(--gold);
    font-weight: 600;
    border-left-color: var(--gold);
}

/* Mobile TOC Navigation */
.mobile-toc-nav {
    display: none;
}

@media (max-width: 991px) {
    .mobile-toc-nav {
        display: block !important;
    }
    
    .toc-sidebar {
        display: none;
    }
}

/* Mobile TOC Toggle Button */
.mobile-toc-toggle {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border: none;
    border-top: 1px solid var(--gold);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
}

.mobile-toc-toggle:active {
    background: linear-gradient(135deg, #222 0%, #111 100%);
}

.mobile-toc-toggle-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
}

.mobile-toc-label {
    font-size: 12px;
    color: #808080;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.mobile-toc-current {
    font-size: 14px;
    color: var(--gold);
    font-weight: 600;
    flex: 1;
    text-align: left;
    padding: 0 10px;
}

.mobile-toc-icon {
    color: var(--gold);
    transition: transform 0.3s ease;
}

.mobile-toc-nav.open .mobile-toc-icon {
    transform: rotate(180deg);
}

/* Mobile TOC Backdrop */
.mobile-toc-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.mobile-toc-nav.open .mobile-toc-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Mobile TOC Panel */
.mobile-toc-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border-top: 1px solid var(--gold);
    max-height: 70vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mobile-toc-nav.open .mobile-toc-panel {
    transform: translateY(0);
}

.mobile-toc-header {
    padding: 20px;
    border-bottom: 1px solid rgba(198, 156, 63, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.mobile-toc-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-toc-close {
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.mobile-toc-close:hover {
    opacity: 0.8;
}

.mobile-toc-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.mobile-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-toc-list li {
    margin-bottom: 0;
}

.mobile-toc-list a {
    display: block;
    padding: 15px;
    color: #b0b0b0;
    text-decoration: none;
    border-bottom: 1px solid rgba(198, 156, 63, 0.1);
    transition: all 0.2s ease;
    font-size: 14px;
    position: relative;
}

.mobile-toc-list a:hover {
    background: rgba(198, 156, 63, 0.1);
    color: var(--white);
    padding-left: 20px;
}

.mobile-toc-list a.active {
    color: var(--gold);
    font-weight: 600;
    background: rgba(198, 156, 63, 0.05);
}

.mobile-toc-list a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--gold);
}

/* Progress Bar (for mobile) */
.page-progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(198, 156, 63, 0.1);
    z-index: 1002;
}

.page-progress-bar .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gold) 0%, #b8872b 100%);
    width: 0;
    transition: width 0.2s ease;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .mobile-toc-toggle {
        padding: 10px 15px;
    }
    
    .mobile-toc-label {
        font-size: 11px;
    }
    
    .mobile-toc-current {
        font-size: 13px;
    }
    
    .mobile-toc-panel {
        max-height: 80vh;
    }
}