/**
 * Simple TOC - Frontend Styles
 *
 * Clean, minimal design for the table of contents
 */

/* Main container */
.simple-toc {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px 20px;
    margin: 0 0 25px 0;
    max-width: 420px;
    font-size: 0.95em;
    line-height: 1.5;
    box-sizing: border-box;
}

/* Header section */
.simple-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Title */
.simple-toc-title {
    font-weight: 600;
    color: #333;
}

/* Toggle button */
.simple-toc-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #666;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.simple-toc-toggle:hover {
    background-color: #f0f0f0;
}

/* SVG Icon */
.simple-toc-icon {
    display: block;
}

/* Up/Down arrows */
.simple-toc-arrow-up,
.simple-toc-arrow-down {
    transition: opacity 0.2s ease;
}

/* When expanded, show down arrow more prominently */
.simple-toc .simple-toc-arrow-up {
    opacity: 0.4;
}
.simple-toc .simple-toc-arrow-down {
    opacity: 1;
}

/* When collapsed, show up arrow more prominently */
.simple-toc.collapsed .simple-toc-arrow-up {
    opacity: 1;
}
.simple-toc.collapsed .simple-toc-arrow-down {
    opacity: 0.4;
}

/* Content wrapper */
.simple-toc-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
}

/* Collapsed state - hide content */
.simple-toc.collapsed .simple-toc-content {
    display: none;
}

/* TOC list */
.simple-toc-list {
    list-style: none;
    margin: 12px 0 0 0;
    padding: 0;
    line-height: 1.6;
}

/* List items */
.simple-toc-item {
    margin: 0;
    padding: 4px 0;
}

/* Links */
.simple-toc-list a {
    color: #333;
    text-decoration: none;
    transition: color 0.15s ease;
    display: inline-block;
}

.simple-toc-list a:hover {
    color: #0073aa;
    text-decoration: underline;
}

.simple-toc-list a:focus {
    outline: 1px dotted #333;
    outline-offset: 2px;
}

/* Hierarchical indentation */
.simple-toc-item.level-1 {
    padding-left: 0;
}

.simple-toc-item.level-2 {
    padding-left: 15px;
}

.simple-toc-item.level-3 {
    padding-left: 30px;
}

.simple-toc-item.level-4 {
    padding-left: 45px;
}

.simple-toc-item.level-5 {
    padding-left: 60px;
}

.simple-toc-item.level-6 {
    padding-left: 75px;
}

/* Smooth scroll for anchor links */
html {
    scroll-behavior: smooth;
}

/* Target highlighting */
:target {
    scroll-margin-top: 20px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .simple-toc {
        max-width: 100%;
        padding: 12px 15px;
    }

    .simple-toc-item.level-2 {
        padding-left: 12px;
    }

    .simple-toc-item.level-3 {
        padding-left: 24px;
    }

    .simple-toc-item.level-4 {
        padding-left: 36px;
    }

    .simple-toc-item.level-5 {
        padding-left: 48px;
    }

    .simple-toc-item.level-6 {
        padding-left: 60px;
    }
}

/* Print styles */
@media print {
    .simple-toc {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .simple-toc-toggle {
        display: none;
    }

    .simple-toc.collapsed .simple-toc-content {
        display: block;
    }
}
