/* Ẩn header mặc định của theme */
header#masthead, header.site-header { display: none !important; }

/* --- STYLES CHUNG & FIXED HEADER (HOẠT ĐỘNG 100% ỔN ĐỊNH TRÊN MOBILE) --- */
#mm-custom-header {
    font-family: var(--e-global-typography-text-font-family), sans-serif; 
    width: 100%;
    left: 0;
    right: 0;
    background: #F8F4E6;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    
    /* Sử dụng FIXED để loại bỏ hoàn toàn lỗi trôi header giữa màn hình do overflow:hidden của theme di động */
    position: fixed;
    top: 0;
    z-index: 9999;
}

/* Đẩy phần nội dung trang xuống dưới một khoảng KHÍT BẰNG chiều cao của header */
body {
    /* Chiều cao header desktop: padding (15px * 2) + logo (80px) = 110px */
    padding-top: 110px !important; 
}

@media (max-width: 1024px) {
    body {
        /* Chiều cao header mobile: padding (10px * 2) + logo (55px) = 75px */
        padding-top: 75px !important; 
    }
}

/* Tự động căn chỉnh vị trí header khi có thanh quản trị Admin Bar của WordPress */
.admin-bar #mm-custom-header {
    top: 32px;
}
@media (max-width: 782px) {
    .admin-bar #mm-custom-header {
        top: 46px;
    }
}

#mm-custom-header a { text-decoration: none; color: #111; }
#mm-custom-header ul { list-style: none; margin: 0; padding: 0; }

/* --- DESKTOP HEADER --- */
.mm-header-desktop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px; 
    max-width: 1200px; 
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.mm-logo img { max-height: 90px; width: auto; }

.mm-right-column {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
}

.mm-actions { display: flex; align-items: center; gap: 20px; }
.mm-flag { 
    display: flex; 
    align-items: center; 
}
.mm-phone-btn {
    background: linear-gradient(180deg, #F6F6E5 0%, #C0A989 100%); /* Màu gradient theo Figma */
    color: #111 !important; /* Đổi chữ thành màu tối để dễ đọc trên nền sáng */
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    font-weight: 600;
    border-radius: 4px; /* Thêm bo góc một chút nếu muốn giống thiết kế hơn */
}

.mm-phone-btn img { 
    width: 16px; 
    height: 16px; 
    filter: brightness(0); /* Bỏ invert(1) để icon giữ màu đen nguyên bản */ 
}

.mm-nav .mm-menu { display: flex; gap: 30px; align-items: center; font-weight: 600; font-size: 16px; }
.mm-nav .mm-menu > li { position: relative; padding: 5px 0; }
.mm-nav .mm-menu > li.menu-item-has-children > a::after {
    content: " ⌄";
    font-size: 12px;
    font-weight: 400;
    color: #555;
}

.mm-nav .mm-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    border-radius: 4px;
    padding: 10px 0;
}
.mm-nav .mm-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.mm-nav .mm-menu .sub-menu li a { display: block; padding: 10px 20px; font-weight: 500; font-size: 15px; }

/* --- MOBILE HEADER (SẮP XẾP LẠI THẲNG HÀNG GỌN GÀNG) --- */
.mm-header-mobile { display: none; }
.mm-mobile-nav-overlay {
    display: none;
    background: #F8F4E6;
    padding: 20px;
    border-top: 1px solid #eee;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

/* --- RESPONSIVE MOBILE/TABLET --- */
@media (max-width: 1024px) {
    .mm-header-desktop { display: none; }
    
    .mm-header-mobile {
        display: flex;
        align-items: center;
        justify-content: space-between; 
        padding: 10px 15px; 
        gap: 8px; 
    }
    
    .mm-logo-mobile { 
        order: 1;
        flex-shrink: 0; 
    }
    .mm-logo-mobile img { 
        max-height: 55px; 
        width: auto; 
        display: block;
    }

    .mm-search-bar { 
        order: 2;
        flex-grow: 1; 
        max-width: 180px; 
    }
    .mm-search-form {
        display: flex;
        align-items: center;
        background: #f4f4f4;
        border-radius: 8px;
        padding: 6px 10px;
        height: 36px; 
    }
    .mm-search-submit { 
        background: transparent; 
        border: none; 
        padding: 0; 
        margin-right: 6px; 
        cursor: pointer; 
        display: flex; 
    }
    .mm-search-submit img {
        width: 14px;
        height: 14px;
    }
    .mm-search-field {
        background: transparent !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
        -webkit-appearance: none;
        width: 100%;
        font-family: inherit;
        font-size: 14px;
    }
    
    .mm-flag-mobile { 
        order: 3;
        display: flex; 
        align-items: center; 
        flex-shrink: 0; 
    }
    
    .mm-hamburger {
        order: 4;
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
        flex-shrink: 0;
        padding: 5px;
        margin-left: 0 !important; 
    }
    .mm-hamburger span {
        display: block;
        width: 24px;
        height: 2px;
        background: #111;
        transition: 0.3s;
        border-radius: 2px;
    }

    .mm-mobile-nav-overlay.active { display: block; }
    .mm-mobile-menu li { border-bottom: 1px solid #f1f1f1; }
    .mm-mobile-menu li a { display: block; padding: 15px 0; font-weight: 600; }
    .mm-mobile-menu .sub-menu { padding-left: 15px; display: none; }
}

/* --- THÊM VÀO CUỐI FILE: MÀU HOVER VÀ ACTIVE CHO MENU --- */
.mm-nav .mm-menu > li > a:hover,
.mm-nav .mm-menu > li.current-menu-item > a,
.mm-nav .mm-menu > li.current-menu-ancestor > a {
    color: #C4A887 !important;
    transition: color 0.3s ease;
}

@media (max-width: 1024px) {
    .mm-mobile-menu li a:hover,
    .mm-mobile-menu li.current-menu-item > a {
        color: #C4A887 !important;
        transition: color 0.3s ease;
    }
}