/* Стили для оглавления */
.table-of-contents-container {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    background: transparent;
    pointer-events: none;
}

#toc-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: var(--light-color);
    border: none;
    padding: 12px;
    cursor: pointer;
    border-radius: 4px 0 0 4px;
    transition: all 0.3s ease;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

#toc-toggle:hover {
    background: var(--primary-color-dark, #6b4a2e);
    padding-right: 20px;
}

#toc-toggle.open {
    background: var(--primary-color-dark, #6b4a2e);
    right: 300px;
}

#toc-toggle.open i {
    color: var(--primary-color, #8b5e3b);
}

#toc-toggle i {
    font-size: 1.2em;
    transition: all 0.3s ease;
}

#table-of-contents {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    background: var(--card-bg, #ffffff);
    padding: 2rem;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    width: 300px;
    height: 100%;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    border-left: 1px solid var(--border-color, #8b5e3b);
    pointer-events: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#table-of-contents .toc-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

#table-of-contents .toc-list::-webkit-scrollbar {
    width: 6px;
}

#table-of-contents .toc-list::-webkit-scrollbar-track {
    background: var(--border-color, #8b5e3b);
    border-radius: 3px;
}

#table-of-contents .toc-list::-webkit-scrollbar-thumb {
    background: var(--primary-color, #8b5e3b);
    border-radius: 3px;
}

#table-of-contents.open {
    transform: translateX(0);
}

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

.toc-item {
    margin: 0.75rem 0;
}

.toc-item a {
    color: var(--text-color, #4a3b2f);
    text-decoration: none;
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    line-height: 1.4;
    border: 1px solid transparent;
}

.toc-item a:hover {
    background-color: var(--hover-bg, rgba(255, 255, 255, 0.05));
    color: var(--primary-color, #8b5e3b);
    transform: translateX(5px);
    border-color: var(--border-color, #8b5e3b);
}

.toc-item a.active {
    background-color: var(--active-bg, rgba(139, 94, 59, 0.1));
    color: var(--primary-color, #8b5e3b);
    font-weight: 500;
    border-color: var(--primary-color, #8b5e3b);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.toc-level-h1 {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 1rem;
    color: var(--text-color, #4a3b2f);
}

.toc-level-h2 {
    padding-left: 1.25rem;
    font-size: 0.95em;
    color: var(--text-muted, #6c757d);
    border-left: 2px solid var(--border-color, #8b5e3b);
    margin-left: 0.75rem;
    position: relative;
}

.toc-level-h2::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 50%;
    width: 8px;
    height: 2px;
    background: var(--border-color, #8b5e3b);
    transform: translateY(-50%);
}

/* Адаптивность для оглавления */
@media (max-width: 768px) {
    #table-of-contents {
        width: 250px;
        padding: 1.5rem;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }
    
    #toc-toggle {
        top: auto;
        bottom: 20px;
        transform: none;
        background: var(--primary-color, #8b5e3b);
        color: white;
    }

    #toc-toggle.open {
        right: 250px;
        background: var(--primary-color-dark, #6b4a2e);
    }

    #toc-toggle:hover {
        background: var(--primary-color-dark, #6b4a2e);
    }
} 