/* ==========================================================================
   MODULE MỤC LỤC BÀI VIẾT & THANH TIẾN TRÌNH ĐỌC (TOC & PROGRESS BAR)
   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. THANH TIẾN TRÌNH ĐỌC (CHẠY DỌC MÉP DƯỚI STICKY HEADER) */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.tdlx-reading-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3.5px;
    z-index: 1002;
    pointer-events: none;
    background: transparent;
}

.tdlx-reading-progress-fill {
    height: 100%;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left;
    background: linear-gradient(90deg, #8B1E1E 0%, #DC2626 50%, #C59B27 100%);
    box-shadow: 0 0 10px rgba(197, 155, 39, 0.8);
    transition: none;
}

/* 2. HUY HIỆU THỜI GIAN ĐỌC ƯỚC TÍNH */
.tdlx-read-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FEF2F2;
    color: #8B1E1E;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #FECACA;
}

/* 3. ĐIỂM NEO TIÊU ĐỀ KHÔNG BỊ HEADER CHE */
.tdlx-heading-anchor {
    scroll-margin-top: 90px;
    position: relative;
}

/* 4. KHUNG MỤC LỤC TRONG BÀI VIẾT (IN-CONTENT TOC) */
.tdlx-toc-box {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-left: 4px solid #8B1E1E;
    border-radius: 10px;
    padding: 16px 18px;
    margin: 22px 0 28px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
}

.tdlx-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tdlx-toc-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 800;
    color: #8B1E1E;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tdlx-toc-title i {
    color: #C59B27;
    font-size: 15px;
}

.tdlx-toc-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    color: #475569;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tdlx-toc-toggle-btn:hover {
    background: #F1F5F9;
    color: #8B1E1E;
    border-color: #8B1E1E;
}

.tdlx-toc-toggle-btn i {
    font-size: 10px;
    transition: transform 0.25s;
}

.tdlx-toc-box.is-collapsed .tdlx-toc-toggle-btn i {
    transform: rotate(180deg);
}

.tdlx-toc-nav {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #E2E8F0;
}

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

.tdlx-toc-item {
    font-size: 13.5px;
    line-height: 1.45;
}

.tdlx-toc-link {
    color: #334155;
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s, transform 0.2s;
}

.tdlx-toc-link:hover {
    color: #8B1E1E;
    transform: translateX(3px);
}

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

.tdlx-toc-level-3 {
    font-weight: 500;
    padding-left: 18px;
    font-size: 13px;
    color: #64748B;
}

.tdlx-toc-level-3 .tdlx-toc-link {
    color: #64748B;
}

.tdlx-toc-level-3 .tdlx-toc-link:hover {
    color: #8B1E1E;
}

.tdlx-toc-link.is-active {
    color: #8B1E1E;
    font-weight: 800;
}

/* 5. MỤC NEO CTA CHUYỂN ĐỔI TRONG MỤC LỤC */
.tdlx-toc-item-cta {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px dashed #CBD5E1;
}

.tdlx-toc-link-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B !important;
    font-weight: 800;
    font-size: 13px;
    padding: 7px 12px;
    border-radius: 6px;
    transition: background 0.2s, transform 0.2s;
}

.tdlx-toc-link-cta:hover {
    background: #FEE2E2;
    transform: translateY(-1px);
    color: #7F1D1D !important;
}

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

/* The reading indicator replaces the mobile header border on article pages. */
@media (max-width: 768px) {
    .site-header:has(.tdlx-reading-progress) {
        border-bottom: 0 !important;
    }

    .tdlx-reading-progress {
        height: 3px;
        background: #E2E8F0;
    }

    .tdlx-reading-progress-fill {
        background: #8B1E1E;
        box-shadow: none;
        transition: none;
    }
}
