/* ============================================================
   STICKY TABLE OF CONTENTS
   ============================================================ */
.up-toc-mobile-toggle {
    display: none;
}

@media (min-width: 993px) {
    .up-single-chapter {
        position: relative;
    }
    .up-toc-wrap {
        position: fixed;
        top: 120px;
        left: 24px;
        width: 220px;
        background: #FFFFFF;
        border: 1px solid #E2E8F0;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.06);
        max-height: 70vh;
        overflow-y: auto;
        z-index: 50;
        direction: rtl;
    }
    .up-toc-title {
        font-weight: 700;
        color: #005BAC;
        font-size: 14px;
        margin-bottom: 10px;
        border-bottom: 2px solid #F9A825;
        padding-bottom: 8px;
    }
    .up-toc-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .up-toc-list li {
        margin-bottom: 4px;
    }
    .up-toc-list a {
        display: block;
        padding: 6px 10px;
        font-size: 13px;
        color: #64748B;
        border-radius: 6px;
        text-decoration: none;
        transition: background 200ms, color 200ms;
    }
    .up-toc-list a:hover {
        background: #F0F7FF;
        color: #005BAC;
    }
    .up-toc-list a.up-toc-active {
        background: #005BAC;
        color: #FFFFFF;
        font-weight: 600;
    }
}

/* Hide the sidebar TOC on smaller/laptop widths where it would overlap content */
@media (max-width: 1400px) and (min-width: 993px) {
    .up-toc-wrap { display: none; }
    .up-toc-mobile-toggle { display: block; }
}

/* --- MOBILE: collapsible button + panel --- */
@media (max-width: 992px) {
    .up-toc-mobile-toggle {
        display: block;
        width: calc(100% - 32px);
        margin: 0 16px 12px;
        padding: 12px;
        background: #F0F7FF;
        border: 1.5px solid #005BAC;
        color: #005BAC;
        border-radius: 10px;
        font-size: 14px;
        cursor: pointer;
    }
    .up-toc-wrap {
        display: none;
        margin: 0 16px 20px;
        background: #FFFFFF;
        border: 1px solid #E2E8F0;
        border-radius: 12px;
        padding: 16px;
        direction: rtl;
    }
    .up-toc-wrap.up-toc-open {
        display: block;
    }
    .up-toc-title {
        font-weight: 700;
        color: #005BAC;
        font-size: 14px;
        margin-bottom: 10px;
    }
    .up-toc-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    .up-toc-list a {
        display: block;
        padding: 10px;
        font-size: 14px;
        color: #334155;
        border-bottom: 1px solid #F1F5F9;
        text-decoration: none;
    }
    .up-toc-list a.up-toc-active {
        color: #005BAC;
        font-weight: 600;
    }
}
