/* ==========================================================================
   HEADER SYSTEM - LIVING HOPE DESIGN (HOÀN CHỈNH 100%)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. KHUNG CHUNG VÀ XỬ LÝ NỀN HEADER (HAS BANNER / NO BANNER)
   -------------------------------------------------------------------------- */
/* Mặc định trên trang KHÔNG CÓ BANNER (/faqs/, /contact-us/...) -> Nền --color-primary (#F7FCFF), Chữ xanh */
.site-header,
.site-header.site-header--no-banner {
    width: 100%;
    position: relative;
    background-color: var(--color-primary-second, #456967);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 999;
    font-family: var(--font-body, sans-serif);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}
/* KHI CÓ BANNER (.site-header--has-banner) -> Trong suốt nằm đè lên Hero */
.site-header.site-header--has-banner {
    position: absolute;
    top: 0;
    left: 0;
    background-color: transparent;
    box-shadow: none;
}

/* Đẩy Header xuống khi đăng nhập Admin Bar WordPress */
.admin-bar .site-header {
    top: 0;
}

.admin-bar .site-header.site-header--has-banner {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .site-header.site-header--has-banner {
        top: 46px;
    }
}

.header-container {
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.desktop-only { display: flex !important; }
.desktop-hide { display: none !important; }

/* --------------------------------------------------------------------------
   2. TOP BAR (NỀN XANH SAGE / SLATE)
   -------------------------------------------------------------------------- */
.header-topbar {
    background-color: var(--color-primary-third, #74A59F);
    color: #ffffff;
    font-size: 13px;
    padding: 6px 0;
}

.topbar-left, 
.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    line-height: 1;
}

.topbar-item svg {
    flex-shrink: 0;
}

.topbar-phone:hover {
    text-decoration: underline;
}

/* Nút "Make an appointment" trên Topbar Desktop */
.btn-topbar-appointment {
    background-color: #ffffff;
    color: var(--color-primary-second, #456967);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-topbar-appointment:hover {
    background-color: var(--color-surface, #F7F2EE);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   3. ĐỊNH DẠNG 2 LÁ CỜ NGÔN NGỮ
   -------------------------------------------------------------------------- */
.topbar-flags {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.topbar-flags .flag-link {
    display: inline-flex !important;
    align-items: center;
    line-height: 1 !important;
    text-decoration: none !important;
    opacity: 0.75;
    transition: all 0.2s ease;
}

.topbar-flags .flag-link:hover,
.topbar-flags .flag-link.active {
    opacity: 1 !important;
    transform: scale(1.1);
}

.topbar-flags .flag-link img {
    width: 24px !important;
    height: 16px !important;
    object-fit: cover !important;
    border-radius: 2px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
    display: block !important;
}

/* GTranslate Styling & Alignment */
.gtranslate_wrapper {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
}

.gtranslate_wrapper .gt_float_switcher {
    box-shadow: none !important;
    background: transparent !important;
}

.gtranslate_wrapper a {
    display: inline-flex !important;
    align-items: center !important;
}

/* --------------------------------------------------------------------------
   4. MAINBAR & MENU CHÍNH DESKTOP
   -------------------------------------------------------------------------- */
.header-mainbar {
    padding: 16px 0;
    background: transparent;
    transition: padding 0.3s ease;
}

/* Logo tròn */
.header-logo a {
    display: flex;
    align-items: center;
}

.header-logo img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #ffffff;
    object-fit: contain;
    padding: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.header-logo img:hover {
    transform: scale(1.03);
}

/* WordPress Menu List Desktop */
.header-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 32px;
}

.header-menu-list > li {
    position: relative;
}

/* Mặc định (Nền trắng): Chữ xanh */
.header-menu-list > li > a {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 0;
    position: relative;
    display: inline-block;
    transition: all 0.3s ease;
}

.header-menu-list > li.current-menu-item > a::after,
.header-menu-list > li > a:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2.5px;
    background-color: #ffffff;
    border-radius: 2px;
}

/* Dropdown Submenu */
.header-menu-list .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: #ffffff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    padding: 8px 0;
    margin: 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.header-menu-list > li:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-menu-list .sub-menu li a {
    display: block;
    padding: 8px 16px;
    color: var(--color-primary-second, #456967);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.header-menu-list .sub-menu li a:hover {
    background-color: var(--color-surface, #F7F2EE);
}

/* --------------------------------------------------------------------------
   5. STICKY HEADER KHI CUỘN CHUỘT (BẰNG CHIỀU CAO VÀ KÍCH THƯỚC CHÍNH)
   -------------------------------------------------------------------------- */
.site-header.is-sticky {
    position: fixed !important;
    top: 0;
    left: 0;
    background-color: var(--color-primary-second, #456967) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18) !important;
    animation: slideDownSticky 0.35s ease forwards;
}

/* Chuyển chữ sang Trắng khi Sticky */
.site-header.is-sticky .header-menu-list > li > a {
    color: #ffffff !important;
}

.site-header.is-sticky .header-menu-list > li.current-menu-item > a::after,
.site-header.is-sticky .header-menu-list > li > a:hover::after {
    background-color: #ffffff !important;
}

.site-header.is-sticky .mobile-menu-toggle .bar {
    background-color: #ffffff !important;
}

/* Đồng bộ vị trí Sticky với Admin Bar */
.admin-bar .site-header.is-sticky {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .site-header.is-sticky {
        top: 46px;
    }
}

@media (max-width: 600px) {
    .admin-bar .site-header.is-sticky {
        top: 0;
    }
}

/* Ẩn Topbar khi Sticky */
.site-header.is-sticky .header-topbar {
    display: none !important;
}

/* GIỮ NGUYÊN PADDING VÀ DUNG LƯỢNG LOGO KHI STICKY ĐỂ HEADER BẰNG NGUYÊN BẢN */
.site-header.is-sticky .header-mainbar {
    padding: 16px 0;
}

.site-header.is-sticky .header-logo img {
    width: 70px;
    height: 70px;
}

@keyframes slideDownSticky {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   6. MOBILE RESPONSIVE (< 991px)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    .desktop-only { display: none !important; }
    .desktop-hide { display: flex !important; }

    .header-topbar {
        background-color: var(--color-primary-second, #456967);
        padding: 8px 0;
    }

    .header-mainbar {
        padding: 10px 0;
    }

    .header-logo img {
        width: 52px;
        height: 52px;
    }

    /* Đảm bảo khi Mobile Sticky, kích thước logo & padding giữ đúng tỉ lệ Mobile */
    .site-header.is-sticky .header-mainbar {
        padding: 10px 0;
    }

    .site-header.is-sticky .header-logo img {
        width: 52px;
        height: 52px;
    }

    /* Cụm chứa nút Appointment + Hamburger */
    .header-mobile-actions {
        display: flex !important;
        align-items: center;
        gap: 12px;
    }

    .btn-mobile-appointment {
        background-color: #ffffff;
        color: var(--color-primary-second, #456967);
        font-size: 12px;
        font-weight: 700;
        padding: 6px 12px;
        border-radius: 4px;
        text-decoration: none;
        white-space: nowrap;
        line-height: 1.2;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
        transition: all 0.2s ease;
    }

    .btn-mobile-appointment:active {
        transform: scale(0.96);
    }

    /* Nút Hamburger 3 gạch */
    .mobile-menu-toggle {
        background: transparent;
        border: none;
        width: 28px;
        height: 20px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 0;
        cursor: pointer;
    }

    .mobile-menu-toggle .bar {
        display: block;
        width: 100%;
        height: 3px;
        background-color: var(--color-primary-second, #456967);
        border-radius: 2px;
    }

    .site-header--has-banner .mobile-menu-toggle .bar {
        background-color: #ffffff;
    }

    /* Mobile Drawer Overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0; 
        left: 0;
        width: 100vw; 
        height: 100vh;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(3px);
        opacity: 0; 
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 9999;
    }

    .mobile-menu-overlay.open {
        opacity: 1; 
        visibility: visible;
    }

    /* Mobile Drawer Inner Container */
    .mobile-menu-inner {
        position: absolute;
        top: 0; 
        right: 0;
        width: 80%; 
        max-width: 320px;
        height: 100%;
        background-color: #ffffff;
        padding: 24px 20px;
        box-sizing: border-box;
        transform: translateX(100%);
        transition: all 0.3s ease;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        overflow-y: auto;
    }

    .mobile-menu-overlay.open .mobile-menu-inner {
        transform: translateX(0);
    }

    /* Nút X đóng menu */
    .mobile-menu-close {
        align-self: flex-end;
        background: none;
        border: none;
        font-size: 32px;
        color: var(--color-primary-second, #456967);
        cursor: pointer;
        line-height: 1;
        margin-bottom: 20px;
    }

    /* Danh sách Menu đẩy sát lên phía trên */
    .mobile-menu-list {
        list-style: none;
        padding: 0; 
        margin: 0;
    }

    .mobile-menu-list li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    .mobile-menu-list li a {
        display: block;
        padding: 14px 0;
        color: var(--color-primary-second, #456967);
        font-size: 15px;
        font-weight: 700;
        text-decoration: none;
        text-transform: uppercase;
    }
}

/* --------------------------------------------------------------------------
   7. MÀN HÌNH ĐIỆN THOẠI SIÊU NHỎ (< 380px)
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
    .header-container {
        padding: 0 14px;
    }

    .header-mobile-actions {
        gap: 8px;
    }

    .btn-mobile-appointment {
        font-size: 11px;
        padding: 5px 8px;
    }

    .header-logo img,
    .site-header.is-sticky .header-logo img {
        width: 44px;
        height: 44px;
    }
}