/* =========================================
   Table of Contents – Modern Style
   ========================================= */
.toc-wrapper {
    margin: 0 0 28px;
    font-size: 14px;
    line-height: 1.6;
}

/* ---- Container ---- */
.toc-container {
    border: 2px solid var(--theme-color, #4a90e2);
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    transition: box-shadow .25s ease;
    max-width: 100%;
}
.toc-container:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
}

/* ---- Header ---- */
.toc-container .toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--theme-color, #4a90e2);
    cursor: pointer;
    user-select: none;
    gap: 10px;
}
.toc-container .toc-header .toc-title {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .3px;
    flex: 1;
}
.toc-container .toc-header .toc-title i {
    font-size: 15px;
    opacity: .9;
}
.toc-container .toc-header .toc-toggle {
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s, transform .3s ease;
    outline: none;
    padding: 0;
}
.toc-container .toc-header .toc-toggle:hover {
    background: rgba(255,255,255,.35);
}
.toc-container.toc-collapsed .toc-header .toc-toggle {
    transform: rotate(180deg);
}

/* ---- Progress bar ---- */
.toc-progress-bar {
    height: 3px;
    background: #e8e8e8;
    width: 100%;
}
.toc-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--theme-color, #4a90e2);
    transition: width .1s linear;
    border-radius: 0 3px 3px 0;
}

/* ---- Body / nav ---- */
.toc-container .toc-body {
    overflow: hidden;
    max-height: 1200px;
    transition: max-height .35s ease, opacity .25s ease;
    opacity: 1;
}
.toc-container.toc-collapsed .toc-body {
    max-height: 0;
    opacity: 0;
}

/* ---- List ---- */
.toc-container nav {
    padding: 12px 18px 16px;
}
.toc-container ol,
.toc-container ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
    counter-reset: toc-counter;
}
.toc-container > .toc-body > nav > ol,
.toc-container > .toc-body > nav > ul {
    padding-left: 0;
}

/* Numbered style */
.toc-numbered ol,
.toc-numbered ul {
    counter-reset: toc-counter;
}
.toc-numbered li {
    counter-increment: toc-counter;
}
.toc-numbered li > a::before {
    content: counters(toc-counter, ".") ". ";
    color: var(--theme-color, #4a90e2);
    font-weight: 700;
    font-size: 12px;
    min-width: 22px;
    display: inline-block;
}

/* ---- List Items ---- */
.toc-container li {
    margin: 2px 0;
    position: relative;
}
.toc-container li ol,
.toc-container li ul {
    padding-left: 16px;
    margin-top: 2px;
}

/* ---- Links ---- */
.toc-container li a {
    display: flex;
    align-items: flex-start;
    padding: 5px 10px 5px 8px;
    border-radius: 6px;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background .2s, color .2s, padding-left .2s;
    border-left: 3px solid transparent;
    line-height: 1.5;
    gap: 4px;
    word-break: break-word;
}
.toc-container li a:hover {
    background: rgba(74,144,226,.09);
    color: var(--theme-color, #4a90e2);
    padding-left: 12px;
}

/* Active link (current section) */
.toc-container li a.toc-active {
    background: rgba(74,144,226,.13);
    color: var(--theme-color, #4a90e2);
    font-weight: 700;
    padding-left: 12px;
}

/* Nested link adjustments */
.toc-container li li a {
    font-size: 12.5px;
    font-weight: 400;
    color: #555;
}
.toc-container li li li a {
    font-size: 12px;
    color: #777;
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
    .toc-container li a {
        font-size: 12.5px;
        padding: 5px 8px 5px 6px;
    }
    .toc-container nav {
        padding: 10px 12px 14px;
    }
    .toc-container .toc-header {
        padding: 10px 14px;
    }
}