/* --- TABLE OF CONTENTS (POST BODY) --- */

.wh-toc-container {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    padding: 30px;
    border-radius: 12px;
    width: fit-content;
}

.wh-toc-container h3 {
    margin-top: 0;
    font-size: 1.6rem;
    color: #1e293b;
    border-bottom: 3px solid var(--wh-toc-primary, #d11616);
    display: inline-block;
    margin-bottom: 20px;
}

.wh-toc-container ol {
    list-style-type: none;
    counter-reset: wh-toc-counter;
    padding-left: 0;
    margin: 0;
}

.wh-toc-container ol ol {
    counter-reset: wh-toc-counter;
    margin-left: 30px; 
    margin-top: 10px;
    margin-bottom: 10px;
}

.wh-toc-container li {
    counter-increment: wh-toc-counter;
    margin-bottom: 12px;
    line-height: 1.5;
    padding-left: 2.5em; 
    text-indent: -2.5em; 
}

.wh-toc-container li::before {
    content: counters(wh-toc-counter, ".") ". ";
    font-weight: bold;
    color: black;
    margin-right: 8px;
    display: inline-block;
    width: 2em; 
    text-indent: 0;
}

.wh-toc-container li ol {
    text-indent: 0;
    padding-left: 0;
}

.wh-toc-container a {
    color: #3ab54a;
    text-decoration: underline;
}

.wh-toc-sublist {
    margin-left: 1.5em;
    font-size: 0.95em;
}

/* --- TABLE OF CONTENTS TOGGLE --- */
.wh-toc-container h3 {
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-bottom: 10px;
}

.wh-toc-toggle-icon {
    font-size: 14px;
    transition: transform 0.3s ease;
    display: inline-block;
    margin-left: 10px;
}

.wh-toc-container.is-folded .wh-toc-toggle-icon {
    transform: rotate(-90deg);
}

.wh-toc-list-wrapper {
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.3s ease;
    max-height: 2000px; 
    opacity: 1;
}

.wh-toc-container.is-folded .wh-toc-list-wrapper {
    max-height: 0;
    opacity: 0;
}

/* --- STICKY NAVIGATION BAR --- */
#wh-toc-sticky-bar {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 9999;
    padding: 12px 20px;
    width: 480px; 
    max-width: 95vw;
    border: 1px solid #e2e8f0;
    transition: bottom 0.3s ease, opacity 0.3s ease;
}

#wh-toc-sticky-bar.wh-toc-sticky-hidden {
    bottom: -120px;
    opacity: 0;
    pointer-events: none;
}

.wh-sticky-container {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    gap: 10px;
}

.wh-sticky-meta {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

.wh-sticky-current-title {
    width: 100%;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: sans-serif;
    line-height: 1.2;
    transition: opacity .2s ease-in-out;
}

.wh-sticky-counter {
    font-size: 10px;
    letter-spacing: 0.8px;
    color: #64748b;
    margin-top: 2px;
    font-family: sans-serif;
    font-weight: 600;
}

.wh-toc-btn {
    background: var(--wh-toc-primary, #d11616);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wh-toc-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    filter: grayscale(1);
}

/* --- OVERLAY --- */
#wh-toc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#wh-toc-overlay.active {
    opacity: 1;
    visibility: visible;
}

.wh-toc-overlay-content {
    background: #ffffff;
    width: 90%;
    max-width: 550px;
    max-height: 85vh;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

#wh-toc-clone-target {
    overflow-y: auto;
    padding: 25px 35px 25px 25px; 
    flex-grow: 1;
    background: #f8f9fa;
}

#wh-toc-clone-target .wh-toc-container { 
    padding: unset;
    background: none;
    border: none;
}

#wh-toc-close-overlay {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ffffff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 10001;
}

/* --- UNIVERSAL HIGHLIGHTING --- */
.wh-toc-container .wh-toc-active-item > a {
    color: #000000 !important;
    font-weight: 800 !important;
    text-decoration: none !important;
}

.wh-toc-container .wh-toc-active-item::before {
    color: #000000 !important;
    font-weight: 900 !important;
}

/* Header offset for scroll jumps */
.wh-toc-header, .wh-toc-sub-header {
    scroll-margin-top: 150px;
}

/* --- SETTINGS TOGGLES --- */

/* Hide Sub-headers (H3-H6 lists) */
.wh-toc-container.wh-toc-hide-subheaders ol ol {
    display: none !important;
}

/* Hide Numbers & Reset Indentation */
.wh-toc-container.wh-toc-hide-numbers li {
    padding-left: 0 !important;
    text-indent: 0 !important;
}

.wh-toc-container.wh-toc-hide-numbers li::before {
    display: none !important;
}