/* ========== CSS Variables / Design Tokens (Premium B&W Edition) ========== */
:root {
    /* Light Theme (Premium Default) */
    --header-bg-top: transparent;
    --header-bg-scrolled: rgba(255, 255, 255, 0.85);
    --header-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
    --header-border: transparent;
    --header-border-scrolled: rgba(0, 0, 0, 0.08);

    --text-color: #111111;
    --text-muted: #666666;
    --menu-hover-bg: rgba(0, 0, 0, 0.05);
    /* Soft pill */
    --menu-hover-text: #000000;

    --toggle-bg: rgba(0, 0, 0, 0.04);
    --toggle-hover: rgba(0, 0, 0, 0.08);

    --body-bg: #fafafa;

    /* Mobile Menu */
    --mobile-menu-bg: rgba(255, 255, 255, 0.98);
    --hamburger-color: #111111;

    /* Modal */
    --modal-bg: rgba(255, 255, 255, 0.85);
    --modal-border: rgba(255, 255, 255, 0.5);

    /* Effects */
    --logo-glow: rgba(0, 0, 0, 0.1);
    --transition-speed: 0.4s;
}

[data-theme="dark"] {
    /* Dark Theme (Premium) */
    --header-bg-top: transparent;
    --header-bg-scrolled: rgba(10, 10, 10, 0.85);
    --header-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    --header-border: transparent;
    --header-border-scrolled: rgba(255, 255, 255, 0.08);

    --text-color: #f5f5f5;
    --text-muted: #999999;
    --menu-hover-bg: rgba(255, 255, 255, 0.08);
    /* Soft pill */
    --menu-hover-text: #ffffff;

    --toggle-bg: rgba(255, 255, 255, 0.06);
    --toggle-hover: rgba(255, 255, 255, 0.12);

    --body-bg: #050505;

    --mobile-menu-bg: rgba(15, 15, 15, 0.98);
    --hamburger-color: #f5f5f5;

    /* Modal Dark */
    --modal-bg: rgba(15, 15, 15, 0.85);
    --modal-border: rgba(255, 255, 255, 0.1);

    --logo-glow: rgba(255, 255, 255, 0.15);
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
}

    /* ========== Header (Glassmorphism Bóng Bóng + Viền gradient chạy) ========== */
    .vudev-header {
        position: fixed;
        top: 24px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 48px);
        max-width: 1280px;
        z-index: 1000;

        /* Background kính chính bên trong */
        background: var(--header-bg-top);
        backdrop-filter: blur(20px) saturate(150%);
        -webkit-backdrop-filter: blur(20px) saturate(150%);

        /* Hiệu ứng bóng bóng (Glossy Bubble) */
        box-shadow:
            inset 0 2px 10px rgba(255, 255, 255, 0.4),
            inset 0 -2px 10px rgba(0, 0, 0, 0.05),
            0 10px 40px rgba(0, 0, 0, 0.08);
        border-radius: 20px; /* Bo tròn vừa khít hiện đại */
        transition: all var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
    }

    /* Khi có bg từ theme tối / sáng */
    [data-theme="dark"] .vudev-header {
        box-shadow:
            inset 0 2px 10px rgba(255, 255, 255, 0.05),
            0 10px 40px rgba(0, 0, 0, 0.5);
    }

    .vudev-header.scrolled {
        top: 16px;
        background: var(--header-bg-scrolled);
        backdrop-filter: blur(30px) saturate(200%);
        -webkit-backdrop-filter: blur(30px) saturate(200%);
    }

    /* Khối Animated Border được Mask để loại bỏ ruột */
    .animated-border {
        position: absolute;
        inset: 0;
        border-radius: 20px; /* Bo đồng bộ Header */
        padding: 1.5px;
        /* Độ dày của viền */
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;
        pointer-events: none;
        z-index: -1;
        overflow: hidden;
        /* Quan trọng để cắt gọn góc tròn */
    }

    /* Khối gradient khổng lồ xoay bên dưới mask */
    .animated-border::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        /* Khối hình vuông cực lớn để xoay thành vòng tròn hoàn hảo không bị vát góc */
        width: 4000px;
        height: 4000px;
        background: conic-gradient(from 0deg, transparent 70%, #0ea5e9, #ec4899, #f59e0b, #10b981);
        transform-origin: center;
        transform: translate(-50%, -50%) rotate(0deg);
        animation: rotateBorder 4s linear infinite;
    }

    @keyframes rotateBorder {
        to {
            transform: translate(-50%, -50%) rotate(360deg);
        }
    }

    .header-container {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 40px;
        height: 68px;
    }

    /* ========== Logo ========== */
    .vudev-logo {
        display: flex;
        align-items: center;
        text-decoration: none;
        position: relative;
        z-index: 1001;
    }

    .vudev-logo .logo-text {
        font-size: 28px;
        font-weight: 800;
        letter-spacing: -0.5px;
        background: linear-gradient(to right, #0ea5e9, #ec4899, #f59e0b, #10b981, #0ea5e9);
        background-size: 200% 100%;
        background-position: 0% 50%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        -webkit-text-fill-color: transparent;
        animation: logoColorShift 3s linear infinite;
        transition: transform 0.3s ease, filter 0.3s ease;
    }

    .vudev-logo:hover .logo-text {
        transform: scale(1.02);
        filter: drop-shadow(0 0 10px var(--logo-glow));
    }

    @keyframes logoColorShift {
        0% { background-position: 0% 50%; }
        100% { background-position: 200% 50%; }
    }

    /* ========== Navigation Area (Right) ========== */
    .header-right {
        display: flex;
        align-items: center;
        gap: 24px;
    }

    .nav-menu {
        display: flex;
        align-items: center;
        list-style: none;
        gap: 4px;
        position: relative;
    }

    /* Sliding Background Highlight (Premium Effect) */
    .nav-highlight {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        background: rgba(14, 165, 233, 0.08);
        border-radius: 12px;
        z-index: 0;
        opacity: 0;
        pointer-events: none;
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
            width 0.4s cubic-bezier(0.25, 1, 0.5, 1),
            opacity 0.3s ease;
        box-shadow: 0 4px 15px rgba(14, 165, 233, 0.15);
    }

    .nav-link {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        font-size: 14.5px;
        font-weight: 500;
        color: var(--text-color);
        text-decoration: none;
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        z-index: 1;
        /* Đè lên trên Highlight Background */
    }

    .nav-link::after {
        content: '';
        position: absolute;
        bottom: 2px;
        left: 50%;
        transform: translateX(-50%) scaleX(0);
        width: 0;
        height: 2.5px;
        background: linear-gradient(90deg, #0ea5e9, #ec4899);
        border-radius: 2px;
        transition: transform 0.3s ease, width 0.3s ease;
        opacity: 0;
    }

    .nav-icon {
        width: 16px;
        height: 16px;
        opacity: 0.6;
        transition: all 0.3s ease;
    }

    .nav-link:hover,
    .nav-link.active {
        color: #0ea5e9;
        text-shadow: 0 0 8px rgba(14, 165, 233, 0.3);
    }

    .nav-link:hover::after,
    .nav-link.active::after {
        transform: translateX(-50%) scaleX(1);
        width: 60%;
        opacity: 1;
    }

    .nav-link:hover .nav-icon,
    .nav-link.active .nav-icon {
        opacity: 1;
        transform: scale(1.1);
        stroke: #ec4899;
    }

    /* ========== Tools (Theme, Lang) Premium Hover ========== */
    .header-tools {
        display: flex;
        align-items: center;
        gap: 12px;
        border-left: none;
        padding-left: 8px;
        position: relative;
        z-index: 10;
    }

    .tool-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        /* Tăng size để trông cân đối và dễ click hơn */
        height: 48px;
        border: 1px solid var(--header-border-scrolled);
        border-radius: 50%;
        background: var(--toggle-bg);
        color: var(--text-color);
        cursor: pointer;
        backdrop-filter: blur(10px);
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        position: relative;
        overflow: hidden;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
    }

    /* Ánh sáng tỏa ra từ bên trong khi hover */
    .tool-btn::before {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 50%;
        background: radial-gradient(circle at center, rgba(14, 165, 233, 0.15) 0%, transparent 70%);
        opacity: 0;
        transform: scale(0.5);
        transition: all 0.4s ease;
    }

    .tool-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
        border-color: rgba(14, 165, 233, 0.3);
    }

    .tool-btn:hover::before {
        opacity: 1;
        transform: scale(1.5);
    }

    .tool-btn:active {
        transform: translateY(1px) scale(0.95);
    }

    /* Theme SVG Icons Hào Quang */
    .theme-toggle svg {
        width: 24px;
        height: 24px;
        position: absolute;
        transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        z-index: 1;
    }

    .theme-toggle:hover .icon-sun {
        filter: drop-shadow(0 0 6px #f59e0b);
        color: #f59e0b;
        /* Mặt trời phát sáng vàng cam */
    }

    .theme-toggle:hover .icon-moon {
        filter: drop-shadow(0 0 6px #0ea5e9);
        color: #0ea5e9;
        /* Mặt trăng phát sáng xanh */
    }

    .theme-toggle .icon-sun {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }

    .theme-toggle .icon-moon {
        opacity: 0;
        transform: rotate(-90deg) scale(0.5);
    }

    [data-theme="dark"] .theme-toggle .icon-sun {
        opacity: 0;
        transform: rotate(90deg) scale(0.5);
    }

    [data-theme="dark"] .theme-toggle .icon-moon {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }

    /* Language Toggle Gradient Hover */
    .lang-toggle {
        font-size: 16px;
        font-weight: 800;
        letter-spacing: 0.5px;
    }

    .lang-toggle .lang-text {
        z-index: 1;
        position: relative;
        transition: all 0.3s ease;
    }

    .lang-toggle:hover .lang-text {
        background: linear-gradient(135deg, #0ea5e9, #ec4899);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        filter: drop-shadow(0 0 4px rgba(236, 72, 153, 0.4));
    }

    /* ========== Mobile Bottom Navigation ========== */
    .mobile-bottom-nav {
        display: none;
        position: fixed;
        bottom: 16px;
        left: 16px;
        width: calc(100% - 32px);
        height: 64px;
        background: var(--header-bg-top);
        backdrop-filter: blur(20px) saturate(150%);
        -webkit-backdrop-filter: blur(20px) saturate(150%);
        z-index: 1000;
        box-shadow:
            inset 0 2px 10px rgba(255, 255, 255, 0.4),
            inset 0 -2px 10px rgba(0, 0, 0, 0.05),
            0 10px 40px rgba(0, 0, 0, 0.08);
        border-radius: 20px;
        padding: 0;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
    }

    [data-theme="dark"] .mobile-bottom-nav {
        box-shadow:
            inset 0 2px 10px rgba(255, 255, 255, 0.05),
            0 10px 40px rgba(0, 0, 0, 0.5);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: var(--text-color);
        opacity: 0.5;
        text-decoration: none;
        position: relative;
        transition: all 0.3s ease;
    }

    .bottom-nav-item svg {
        width: 24px;
        height: 24px;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.3s ease;
    }

    .bottom-nav-item.active,
    .bottom-nav-item:hover {
        opacity: 1;
        color: var(--text-color);
    }

    .bottom-nav-item.active svg {
        stroke: #ec4899;
        transform: translateY(-2px);
    }

    .bottom-nav-item.active::after {
        content: '';
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 24px;
        height: 3px;
        border-radius: 4px;
        background: linear-gradient(90deg, #0ea5e9, #ec4899);
        box-shadow: 0 2px 10px rgba(236, 72, 153, 0.4);
    }

    /* ========== Responsive Điện Thoại - Máy Tính Bảng ========== */
    @media (max-width: 1060px) {
        .header-right { gap: 12px; flex-grow: 1; justify-content: flex-end; min-width: 0; }
        .nav-menu {
            flex-grow: 1;
            justify-content: flex-end;
            overflow-x: auto;
            scrollbar-width: none; /* Ẩn thanh cuộn */
            -ms-overflow-style: none; /* Ẩn thanh cuộn IE */
            padding: 4px;
        }
        .nav-menu::-webkit-scrollbar { display: none; }
        
        .nav-link { padding: 8px 10px; flex-shrink: 0; }
        .nav-link span { display: none; /* Trên màn hình 1060px đổ xuống chỉ hiển thị 100% icon */ }
        .nav-link svg { width: 22px; height: 22px; margin: 0; opacity: 1; }
    }

    @media (max-width: 860px) {
        /* Xóa nav menu ngang trên header */
        .nav-menu { 
            display: none !important;
        }

        .mobile-bottom-nav {
            display: flex;
        }

        body {
            padding-bottom: 70px;
        }
        
        /* Giữ toàn bộ công cụ tiện ích hiển thị */
        .header-tools {
            display: flex;
            padding-left: 0;
            gap: 6px;
            flex-shrink: 0;
        }

        .header-right { border: none; padding-left: 0; gap: 6px; }

        /* Vẫn duy trì form bo tròn viên dọc */
        .vudev-header {
            width: calc(100% - 24px);
            top: 16px;
            border-radius: 20px;
        }

        .animated-border { border-radius: 20px; }

        .header-container { padding: 0 24px; height: 60px; }

        .vudev-header.scrolled { top: 8px; padding: 0; }

        /* Thu nhỏ khối công cụ tiện ích để nhường không gian cho Menu nhưng vẫn to rõ */
        .tool-btn {
            width: 38px; height: 38px;
        }
        
        .theme-toggle svg { width: 18px; height: 18px; }
        .lang-toggle { font-size: 13px; }
    }

    @media (max-width: 480px) {
        .vudev-header {
            width: calc(100% - 12px);
            top: 10px;
            border-radius: 20px;
        }
        
        .animated-border { border-radius: 20px; }
        
        .vudev-header.scrolled { top: 6px; }

        .header-container {
            padding: 0 20px;
            height: 52px;
        }

        /* Kích thước Logo to rõ trên Mobile */
        .vudev-logo .logo-text { font-size: 22px; }
        
        .tool-btn {
            width: 36px; height: 36px;
            border-width: 0.5px;
        }
        
        .theme-toggle svg { width: 18px; height: 18px; }
        .lang-toggle { font-size: 12px; }

        .header-tools { gap: 4px; padding-left: 4px; }
        .header-right { gap: 4px; }
        .nav-link { padding: 6px; }
        .nav-link svg { width: 20px; height: 20px; }
    }

    /* ========== Cửa Hàng Premium Modal ========== */
    .store-modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        z-index: 2000;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease;
    }

    .store-modal-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .store-modal {
        background: var(--modal-bg);
        border: 1px solid var(--modal-border);
        border-radius: 28px;
        padding: 40px;
        max-width: 420px;
        width: 90%;
        text-align: center;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), inset 0 2px 10px rgba(255, 255, 255, 0.05);
        transform: scale(0.9) translateY(20px);
        transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .store-modal-overlay.active .store-modal {
        transform: scale(1) translateY(0);
    }

    .modal-icon-premium {
        width: 64px;
        height: 64px;
        margin: 0 auto 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(14, 165, 233, 0.1);
        color: #0ea5e9;
        box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
    }

    .modal-icon-premium svg {
        width: 32px;
        height: 32px;
    }

    .modal-title {
        font-size: 22px;
        font-weight: 800;
        margin-bottom: 12px;
        color: var(--text-color);
    }

    .modal-desc {
        font-size: 15px;
        color: var(--text-muted);
        line-height: 1.7;
        margin-bottom: 32px;
    }

    .premium-text-vudev {
        display: inline-block;
        font-size: 26px;
        font-weight: 900;
        margin: 8px 0;
        letter-spacing: 1px;
        background: linear-gradient(to right, #0ea5e9 0%, #a855f7 33%, #ec4899 66%, #0ea5e9 100%);
        background-size: 300% auto;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: #0ea5e9;
        animation: premiumShine 3s linear infinite;
    }

    @keyframes premiumShine {
        to {
            background-position: 300% center;
        }
    }

    .modal-actions-premium {
        display: flex;
        gap: 16px;
    }

    .btn-premium-no,
    .btn-premium-yes {
        flex: 1;
        padding: 14px;
        border-radius: 14px;
        font-size: 16px;
        font-weight: 700;
        cursor: pointer;
        border: none;
        transition: all 0.3s ease;
    }

    .btn-premium-no {
        background: var(--toggle-bg);
        color: var(--text-color);
    }

    .btn-premium-no:hover {
        background: var(--toggle-hover);
    }

    .btn-premium-yes {
        background: linear-gradient(135deg, #0ea5e9, #ec4899);
        color: #fff;
        box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    }

    .btn-premium-yes:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(236, 72, 153, 0.6);
    }