/* ==========================================================
   A PHIM — Desktop Navigation v2 (SofaFlix-inspired)
   - Always fully transparent, no dark on scroll
   - h-14 (56px) height
   - Flat links, no pill wrapper
   - Underline animation on hover
   - Dark glass dropdowns
   ========================================================== */

/* ── Core Nav: Always Transparent ── */
@media (min-width: 1280px) {
    nav {
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        border-bottom: none !important;
    }

    /* Override scrolled state — stay transparent always */
    nav.scrolled {
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        border-bottom: none !important;
    }

    /* ── Nav Inner Container: 56px height ── */
    nav > div.container,
    nav > div {
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
    }
}

/* ── Desktop Nav Layout ── */
@media (min-width: 1280px) {

    /* Remove the old pill wrapper if any remain */
    .desktop-pill-wrapper {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        gap: 2px !important;
        border-radius: 0 !important;
        backdrop-filter: none !important;
    }

    /* ✨ Desktop Pill Container ✨ - Theo logic cũ: ở trên cùng hoàn toàn trong suốt hòa trộn, khi bắt đầu lướt xuống mới hiển thị màu Sắc vàng kim & Bóng đổ 3D chuẩn điện ảnh */
    nav#mainNav:not(.scrolled) .desktop-nav-pill {
        display: flex;
        align-items: center;
        gap: 0;
        background: transparent !important;
        border: 1px solid transparent !important;
        border-radius: 999px;
        padding: 6px 8px 6px 6px;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    nav#mainNav.scrolled .desktop-nav-pill {
        display: flex;
        align-items: center;
        gap: 0;
        /* Ánh xạ hoàng kim đồng đều giữa bên trong ô và bên ngoài viền: Nền kính mờ đen ấm + dải hoàng kim 24K sang trọng hòa quyện hoàn hảo với viền vàng kim bên ngoài */
        background: 
            linear-gradient(180deg, rgba(255, 248, 210, 0.14) 0%, rgba(252, 213, 118, 0.05) 50%, rgba(10, 10, 15, 0.35) 100%),
            linear-gradient(90deg, rgba(252, 213, 118, 0.16) 0%, rgba(255, 223, 128, 0.1) 30%, rgba(242, 242, 13, 0.14) 50%, rgba(255, 223, 128, 0.1) 70%, rgba(252, 213, 118, 0.16) 100%),
            rgba(14, 15, 22, 0.86) !important;
        border: 1.5px solid rgba(252, 213, 118, 0.6) !important;
        border-radius: 999px;
        padding: 6px 8px 6px 6px;
        backdrop-filter: blur(48px) saturate(220%) !important;
        -webkit-backdrop-filter: blur(48px) saturate(220%) !important;
        /* Bóng đổ sâu 3D chuẩn điện ảnh + Hào quang hoàng kim bọc ngoài và phản quang ánh vàng nổi bên trong lòng viên thuốc */
        box-shadow: 
            0 24px 60px -12px rgba(0, 0, 0, 0.95),
            0 12px 50px rgba(0, 0, 0, 0.75),
            0 0 38px rgba(252, 213, 118, 0.35),
            0 0 16px rgba(214, 159, 61, 0.45),
            inset 0 1px 2px rgba(255, 248, 210, 0.7),
            inset 0 -1px 2px rgba(196, 134, 0, 0.45),
            inset 0 0 25px rgba(252, 213, 118, 0.2) !important;
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Hiệu ứng khi di chuột (Hover) vào thanh điều hướng viên thuốc khi đã cuộn - Hào quang 3D cực sang */
    nav#mainNav.scrolled .desktop-nav-pill:hover {
        border-color: rgba(255, 244, 184, 0.88) !important;
        box-shadow: 
            0 28px 70px -10px rgba(0, 0, 0, 0.98),
            0 15px 55px rgba(0, 0, 0, 0.85),
            0 0 48px rgba(252, 213, 118, 0.48),
            0 0 22px rgba(214, 159, 61, 0.58),
            inset 0 1px 3px rgba(255, 248, 210, 0.85),
            inset 0 -1px 2px rgba(196, 134, 0, 0.55),
            inset 0 0 30px rgba(252, 213, 118, 0.28) !important;
    }

    /* Search Bar initially transparent when at top */
    nav#mainNav:not(.scrolled) .desktop-nav-pill .nav-search-v2:not(:focus-within) {
        background: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
        margin-left: 0;
    }

    /* Search Bar inside scrolled pill: Đồng bộ màu bên trong ô với bên ngoài viền hoàng kim */
    nav#mainNav.scrolled .desktop-nav-pill .nav-search-v2:not(:focus-within) {
        background: rgba(252, 213, 118, 0.09) !important;
        border-color: rgba(252, 213, 118, 0.28) !important;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45), 0 0 12px rgba(252, 213, 118, 0.1) !important;
        margin-left: 0;
    }

    nav#mainNav.scrolled .desktop-nav-pill .nav-search-v2:not(:focus-within) .search-icon {
        color: rgba(252, 213, 118, 0.85) !important;
    }

    nav#mainNav.scrolled .desktop-nav-pill .nav-search-v2:not(:focus-within) input::placeholder {
        color: rgba(255, 248, 220, 0.6) !important;
    }

    /* ── Flat Nav Link Base ── */
    .nav-flat-link {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 6px 14px;
        font-size: 0.9rem;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.9);
        letter-spacing: normal;
        transition: color 0.2s ease;
        border-radius: 0;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        white-space: nowrap;
    }

    /* Underline: grows from center outward */
    .nav-flat-link::after {
        content: '';
        position: absolute;
        bottom: 0px;
        left: 50%;
        right: 50%;
        height: 2px;
        background: linear-gradient(90deg, #f2f20d, #ffd700);
        border-radius: 2px;
        transition: left 0.25s ease, right 0.25s ease;
    }

    .nav-flat-link:hover {
        color: #ffffff;
    }

    .nav-flat-link:hover::after {
        left: 14px;
        right: 14px;
    }

    /* Active state */
    .nav-flat-link.active {
        color: #ffffff;
        font-weight: 600;
    }

    .nav-flat-link.active::after {
        left: 14px;
        right: 14px;
        background: linear-gradient(90deg, #f2f20d, #ffd700);
    }

    /* Danger link (Phim X) */
    .nav-flat-link--danger {
        color: rgba(248, 113, 113, 0.9) !important;
    }

    .nav-flat-link--danger:hover {
        color: #f87171 !important;
    }

    .nav-flat-link--danger::after {
        background: linear-gradient(90deg, #f87171, #ef4444) !important;
    }

    .nav-flat-dropdown {
        position: relative;
        padding-bottom: 6px;
        margin-bottom: -6px;
    }

    .nav-flat-dropdown > button.nav-flat-link {
        cursor: pointer;
    }

    .nav-flat-dropdown > button.nav-flat-link .nav-caret {
        font-size: 16px;
        transition: transform 0.25s ease;
        opacity: 0.9;
        line-height: 1;
        margin-top: 1px;
    }

    .nav-flat-dropdown:hover > button.nav-flat-link .nav-caret {
        transform: rotate(180deg);
        opacity: 1;
    }

    /* ── Dropdown Panel: Shell Container ── */
    .nav-flat-dropdown > .nav-dropdown-panel {
        position: absolute;
        top: 100%;
        left: 0;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        border-radius: 14px !important;
        box-shadow: none !important;
        overflow: visible;
        padding: 4px 2px 2px 2px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-4px);
        transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
        z-index: 10000 !important;
        will-change: opacity, transform;
        pointer-events: none;
    }

    .nav-flat-dropdown:hover > .nav-dropdown-panel,
    .nav-flat-dropdown:focus-within > .nav-dropdown-panel {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* Cau noi vo hinh chong khung giat khi re chuot tu nut xuong bang menu */
    .nav-flat-dropdown > .nav-dropdown-panel::before {
        content: '';
        position: absolute;
        top: -16px;
        left: 0;
        right: 0;
        height: 20px;
        background: transparent;
        pointer-events: auto;
    }

    /* ── Page Dim Overlay when dropdown is open ── */
    /*
     * Z-index hierarchy:
     *   nav (z-50 = 50 Tailwind) → nằm TRÊN overlay
     *   .nav-dim-overlay = z-index 45 → dưới nav, trước trang
     *   .nav-dropdown-panel = z-index 10000 → nằm TRÊN hết
     */
    .nav-dim-overlay {
        position: fixed;
        inset: 0;
        /* QUAN TRỌNG: z-index phải dưới nav (Tailwind z-50 = 50) */
        z-index: 45;
        background: rgba(0, 0, 0, 0);
        pointer-events: none;
        transition: background 0.3s ease;
    }

    .nav-dim-overlay.active {
        /* Giảm tối xuống mức vừa đủ — menu xanh phải nổi bật hơn */
        background: rgba(0, 0, 10, 0.52);
        pointer-events: none;
    }

    /* Dropdown panel luôn nằm rất cao, trên overlay */
    .nav-flat-dropdown > .nav-dropdown-panel {
        z-index: 10000 !important;
    }

    /* Xóa bỏ box-shadow ở thẻ ngoài cùng để tránh bị 2 lớp bóng chồng lên nhau gây lag GPU */

    /* Đè màu nền khung xanh đá giống hình 1 cho tất cả các dropdown */
    .nav-dropdown-panel > div {
        background: #2b3a72 !important; /* Tone màu xanh đậm giống hình 1 */
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 12px !important;
        box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06) !important;
    }

    /* Dropdown link items — Tăng độ đậm và độ sáng chữ giống hình 1 */
    .nav-dropdown-panel a {
        position: relative;
        display: flex;
        align-items: center;
        text-decoration: none;
        color: rgba(255, 255, 255, 0.88) !important;
        font-weight: 700 !important; /* Chữ đậm giống hình 1 */
        font-size: 0.9rem !important;
        transition: background 0.18s, color 0.18s !important;
        border-color: rgba(255, 255, 255, 0.08) !important; /* Đồng bộ viền chia ô */
    }

    .nav-dropdown-panel a span {
        font-weight: 700 !important;
    }

    /* ::before placeholder (không hiển thị nếu JS đã quản lý hover) */
    .nav-dropdown-panel a::before {
        content: none;
    }

    /* Hiệu ứng khi di chuột đến: đổi thành màu vàng ấm giống hình 3 */
    .nav-dropdown-panel a:hover {
        background: rgba(255, 255, 255, 0.08) !important;
        color: #ffd700 !important; /* Màu vàng giống hình 3 */
    }

    /* Fallback cho các trang sử dụng cấu trúc cũ .relative.group > .absolute.top-full */
    nav .relative.group > .absolute.top-full {
        background: #2b3a72 !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        border-radius: 12px !important;
        box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06) !important;
    }
    nav .relative.group > .absolute.top-full a {
        color: rgba(255, 255, 255, 0.88) !important;
        font-weight: 700 !important;
        font-size: 0.82rem !important;
    }
    nav .relative.group > .absolute.top-full a span {
        font-weight: 700 !important;
    }
    nav .relative.group > .absolute.top-full a:hover {
        background: rgba(255, 255, 255, 0.08) !important;
        color: #ffd700 !important;
    }

    /* ── Desktop Search Bar ── */
    .nav-search-v2 {
        position: relative;
        display: flex;
        align-items: center;
        width: 320px;
        height: 38px;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 999px;
        overflow: hidden;
        margin-left: 12px;
        flex-shrink: 0;
        transition:
            width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
            border-color 0.25s,
            background 0.25s,
            box-shadow 0.25s;
        backdrop-filter: blur(8px);
    }

    .nav-search-v2:focus-within {
        width: 420px;
        border-color: rgba(242, 242, 13, 0.45);
        background: rgba(0, 0, 0, 0.55);
        box-shadow: 0 0 0 3px rgba(242, 242, 13, 0.1), 0 8px 24px rgba(0,0,0,0.35);
    }

    .nav-search-v2 .search-icon {
        flex-shrink: 0;
        padding: 0 10px 0 14px;
        font-size: 18px;
        color: rgba(255, 255, 255, 0.45);
        transition: color 0.2s;
        line-height: 1;
    }

    .nav-search-v2:focus-within .search-icon {
        color: #f2f20d;
    }

    .nav-search-v2 input {
        flex: 1;
        background: transparent !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        color: #fff;
        font-size: 0.95rem;
        font-weight: 400;
        padding: 0 14px 0 0;
        height: 100%;
        text-overflow: ellipsis;
    }

    .nav-search-v2 input::placeholder {
        color: rgba(255, 255, 255, 0.38);
        font-size: 0.9rem;
    }

    /* ── Voice Search mic button inside search bar ── */
    .nav-search-v2 {
        overflow: visible;
    }
    .vs-nav-mic-btn {
        width: 30px !important;
        height: 30px !important;
        border-radius: 50% !important;
        background: rgba(255,255,255,0.1) !important;
        border: 1px solid rgba(255,255,255,0.15) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        margin-right: 6px !important;
        transition: background 0.2s, border-color 0.2s, box-shadow 0.2s !important;
        cursor: pointer;
    }
    .vs-nav-mic-btn:hover {
        background: rgba(242, 242, 13, 0.15) !important;
        border-color: rgba(242, 242, 13, 0.5) !important;
        box-shadow: 0 0 10px rgba(242, 242, 13, 0.25) !important;
    }
    .vs-nav-mic-btn .material-icons-round {
        font-size: 16px !important;
        color: rgba(255,255,255,0.6) !important;
        transition: color 0.2s !important;
    }
    .vs-nav-mic-btn:hover .material-icons-round {
        color: #f2f20d !important;
    }


    /* ✨ Auth / Login Button - 24K Royal Gold & 3D Cinematic Shadow ✨ */
    .nav-auth-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 2px !important;
        padding: 0 14px 0 8px !important;
        height: 40px !important;
        font-size: 0.95rem;
        font-weight: 800;
        letter-spacing: 0.03em;
        color: #0d0f1a !important;
        background: linear-gradient(135deg, #FFF6CC 0%, #FCD576 40%, #E6A817 78%, #C48600 100%) !important;
        border: 1.5px solid rgba(255, 248, 210, 0.85) !important;
        border-radius: 999px !important;
        box-shadow: 0 10px 22px -3px rgba(230, 168, 23, 0.65), 0 5px 12px -2px rgba(196, 134, 0, 0.8), 0 0 25px rgba(252, 213, 118, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.9), inset 0 -3px 5px rgba(160, 100, 0, 0.9) !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    }

    .nav-auth-btn:hover {
        background: linear-gradient(135deg, #FFFFFF 0%, #FFE18D 40%, #F2BA29 78%, #D69708 100%) !important;
        transform: translateY(-1.5px) scale(1.03);
        box-shadow: 0 14px 28px -2px rgba(230, 168, 23, 0.8), 0 8px 16px -2px rgba(196, 134, 0, 0.9), 0 0 32px rgba(252, 213, 118, 0.75), inset 0 2px 4px rgba(255, 255, 255, 1), inset 0 -3px 6px rgba(160, 100, 0, 0.95) !important;
    }

    .nav-auth-btn dotlottie-player {
        width: 36px !important;
        height: 36px !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
        transform: scale(2.0) translateY(0px) !important;
        transform-origin: center center !important;
        pointer-events: none !important;
    }

    .nav-auth-btn .auth-btn-text {
        font-size: 0.95rem !important;
        font-weight: 800 !important;
        letter-spacing: 0.03em !important;
        color: #0d0f1a !important;
        line-height: 1 !important;
        transform: translateY(1.5px) !important;
        display: inline-block !important;
    }

    /* Logged-in user badge */
    .nav-user-badge {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 5px 14px 5px 6px;
        border: 1px solid rgba(255,255,255,0.15);
        border-radius: 999px;
        font-size: 0.8rem;
        font-weight: 600;
        color: rgba(255,255,255,0.9);
        background: rgba(255,255,255,0.06);
        transition: background 0.2s, border-color 0.2s;
        cursor: pointer;
    }

    .nav-user-badge:hover {
        background: rgba(255,255,255,0.1);
        border-color: rgba(255,255,255,0.25);
    }

    .nav-user-avatar {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        border: 2px solid #f2f20d;
        overflow: hidden;
        background: #1a1a2e;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.7rem;
        font-weight: 700;
        color: #f2f20d;
    }
}

/* ==========================================================
   A PHIM — Navigation Responsive Override (SofaFlix-inspired Breakpoint)
   Forces layout transition to mobile view below 1280px instead of 1024px.
   ========================================================== */
@media (max-width: 1279.98px) {
    /* 1. Hide Desktop Navigation Container */
    nav#mainNav div.hidden.lg\:flex {
        display: none !important;
    }

    /* 2. Hide Desktop Login Button */
    nav#mainNav .nav-auth-btn.hidden.lg\:inline-flex {
        display: none !important;
    }

    /* 3. Force Show Mobile Menu Button (Hamburger) */
    nav#mainNav button#mobileMenuBtn.lg\:hidden,
    nav#mainNav .mm-burger-btn.lg\:hidden {
        display: block !important;
    }

    /* 4. Force Show Mobile Inline Search Bar */
    nav#mainNav .mobile-inline-search {
        display: flex !important;
    }
}

@media (min-width: 1280px) {
    /* 1. Force Show Desktop Navigation Container */
    nav#mainNav div.hidden.lg\:flex {
        display: flex !important;
    }

    /* 2. Force Show Desktop Login Button */
    nav#mainNav .nav-auth-btn.hidden.lg\:inline-flex {
        display: inline-flex !important;
    }

    /* 3. Force Hide Mobile Menu Button (Hamburger) */
    nav#mainNav button#mobileMenuBtn.lg\:hidden,
    nav#mainNav .mm-burger-btn.lg\:hidden {
        display: none !important;
    }

    /* 4. Force Hide Mobile Inline Search Bar */
    nav#mainNav .mobile-inline-search {
        display: none !important;
    }
}

/* Responsive adjustments for up to 1536px (125% zoom) */
@media (max-width: 1536px) {
    .nav-flat-link {
        padding: 6px 10px !important;
        font-size: 0.78rem !important;
    }
    .nav-search-v2 {
        width: 160px !important;
    }
    .nav-search-v2:focus-within {
        width: 220px !important;
    }
    .nav-search-v2 input {
        font-size: 0.78rem !important;
    }
}

@media (max-width: 1366px) {
    .nav-flat-link {
        padding: 5px 8px !important;
        font-size: 0.75rem !important;
    }
    .nav-search-v2 {
        width: 140px !important;
    }
    .nav-search-v2:focus-within {
        width: 190px !important;
    }
}

/* ── MOBILE: Ẩn chữ "Đăng Nhập" và Ẩn tên user (Giữ avatar + chevron mũi tên) ── */
@media (max-width: 768px) {
    #userNavProfile {
        gap: 8px !important;
    }
    .ap-user-bar-trigger .ap-user-name-text,
    span.ap-user-name-text {
        display: none !important;
    }
    .ap-user-bar-trigger .ap-user-chevron-icon,
    .ap-user-chevron-icon {
        display: block !important;
        width: 14px !important;
        height: 14px !important;
        margin-left: 1px !important;
        margin-right: 2px !important;
        color: rgba(255, 255, 255, 0.75) !important;
        flex-shrink: 0 !important;
    }
    .ap-user-bar-trigger {
        display: inline-flex !important;
        align-items: center !important;
        padding: 2px 6px 2px 2px !important;
        gap: 4px !important;
        background: rgba(255, 255, 255, 0.06) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 9999px !important;
    }
    .auth-btn-text {
        display: none !important;
    }
    .nav-auth-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        width: 40px !important;
        height: 40px !important;
        min-width: unset !important;
        gap: 0 !important;
        position: relative !important;
        background: linear-gradient(135deg, #FFF6CC 0%, #FCD576 40%, #E6A817 78%, #C48600 100%) !important;
        border: 1.5px solid rgba(255, 248, 210, 0.85) !important;
        border-radius: 50% !important;
        backdrop-filter: blur(8px) !important;
        box-shadow: 0 6px 14px -2px rgba(230, 168, 23, 0.65), 0 0 18px rgba(252, 213, 118, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.9), inset 0 -3px 4px rgba(160, 100, 0, 0.9) !important;
        box-sizing: border-box !important;
    }
    .nav-auth-btn .material-icons-round,
    .nav-auth-btn dotlottie-player {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -55%) scale(1.95) !important;
        margin: 0 !important;
    }
    .nav-auth-btn .material-icons-round {
        font-size: 1.25rem !important;
        line-height: 1 !important;
        color: #0d0f1a !important;
    }
}


/* ==========================================================
   ✨ DESKTOP NAV PILL FLEX & RESPONSIVE COLLISION FIX ✨
   Prevents overlapping between search bar & nav links on desktop/laptop screens & zoom levels (1280px - 1600px).
   ========================================================== */

@media (min-width: 1280px) {
    .desktop-nav-pill {
        display: flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    nav-links, .nav-links {
        display: flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        min-width: max-content !important;
    }

    .nav-search-v2 {
        flex-shrink: 1 !important;
        min-width: 120px !important;
        transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s, border-color 0.25s !important;
    }
}

/* Fluid responsive adjustments for laptops / 125% - 150% zoom */
@media (max-width: 1600px) and (min-width: 1280px) {
    .nav-flat-link {
        padding: 5px clamp(6px, 0.7vw, 12px) !important;
        font-size: clamp(0.76rem, 0.82vw, 0.88rem) !important;
        flex-shrink: 0 !important;
    }
    .nav-search-v2 {
        width: clamp(140px, 14vw, 240px) !important;
    }
    .nav-search-v2:focus-within {
        width: clamp(200px, 20vw, 300px) !important;
    }
    .nav-search-v2 input {
        font-size: 0.8rem !important;
    }
}

@media (max-width: 1366px) and (min-width: 1280px) {
    .desktop-nav-pill {
        padding: 4px 6px !important;
    }
    .nav-flat-link {
        padding: 4px 6px !important;
        font-size: 0.75rem !important;
    }
    nav-links, .nav-links {
        gap: 1px !important;
    }
    .nav-search-v2 {
        width: 130px !important;
    }
    .nav-search-v2:focus-within {
        width: 180px !important;
    }
    .nav-search-v2 input::placeholder {
        font-size: 0.75rem !important;
    }
}


/* ==========================================================
   ✨ SEARCH BAR & MIC BUTTON OVERLAP FIX (DESKTOP & LAPTOP) ✨
   Fixes input intrinsic min-width bug causing mic button to spill onto "Trang Chủ".
   ========================================================== */

@media (min-width: 1280px) {
    /* Fix input flex shrink bug */
    .nav-search-v2 {
        display: flex !important;
        align-items: center !important;
        position: relative !important;
        box-sizing: border-box !important;
        width: clamp(210px, 18vw, 300px) !important;
        min-width: 190px !important;
        margin-right: 6px !important;
        flex-shrink: 0 !important;
    }

    .nav-search-v2 input {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        width: 0 !important;
    }

    .nav-search-v2 .search-icon {
        flex-shrink: 0 !important;
    }

    .nav-search-v2 .vs-nav-mic-btn {
        flex-shrink: 0 !important;
        margin-left: 2px !important;
        margin-right: 4px !important;
    }

    /* Ensure desktopNavPill children stay separated */
    .desktop-nav-pill {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 4px 10px 4px 6px !important;
    }

    .desktop-nav-pill > div[style*="width:1px"] {
        margin: 0 8px !important;
        flex-shrink: 0 !important;
    }
}

@media (max-width: 1536px) and (min-width: 1280px) {
    .nav-search-v2 {
        width: clamp(180px, 15vw, 240px) !important;
        min-width: 170px !important;
    }
    .nav-search-v2:focus-within {
        width: clamp(220px, 20vw, 290px) !important;
    }
}

@media (max-width: 1366px) and (min-width: 1280px) {
    .nav-search-v2 {
        width: 170px !important;
        min-width: 160px !important;
    }
    .nav-search-v2:focus-within {
        width: 210px !important;
    }
}


/* ==========================================================
   ✨ ACTIVE NAV UNDERLINE PERFECT CENTERING FIX ✨
   Ensures yellow active indicator line is ALWAYS 100% centered under any active nav item regardless of screen size or padding.
   ========================================================== */

.nav-flat-link {
    position: relative !important;
}

.nav-flat-link::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0px !important;
    left: 50% !important;
    right: auto !important;
    width: clamp(20px, 65%, 44px) !important;
    height: 3px !important;
    background: linear-gradient(90deg, #f2f20d, #ffd700) !important;
    border-radius: 99px !important;
    box-shadow: 0 0 10px rgba(242, 242, 13, 0.7), 0 2px 4px rgba(0,0,0,0.5) !important;
    transform: translateX(-50%) scaleX(0) !important;
    transform-origin: center center !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.nav-flat-link:hover::after,
.nav-flat-link.active::after,
.nav-flat-dropdown.active > button.nav-flat-link::after,
.nav-flat-dropdown:hover > button.nav-flat-link::after {
    transform: translateX(-50%) scaleX(1) !important;
    left: 50% !important;
    right: auto !important;
}

/* ==========================================================
   HEADER NOTIFICATION BELL & DROPDOWN (ENTERPRISE POLISH)
   ========================================================== */
.nav-bell-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    color: #ffffff;
}

.nav-bell-trigger:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(252, 213, 118, 0.4);
    transform: scale(1.05);
    color: #fcd576;
}

.nav-bell-icon {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
}

.nav-bell-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #141724;
    box-shadow: 0 0 10px #ef4444;
}

/* Light Mode Bell Trigger */
html.light-mode .nav-bell-trigger {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #1e293b !important;
}

html.light-mode .nav-bell-trigger:hover {
    background: rgba(0, 0, 0, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    color: #d97706 !important;
}

html.light-mode .nav-bell-badge {
    border-color: #ffffff !important;
}

/* Dropdown Container */
.nav-notif-dropdown {
    position: absolute;
    top: 52px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 24px);
    max-height: 520px;
    background: linear-gradient(170deg, rgba(26, 29, 42, 0.98) 0%, rgba(17, 19, 28, 0.99) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 999999;
    transform-origin: top right;
    display: flex;
    flex-direction: column;
}

.nav-notif-arrow {
    position: absolute;
    top: -6px;
    right: 14px;
    width: 12px;
    height: 12px;
    background: #1a1d2a;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    transform: rotate(45deg);
    z-index: 10;
}

/* Header */
.nav-notif-header {
    padding: 16px 20px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.02);
    gap: 12px;
}

.nav-notif-header-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-notif-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-notif-title-text {
    font-size: 14.5px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.2px;
}

.nav-notif-count-pill {
    padding: 1px 7px;
    border-radius: 99px;
    background: linear-gradient(135deg, #fcd576 0%, #f59e0b 100%);
    color: #1a1000;
    font-size: 10.5px;
    font-weight: 850;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.nav-notif-sub-text {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.nav-notif-mark-read-btn {
    padding: 5px 11px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    outline: none;
}

.nav-notif-mark-read-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

/* List Container */
.nav-notif-list {
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.nav-notif-list::-webkit-scrollbar {
    width: 5px;
}

.nav-notif-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Item */
.nav-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.nav-notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.nav-notif-item.unread {
    background: rgba(99, 102, 241, 0.06);
}

.nav-notif-item.unread.type-coin {
    background: rgba(245, 158, 11, 0.06);
}

.nav-notif-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.nav-notif-icon-box.coin {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.nav-notif-icon-box.vip {
    background: rgba(236, 72, 153, 0.15);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: #f472b6;
}

.nav-notif-icon-box.movie {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
}

.nav-notif-icon-box.system {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
}

.nav-notif-pulse-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    border: 2px solid #1a1d2a;
}

.nav-notif-content {
    flex: 1;
    min-width: 0;
}

.nav-notif-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
    gap: 8px;
}

.nav-notif-type-tag {
    font-size: 9.5px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 1.5px 6px;
    border-radius: 5px;
    letter-spacing: 0.3px;
}

.nav-notif-type-tag.coin { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.nav-notif-type-tag.vip { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.nav-notif-type-tag.movie { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.nav-notif-type-tag.system { background: rgba(99, 102, 241, 0.2); color: #818cf8; }

.nav-notif-item-time {
    font-size: 10.5px;
    color: #64748b;
    font-weight: 550;
}

.nav-notif-item-title {
    font-size: 13px;
    font-weight: 750;
    color: #ffffff;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-notif-item.read .nav-notif-item-title {
    color: #cbd5e1;
}

.nav-notif-item-msg {
    font-size: 11.5px;
    color: #94a3b8;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer */
.nav-notif-footer {
    padding: 12px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
}

.nav-notif-view-all-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 10px 0;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-notif-view-all-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(252, 213, 118, 0.4);
    color: #fcd576;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
}

/* Empty State */
.nav-notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 38px 20px;
    text-align: center;
}

.nav-notif-empty-icon {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    margin-bottom: 12px;
}

.nav-notif-empty-title {
    font-size: 13.5px;
    font-weight: 750;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.nav-notif-empty-desc {
    font-size: 11.5px;
    color: #64748b;
}

/* LIGHT MODE OVERRIDES */
html.light-mode .nav-notif-dropdown {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(0, 0, 0, 0.09) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

html.light-mode .nav-notif-arrow {
    background: #ffffff !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
}

html.light-mode .nav-notif-header {
    background: #f8fafc !important;
    border-bottom-color: rgba(0, 0, 0, 0.07) !important;
}

html.light-mode .nav-notif-title-text {
    color: #0f172a !important;
}

html.light-mode .nav-notif-sub-text {
    color: #64748b !important;
}

html.light-mode .nav-notif-mark-read-btn {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: #334155 !important;
}

html.light-mode .nav-notif-mark-read-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

html.light-mode .nav-notif-item {
    border-bottom-color: rgba(0, 0, 0, 0.05) !important;
}

html.light-mode .nav-notif-item:hover {
    background: #f8fafc !important;
}

html.light-mode .nav-notif-item.unread {
    background: #f1f5f9 !important;
}

html.light-mode .nav-notif-pulse-dot {
    border-color: #ffffff !important;
}

html.light-mode .nav-notif-item-title {
    color: #0f172a !important;
}

html.light-mode .nav-notif-item.read .nav-notif-item-title {
    color: #475569 !important;
}

html.light-mode .nav-notif-item-msg {
    color: #64748b !important;
}

html.light-mode .nav-notif-footer {
    background: #f8fafc !important;
    border-top-color: rgba(0, 0, 0, 0.07) !important;
}

html.light-mode .nav-notif-view-all-btn {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: #1e293b !important;
}

html.light-mode .nav-notif-view-all-btn:hover {
    background: #f1f5f9 !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    color: #b45309 !important;
}

html.light-mode .nav-notif-empty-icon {
    background: #f1f5f9 !important;
    border-color: rgba(0, 0, 0, 0.07) !important;
}

html.light-mode .nav-notif-empty-title {
    color: #0f172a !important;
}

