/* ===================================================================
 * # Table of Contents - Sticky Navigation Styles
 * Extracted from blog-post.css for easier management
 * ------------------------------------------------------------------- */

/* Post Banner - Fixed TOC Navigation */
.post-banner {
    position: fixed;
    top: 0;
    left: var(--toc-width);
    right: 0;
    background: var(--bg-light);
    border-bottom: 3px solid var(--accent-primary);
    padding: 0.75rem 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    width: var(--blog-post-width);
}

.toc-container {
    max-width: var(--blog-post-width, 800px);
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    /* border-bottom: 3px solid var(--accent-primary, #0C2E7E);*/
    padding: 0.75rem 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    width: var(--blog-post-width, 100%);
}

.toc-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.toc-columns ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.toc-columns li {
    margin: 0;
    padding: 0 0.75rem;
    border-right: 2px solid var(--primary-color, #0C2E7E);
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.toc-columns li:last-child {
    border-right: none;
}

.toc-columns li:hover {
    background-color: var(--primary-light, rgba(12, 46, 126, 0.1));
}

.toc-columns a {
    color: var(--text-color, #333);
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    white-space: nowrap;
    display: block;
    line-height: 1.2;
    padding: 0.25rem 0;
}

.toc-columns a:hover {
    color: var(--primary-color, #0C2E7E);
    transform: translateX(2px);
}

/* Mobile TOC Toggle Button */
.mobile-toc-toggle {
    display: none;
    position: fixed;
    top: 70px; /* Below the mobile header */
    right: 1rem;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.mobile-toc-toggle:hover {
    background: var(--accent-primary);
    transform: scale(1.05);
}

.mobile-toc-toggle i {
    font-size: 1.2rem;
}

/* Mobile TOC Content */
.mobile-toc-content {
    display: none;
    position: fixed;
    top: 130px; /* Below the toggle button */
    right: 1rem;
    left: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    padding: 1rem;
    z-index: 1000;
    max-height: 60vh;
    overflow-y: auto;
}

.mobile-toc-content.show {
    display: block;
}

.mobile-toc-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    text-align: center;
}

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

.mobile-toc-content li {
    margin: 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.mobile-toc-content li:last-child {
    border-bottom: none;
}

.mobile-toc-content a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    display: block;
    transition: color 0.2s ease;
}

.mobile-toc-content a:hover {
    color: var(--primary-color);
}

/* Sticky TOC Styles */
.sticky-toc {
    position: sticky;
    top: 2rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    z-index: 100;
}

.sticky-toc h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--color-1, #0C2E7E);
    font-weight: 600;
}

.sticky-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.sticky-toc li {
    margin: 0;
    padding: 0.5rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sticky-toc li:hover {
    border-left-color: var(--color-1, #0C2E7E);
    background-color: rgba(12, 46, 126, 0.05);
}

.sticky-toc a {
    color: var(--color-text, #333);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    display: block;
    transition: color 0.2s ease;
}

.sticky-toc a:hover {
    color: var(--color-1, #0C2E7E);
}

/* Responsive adjustments for TOC */
@media screen and (max-width: 1024px) {
    .post-banner {
        left: calc(var(--toc-width) * 0.8);
        width: calc(100% - (var(--toc-width) * 0.8));
    }

    .toc-container {
        max-width: 800px;
        margin: 0 auto;
        padding: 1rem;
    }
    
    .sticky-toc {
        position: relative;
        top: auto;
        margin: 1rem 0;
    }
}

@media screen and (max-width: 768px) {
    /* Hide desktop TOC banner on mobile */
    .post-banner {
        display: none;
    }
    
    /* Show mobile TOC toggle */
    .mobile-toc-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Hide sticky TOC on mobile */
    .sticky-toc {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .mobile-toc-toggle {
        width: 45px;
        height: 45px;
        top: 65px;
    }
    
    .mobile-toc-toggle i {
        font-size: 1rem;
    }
    
    .mobile-toc-content {
        top: 120px;
        left: 0.5rem;
        right: 0.5rem;
        padding: 0.75rem;
    }
    
    .mobile-toc-content h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .mobile-toc-content a {
        font-size: 0.85rem;
    }
}
