/* ===================================
   MOBILE HEADER SYNCHRONIZATION
   Đồng bộ logo và hamburger button cho tất cả trang
   =================================== */

/* Tablet và Mobile (≤ 992px) */
@media (max-width: 992px) {
    /* Tăng kích thước logo giống trang chủ */
    .header .logo img {
        height: 90px !important;
        width: auto !important;
    }
    
    /* Đảm bảo header container có position relative */
    .header .container {
        display: contents !important;
    }
    
    /* Căn hamburger button giữa bên phải header - chỉ khi không có wrapper */
    .mobile-menu-btn {
        display: flex !important;
        position: static !important;
        top: auto !important;
        right: auto !important;
        transform: none !important;
        z-index: 10000 !important;
        width: 50px !important;
        height: 50px !important;
        background: #159611 !important;
        border: none !important;
        border-radius: 12px !important;
        cursor: pointer !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 5px !important;
        padding: 12px !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
        transition: all 0.3s ease !important;
    }
    
    /* Icon bars (3 gạch ngang) */
    .mobile-menu-btn span {
        display: block !important;
        width: 26px !important;
        height: 3px !important;
        background: white !important;
        border-radius: 2px !important;
        transition: all 0.3s ease !important;
    }
    
    /* Hover/active */
    .mobile-menu-btn:hover {
        background: #1aad13 !important;
        transform: scale(1.05) !important;
    }
    
    .mobile-menu-btn.active {
        background: #d32f2f !important;
        transform: none !important;
    }
    
    /* Animation cho icon khi active */
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px) !important;
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0 !important;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(8px, -8px) !important;
    }
    
    /* Padding top cho body */
    body {
        padding-top: 110px !important;
    }
}

/* Mobile lớn (≤ 768px) */
@media (max-width: 768px) {
    /* Logo size cho mobile lớn */
    .header .logo img {
        height: 80px !important;
    }
    
    /* Điều chỉnh vị trí và kích thước hamburger */
    .mobile-menu-btn {
        width: 45px !important;
        height: 45px !important;
        right: 15px !important;
    }
    
    /* Icon bars size */
    .mobile-menu-btn span {
        width: 22px !important;
        height: 2.5px !important;
    }
    
    /* Header container padding */
    .header .container {
        padding: 15px 20px !important;
    }
    
    /* Padding top cho body */
    body {
        padding-top: 100px !important;
    }
}

/* Mobile nhỏ (≤ 480px) */
@media (max-width: 480px) {
    /* Logo size cho mobile nhỏ */
    .header .logo img {
        height: 70px !important;
    }
    
    /* Điều chỉnh vị trí và kích thước hamburger */
    .mobile-menu-btn {
        width: 42px !important;
        height: 42px !important;
        right: 12px !important;
    }
    
    /* Icon bars size */
    .mobile-menu-btn span {
        width: 20px !important;
        height: 2.5px !important;
    }
    
    /* Header container padding */
    .header .container {
        padding: 12px 15px !important;
    }
    
    /* Padding top cho body */
    body {
        padding-top: 90px !important;
    }
}

/* Đảm bảo logo không bị méo */
.header .logo img {
    object-fit: contain !important;
}

/* Smooth transition */
.header .logo img {
    transition: height 0.3s ease !important;
}

/* Fix cho banner */
@media (max-width: 992px) {
    .banner,
    .banner-section {
        margin-top: 0 !important;
    }
}

/* ===================================
   MOBILE HEADER ACTIONS (Language + Hamburger)
   =================================== */

/* Ẩn mobile-header-actions trên desktop */
.mobile-header-actions {
    display: none;
}

/* Ẩn mobile-lang-switcher mặc định */
.mobile-lang-switcher {
    display: none;
}

@media (max-width: 992px) {
    /* Hiện wrapper trên mobile */
    .mobile-header-actions {
        display: flex !important;
        align-items: center;
        gap: 10px;
        position: fixed !important;
        top: 22px !important;
        right: 15px !important;
        transform: none !important;
        z-index: 10001 !important;
        flex-shrink: 0;
        pointer-events: auto !important;
    }

    /* Hiện language switcher mobile */
    .mobile-lang-switcher {
        display: flex !important;
        align-items: center;
        gap: 4px;
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 5px 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .mobile-lang-switcher a {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2px 4px;
        border-radius: 4px;
        transition: background 0.2s ease, transform 0.2s ease;
        text-decoration: none;
    }

    .mobile-lang-switcher a:hover,
    .mobile-lang-switcher a:active {
        background: rgba(21, 150, 17, 0.1);
        transform: scale(1.1);
    }

    .mobile-lang-switcher .flag-img {
        width: 28px !important;
        height: 19px !important;
        border-radius: 3px;
        object-fit: cover;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        display: block;
    }

    /* Divider giữa 2 flag */
    .mobile-lang-switcher a:first-child {
        border-right: 1px solid #e0e0e0;
        padding-right: 6px;
        margin-right: 2px;
    }

    /* Hamburger button trong wrapper - reset position về static */
    .mobile-header-actions .mobile-menu-btn {
        position: static !important;
        transform: none !important;
        top: auto !important;
        right: auto !important;
    }

    .mobile-header-actions .mobile-menu-btn:hover {
        transform: scale(1.05) !important;
    }

    .mobile-header-actions .mobile-menu-btn.active {
        transform: none !important;
    }

    /* Ẩn language switcher gốc trên mobile */
    .user-section .language {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .mobile-lang-switcher .flag-img {
        width: 26px !important;
        height: 17px !important;
    }

    .mobile-lang-switcher {
        padding: 4px 7px;
    }

    .mobile-header-actions {
        gap: 8px !important;
    }
}

@media (max-width: 480px) {
    .mobile-lang-switcher .flag-img {
        width: 24px !important;
        height: 16px !important;
    }

    .mobile-lang-switcher {
        padding: 4px 6px;
        gap: 3px;
    }

    .mobile-lang-switcher a:first-child {
        padding-right: 5px;
        margin-right: 1px;
    }

    .mobile-header-actions {
        gap: 6px !important;
    }
}
