/* ================================
   TABLE OF CONTENT - NINA
================================ */

.nina-toc {
    --toc-primary: #0b4a8b;
    --toc-primary-dark: #073768;
    --toc-primary-light: #edf6ff;
    --toc-text: #162033;
    --toc-muted: #7a8798;
    --toc-border: #e3ebf3;
    --toc-bg: #ffffff;

    width: 100%;
    margin: 28px 0;
    font-family: Inter, Arial, sans-serif;
    color: var(--toc-text);
}


/* ================================
   PANEL
================================ */

.nina-toc__panel {
    position: relative;
    overflow: hidden;

    background:
        radial-gradient(
            circle at 100% 0%,
            rgba(11, 74, 139, 0.07),
            transparent 32%
        ),
        #fff;

    border: 1px solid var(--toc-border);
    border-radius: 16px;

    box-shadow:
        0 6px 30px rgba(15, 38, 64, 0.05);

    transition:
        opacity .25s ease,
        transform .25s ease;
}


/* ================================
   HEADER
================================ */

.nina-toc__header {
    min-height: 86px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 20px;

    border-bottom: 1px solid #edf1f5;
}


.nina-toc__heading {
    display: flex;
    align-items: center;
    gap: 13px;
}


.nina-toc__heading-icon {
    width: 44px;
    height: 44px;

    flex: 0 0 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            var(--toc-primary),
            #0877ce
        );

    box-shadow:
        0 7px 20px rgba(11, 74, 139, 0.20);
}


.nina-toc__heading-icon svg {
    width: 23px;
    height: 23px;
    fill: #fff;
}


.nina-toc__title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}


.nina-toc__title strong {
    font-size: 18px;
    line-height: 1.3;
    font-weight: 700;

    color: #10294a;
}


.nina-toc__title span {
    font-size: 13px;
    line-height: 1.5;

    color: var(--toc-muted);
}


/* ================================
   COLLAPSE BUTTON
================================ */

.nina-toc__collapse {
    height: 38px;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 0 13px;

    border: 1px solid #d9e3ec;
    border-radius: 9px;

    background: #fff;

    color: #234262;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background .2s ease,
        color .2s ease,
        border-color .2s ease,
        transform .2s ease;
}


.nina-toc__collapse:hover {
    color: var(--toc-primary);

    background: var(--toc-primary-light);

    border-color: #bfd6ec;
}


.nina-toc__collapse:active {
    transform: scale(.97);
}


.nina-toc__collapse svg {
    width: 16px;
    height: 16px;

    fill: currentColor;
}


/* ================================
   READING PROGRESS
================================ */

.nina-toc__progress {
    width: 100%;
    height: 3px;

    background: #edf2f6;

    overflow: hidden;
}


.nina-toc__progress span {
    display: block;

    width: 0;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            #0b4a8b,
            #1b84d5
        );

    transition: width .15s linear;
}


/* ================================
   NAV
================================ */

.nina-toc__nav {
    padding: 12px 14px 16px;
}


.nina-toc__list {
    list-style: none;

    padding: 0;
    margin: 0;

    max-height: 430px;

    overflow-y: auto;
    overflow-x: hidden;

    scrollbar-width: thin;
    scrollbar-color: #cbd8e5 transparent;
}


.nina-toc__list::-webkit-scrollbar {
    width: 5px;
}


.nina-toc__list::-webkit-scrollbar-track {
    background: transparent;
}


.nina-toc__list::-webkit-scrollbar-thumb {
    background: #cbd8e5;
    border-radius: 20px;
}


/* ================================
   ITEM
================================ */

.nina-toc__item {
    position: relative;

    margin: 2px 0;
}


.nina-toc__link {
    position: relative;

    min-height: 40px;

    display: flex;
    align-items: center;

    padding: 8px 12px 8px 31px;

    border-radius: 9px;

    color: #334158;

    font-size: 14px;
    line-height: 1.55;
    font-weight: 600;

    text-decoration: none;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease;
}


/* bullet */

.nina-toc__link::before {
    content: "";

    position: absolute;

    left: 13px;
    top: 50%;

    width: 5px;
    height: 5px;

    border-radius: 50%;

    background: #b7c4d1;

    transform: translateY(-50%);

    transition:
        background .2s ease,
        box-shadow .2s ease,
        width .2s ease,
        height .2s ease;
}


.nina-toc__link:hover {
    color: var(--toc-primary);

    background: #f5f9fc;
}


/* ================================
   ACTIVE
================================ */

.nina-toc__link.is-active {
    color: var(--toc-primary-dark);

    background:
        linear-gradient(
            90deg,
            rgba(11, 74, 139, 0.09),
            rgba(11, 74, 139, 0.02)
        );

    font-weight: 650;
}


.nina-toc__link.is-active::before {
    width: 7px;
    height: 7px;

    background: var(--toc-primary);

    box-shadow:
        0 0 0 4px rgba(11, 74, 139, .10);
}


/* ================================
   HEADING LEVELS H2 → H6
================================ */


/* H2 */

.nina-toc__item.level-h2 .nina-toc__link {
    padding-left: 31px;

    font-weight: 650;

    color: #24344a;
}


/* H3 */

.nina-toc__item.level-h3 .nina-toc__link {
    padding-left: 51px;

    font-size: 13.8px;
}


.nina-toc__item.level-h3 .nina-toc__link::before {
    left: 33px;
}


/* H4 */

.nina-toc__item.level-h4 .nina-toc__link {
    padding-left: 70px;

    font-size: 13.5px;

    color: #566477;
}


.nina-toc__item.level-h4 .nina-toc__link::before {
    left: 52px;

    width: 4px;
    height: 4px;
}


/* H5 */

.nina-toc__item.level-h5 .nina-toc__link {
    padding-left: 88px;

    font-size: 13px;

    color: #697587;
}


.nina-toc__item.level-h5 .nina-toc__link::before {
    left: 70px;

    width: 4px;
    height: 4px;
}


/* H6 */

.nina-toc__item.level-h6 .nina-toc__link {
    padding-left: 106px;

    font-size: 12.8px;

    color: #7a8593;
}


.nina-toc__item.level-h6 .nina-toc__link::before {
    left: 88px;

    width: 4px;
    height: 4px;
}


/* ================================
   COLLAPSED STATE
================================ */

.nina-toc__collapsed-bar {
    display: none;

    width: 100%;

    min-height: 52px;

    align-items: center;

    padding: 8px 13px;

    border: 1px solid var(--toc-border);
    border-radius: 12px;

    background: #fff;

    box-shadow:
        0 5px 20px rgba(15, 38, 64, 0.05);

    color: #163859;

    font-size: 14px;
    font-weight: 650;

    cursor: pointer;

    transition:
        border-color .2s ease,
        box-shadow .2s ease,
        background .2s ease;
}


.nina-toc__collapsed-bar:hover {
    border-color: #c4d8ea;

    background: #f9fcff;

    box-shadow:
        0 7px 24px rgba(15, 38, 64, 0.08);
}


.nina-toc__collapsed-icon {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-right: 10px;

    border-radius: 9px;

    background: var(--toc-primary);
}


.nina-toc__collapsed-icon svg {
    width: 19px;
    height: 19px;

    fill: #fff;
}


.nina-toc__collapsed-arrow {
    width: 25px;
    height: 25px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-left: auto;

    border-radius: 7px;

    background: #edf4fa;

    color: var(--toc-primary);
}


.nina-toc__collapsed-arrow svg {
    width: 17px;
    height: 17px;

    fill: currentColor;
}


/*
 * QUAN TRỌNG:
 * Thu gọn là ẩn TOÀN BỘ panel,
 * chỉ giữ lại collapsed bar.
 */

.nina-toc.is-collapsed .nina-toc__panel {
    display: none;
}


.nina-toc.is-collapsed .nina-toc__collapsed-bar {
    display: flex;
}


/* ================================
   MOBILE
================================ */

@media (max-width: 767px) {

    .nina-toc {
        margin: 20px 0;
    }


    .nina-toc__panel {
        border-radius: 13px;
    }


    .nina-toc__header {
        min-height: 72px;

        padding: 14px;
    }


    .nina-toc__heading {
        gap: 10px;
    }


    .nina-toc__heading-icon {
        width: 38px;
        height: 38px;

        flex-basis: 38px;

        border-radius: 10px;
    }


    .nina-toc__heading-icon svg {
        width: 20px;
        height: 20px;
    }


    .nina-toc__title strong {
        font-size: 15px;
    }


    .nina-toc__title span {
        font-size: 11.5px;
    }


    .nina-toc__collapse {
        width: 35px;
        height: 35px;

        justify-content: center;

        padding: 0;
    }


    .nina-toc__collapse span {
        display: none;
    }


    .nina-toc__nav {
        padding: 9px 9px 12px;
    }


    .nina-toc__list {
        max-height: 350px;
    }


    .nina-toc__link {
        min-height: 38px;

        padding-top: 7px;
        padding-bottom: 7px;

        font-size: 13.5px;
    }


    .nina-toc__item.level-h3 .nina-toc__link {
        padding-left: 43px;
    }


    .nina-toc__item.level-h3 .nina-toc__link::before {
        left: 25px;
    }


    .nina-toc__item.level-h4 .nina-toc__link {
        padding-left: 55px;
    }


    .nina-toc__item.level-h4 .nina-toc__link::before {
        left: 37px;
    }


    .nina-toc__item.level-h5 .nina-toc__link {
        padding-left: 67px;
    }


    .nina-toc__item.level-h5 .nina-toc__link::before {
        left: 49px;
    }


    .nina-toc__item.level-h6 .nina-toc__link {
        padding-left: 79px;
    }


    .nina-toc__item.level-h6 .nina-toc__link::before {
        left: 61px;
    }

}