/* ============================================
   SUMÁRIO AUTOMÁTICO - Blue Concursos
   Design: Glassmorphism (Escolhido)
   ============================================ */

/* Layout Grid - Desktop */
.bc-toc-grid {
    display: grid !important;
    grid-template-columns: 1fr 320px !important;
    gap: 40px;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Sidebar */
.bc-toc-sidebar {
    /* JS controla a position */
}

/* ============================================
   GLASSMORPHISM DESIGN
   ============================================ */

.bc-toc-wrapper {
    /* NÃO definir position - JS controla! */
    max-height: calc(100vh - 40px);
    padding: 28px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 8px 32px rgba(30, 64, 175, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

.bc-toc-title {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #1E40AF 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(30, 64, 175, 0.1);
    position: relative;
}

.bc-toc-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #1E40AF 0%, transparent 100%);
}

.bc-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    max-height: calc(100vh - 220px);
    padding-right: 4px;
    
    /* ✅ Scroll suave */
    scroll-behavior: smooth;
}

.bc-toc-item {
    margin-bottom: 6px;
}

.bc-toc-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #1e293b;
    text-decoration: none;
    border-radius: 16px;
    transition: all 0.3s ease;
    font-size: 14px;
    line-height: 1.6;
    font-weight: 500;
    background: transparent;
    position: relative;
}

.bc-toc-link::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e1;
    margin-right: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.bc-toc-link:hover {
    background: rgba(30, 64, 175, 0.08);
    color: #1E40AF;
    transform: translateX(4px);
}

.bc-toc-link:hover::before {
    background: #3b82f6;
    transform: scale(1.3);
}

.bc-toc-link.active {
    background: rgba(30, 64, 175, 0.12);
    color: #1E40AF;
    font-weight: 600;
}

.bc-toc-link.active::before {
    background: #1E40AF;
    box-shadow: 0 0 8px rgba(30, 64, 175, 0.5);
}

/* Remover estilos de H3 (não usado mais) */
.bc-toc-link.level-3 {
    display: none;
}

/* Scrollbar elegante */
.bc-toc-list::-webkit-scrollbar {
    width: 6px;
}

.bc-toc-list::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.5);
    border-radius: 10px;
}

.bc-toc-list::-webkit-scrollbar-thumb {
    background: rgba(30, 64, 175, 0.2);
    border-radius: 10px;
}

.bc-toc-list::-webkit-scrollbar-thumb:hover {
    background: rgba(30, 64, 175, 0.3);
}

/* ============================================
   MOBILE - Botão Flutuante + Modal
   ============================================ */

.bc-toc-mobile-trigger {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: auto;
    min-width: 120px;
    height: 48px;
    background: linear-gradient(135deg, #1E40AF 0%, #3b82f6 100%);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0 20px;
    box-shadow: 0 8px 24px rgba(30, 64, 175, 0.4);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    z-index: 9998;
    transition: all 0.3s ease;
}

.bc-toc-mobile-trigger:active {
    transform: scale(0.95);
}

.bc-toc-mobile-trigger svg {
    width: 20px;
    height: 20px;
}

.bc-toc-mobile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 99998;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.bc-toc-mobile-modal.active {
    display: flex;
}

.bc-toc-mobile-content {
    background-color: white;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bc-toc-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.bc-toc-mobile-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
}

.bc-toc-mobile-close {
    background: #f1f5f9;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.bc-toc-mobile-close:hover {
    background: #e2e8f0;
    transform: rotate(90deg);
}

.bc-toc-mobile-close svg {
    width: 20px !important;
    height: 20px !important;
    color: #64748b;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    display: block;
}

.bc-toc-mobile-content .bc-toc-list {
    max-height: none;
    padding-right: 0;
}

.bc-toc-mobile-content .bc-toc-link {
    padding: 16px;
    font-size: 15px;
    margin-bottom: 8px;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (min-width: 1024px) {
    .bc-toc-grid {
        display: grid !important;
    }
    
    .bc-toc-sidebar {
        display: block !important;
    }
    
    .bc-toc-wrapper {
        display: block !important;
    }
    
    .bc-toc-mobile-trigger {
        display: none !important;
    }
}

@media (max-width: 1023px) {
    .bc-toc-grid {
        display: block !important;
        grid-template-columns: 1fr !important;
    }
    
    .bc-toc-sidebar {
        display: none !important;
    }
    
    .bc-toc-wrapper {
        display: none !important;
    }
    
    .bc-toc-mobile-trigger {
        display: flex !important;
    }
}

@media (max-width: 480px) {
    .bc-toc-mobile-trigger {
        bottom: 80px;
        right: 16px;
        min-width: 100px;
        height: 44px;
        font-size: 14px;
    }
    
    .bc-toc-mobile-content {
        padding: 20px;
    }
    
    .bc-toc-mobile-title {
        font-size: 18px;
    }
    
    .bc-toc-grid {
        padding: 0 10px;
    }
}