.toc-nested {
    margin-left: 20px;
    border-left: 2px solid #e5e7eb;
    padding-left: 12px;
    margin-top: 8px;
    margin-bottom: 4px;
}

.toc-nested .toc-item {
    margin: 6px 0;
}

.toc-nested .toc-item::before {
    font-weight: 500;
    color: #6b7280;
}

.toc-nested .toc-item a {
    color: #6b7280;
    font-size: 0.9rem;
}

.toc-nested .toc-item a:hover {
    color: #3b82f6;
    background-color: #f9fafb;
}



.table-of-contents-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 24px;
    margin: 30px 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: relative;
    overflow: hidden;
}

.table-of-contents-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #3b82f6 0%, #8b5cf6 100%);
}

.table-of-contents-wrapper p {
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0 0 16px 0;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-of-contents-wrapper p::before {
    content: '📋';
    font-size: 1.1em;
}

#table-of-contents {
    counter-reset: section;
}

.toc-item {
    counter-increment: section;
    margin: 8px 0;
    position: relative;
    transition: all 0.3s ease;
}

.toc-item::before {
    content: counters(section) ". ";
    font-weight: 600;
    color: #3b82f6;
    margin-right: 8px;
}

.toc-item a {
    text-decoration: none;
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: block;
    position: relative;
    left: -12px;
    width: calc(100% + 24px);
}

.toc-item a:hover {
    color: #3b82f6;
    background-color: #f3f4f6;
    transform: translateX(4px);
}

.toc-item .toc-item {
    margin-left: 24px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.toc-item .toc-item::before {
    color: #6b7280;
    font-weight: 500;
}

.toc-item .toc-item a {
    font-size: 0.9rem;
    color: #6b7280;
}

.toc-item .toc-item a:hover {
    color: #3b82f6;
    background-color: #f9fafb;
}

/* Стили для активного пункта при скролле */
.toc-item.active a {
    color: #3b82f6;
    background-color: #eff6ff;
    font-weight: 600;
}

.toc-item.active::before {
    color: #1d4ed8;
    font-weight: 700;
}

.anchor-offset {
    display: block;
    position: relative;
    top: -80px;
    visibility: hidden;
}

/* Адаптивность */
@media (max-width: 768px) {
    .table-of-contents-wrapper {
        padding: 20px;
        margin: 20px 0;
        border-radius: 8px;
    }
    
    .table-of-contents-wrapper p {
        font-size: 1.1rem;
    }
    
    .toc-item a {
        font-size: 0.9rem;
        padding: 4px 8px;
    }
    
    .toc-item .toc-item {
        margin-left: 20px;
    }
}




/* Плавная анимация появления */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-of-contents-wrapper {
    animation: fadeInUp 0.6s ease-out;
}