/* ==========================================================================
   MODULE MỤC LỤC TRÊN MOBILE: NÚT NỔI & NGĂN KÉO ĐÁY (FAB & BOTTOM DRAWER)
   Tối ưu Mobile-First (85% di động), chuẩn UI/UX Dạy Lái Xe Nam Việt
   Tác giả: Nam IT Team (0909907073)
   ========================================================================== */

/* 1. NÚT MỤC LỤC NỔI TRÊN MOBILE (FLOATING ACTION BUTTON) */
.tdlx-mobile-toc-fab {
    display: none;
}

@media (max-width: 991px) {
    .tdlx-mobile-toc-fab {
        display: flex;
        align-items: center;
        gap: 6px;
        position: fixed;
        bottom: 24px;
        left: 16px;
        z-index: 99999;
        background: linear-gradient(135deg, #8B1E1E 0%, #6B1212 100%);
        color: #FFFFFF;
        border: 1px solid rgba(251, 191, 36, 0.4);
        padding: 9px 14px;
        border-radius: 30px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
        cursor: pointer;
        font-size: 12.5px;
        font-weight: 700;
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .single-khoa_hoc .tdlx-mobile-toc-fab {
        bottom: 74px;
        left: 14px;
    }

    .tdlx-mobile-toc-fab.is-visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .tdlx-mobile-toc-fab:active {
        transform: scale(0.95);
    }

    .tdlx-mobile-toc-fab i {
        color: #FBBF24;
        font-size: 13px;
    }

    .fab-pct {
        background: rgba(0, 0, 0, 0.25);
        color: #FBBF24;
        padding: 2px 6px;
        border-radius: 10px;
        font-size: 11px;
        font-weight: 800;
    }
}

/* 2. NGĂN KÉO ĐÁY MỤC LỤC TRÊN MOBILE (BOTTOM DRAWER SHEET) */
.tdlx-toc-drawer {
    display: none;
}

@media (max-width: 991px) {
    .tdlx-toc-drawer {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 10001;
        pointer-events: none;
        visibility: hidden;
        transition: visibility 0.3s;
    }

    .tdlx-toc-drawer.is-open {
        pointer-events: auto;
        visibility: visible;
    }

    .tdlx-toc-drawer-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.65);
        backdrop-filter: blur(2px);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .tdlx-toc-drawer.is-open .tdlx-toc-drawer-backdrop {
        opacity: 1;
    }

    .tdlx-toc-drawer-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 75vh;
        background: #FFFFFF;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        box-sizing: border-box;
    }

    .tdlx-toc-drawer.is-open .tdlx-toc-drawer-panel {
        transform: translateY(0);
    }

    .tdlx-toc-drawer-header {
        padding: 16px 20px;
        border-bottom: 1px solid #F1F5F9;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .drawer-header-left {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 15px;
        color: #8B1E1E;
    }

    .drawer-header-left i {
        color: #C59B27;
    }

    .btn-close-toc-drawer {
        background: #F1F5F9;
        border: none;
        color: #64748B;
        font-size: 20px;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .tdlx-toc-drawer-body {
        padding: 14px 18px 24px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: calc(75vh - 65px);
    }

    .drawer-toc-list {
        margin: 0;
        padding: 0;
        list-style: none;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .drawer-toc-item {
        font-size: 14px;
        line-height: 1.4;
    }

    .drawer-level-2 {
        font-weight: 700;
        padding-left: 0;
    }

    .drawer-level-3 {
        font-weight: 500;
        padding-left: 16px;
        font-size: 13px;
    }

    .drawer-toc-link {
        color: #1E293B;
        text-decoration: none;
        display: block;
        padding: 6px 8px;
        border-radius: 6px;
        transition: background 0.15s, color 0.15s;
    }

    .drawer-toc-link:active,
    .drawer-toc-link.is-active {
        background: #FEF2F2;
        color: #8B1E1E;
        font-weight: 800;
    }

    .drawer-item-cta {
        margin-top: 8px;
        padding-top: 10px;
        border-top: 1px dashed #CBD5E1;
    }

    .drawer-link-cta {
        background: #FEF2F2;
        border: 1px solid #FECACA;
        color: #991B1B !important;
        font-weight: 800;
        font-size: 13.5px;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
        border-radius: 8px;
    }

    .drawer-link-cta i {
        color: #EAB308;
    }
}
