/* --------------------------------------------------------------------------
   1. ĐỊNH DẠNG CƠ BẢN & KHUNG HEADER FIXED 100% TRÀN MÀN HÌNH
   -------------------------------------------------------------------------- */
.agency-header-v2,
.agency-header-v2 input,
.agency-header-v2 button,
.agency-header-v2 a,
.agency-header-v2 span {
    font-family: var( --font-sans), -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* Mặc định trên các Trang con: Nền Trắng tuyền ngay từ đầu */
.agency-header-v2 {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100%;
    z-index: 1000;
    background-color: #ffffff !important;
    border-bottom: 1px solid #eaeaea !important;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body.admin-bar .agency-header-v2 {
    top: 32px !important;
}

/* KHUNG CONTAINER NẰM TRONG 1200PX CĂN GIỮA */
.ah-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    position: relative;
}

/* --------------------------------------------------------------------------
   2. QUY TẮC BÙ KHOẢNG CÁCH PADDING (OFFSET)
   -------------------------------------------------------------------------- */

/* Các Trang Con KHÔNG CÓ BANNER: Tự động đẩy nội dung xuống dưới đàng hoàng */
body:not(.home):not(.front-page):not(.has-top-banner) .site-main {
    padding-top: clamp(80px, 9vw, 110px) !important;
}

/* Trang Chủ / Trang có Banner
body.home .site-main,
body.front-page .site-main,
body.home #page,
body.home #content,
body.home .site-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Dùng Margin âm ép bức ảnh Banner chui lên lấp mảng trắng phía sau Header */
body.home .site-main > :first-child,
body.front-page .site-main > :first-child,
body.home .elementor-section:first-child,
body.front-page .elementor-section:first-child,
body.home .hero-section,
body.home .site-banner {
    margin-top: -110px !important;
    padding-top: 110px !important;
}

/* --------------------------------------------------------------------------
   3. SWAP LOGO MẶC ĐỊNH (MẶC ĐỊNH HIỆN LOGO XANH GỐC, ẨN LOGO TRẮNG)
   -------------------------------------------------------------------------- */
.ah-logo img.logo-main { display: block !important; }
.ah-logo img.logo-white { display: none !important; }

/* --------------------------------------------------------------------------
   4. DESKTOP LAYOUT (1200PX)
   -------------------------------------------------------------------------- */
.desktop-hide { display: none !important; }
.ah-mobi-search-dropdown, .ah-mobile-menu-overlay { display: none !important; }

@media(max-width: 850px) {
    .desktop-only { display: none !important; }
    .desktop-hide { display: flex !important; }
}

.ah-logo {
    flex: 1 1 0%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.ah-logo img {
    max-height: 50px;
    width: auto;
    display: block;
}

.ah-main-nav {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
}

.ah-right-wrapper {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.ah-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 32px;
}

.ah-menu-list>li {
    position: relative;
    padding: 15px 0;
}

.ah-menu-list>li>a {
    font-size: 15px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    color: #637159;
    display: flex;
    align-items: center;
    transition: 0.3s;
}

.ah-menu-list>li>a:hover {
    color: #4a5c41 !important;
}

.ah-menu-list>li>a svg {
    margin-left: 5px;
    stroke: #637159;
    transition: 0.3s;
}

.ah-menu-list>li:hover>a svg {
    transform: rotate(180deg);
}

.ah-contact-top a {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: #333333;
    text-decoration: none;
}

.ah-actions-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.ah-search-form {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.ah-search-input {
    width: 220px;
    height: 36px;
    background: transparent !important;
    border: 1px solid #dcdcdc !important;
    border-radius: 2px !important;
    padding: 0 10px 0 35px !important;
    font-size: 14px !important;
    color: #333333;
    outline: none;
    box-sizing: border-box;
}

.ah-search-input:focus {
    border-color: #999999 !important;
}

.ah-search-icon {
    position: absolute;
    left: 12px;
    color: #888888;
    pointer-events: none;
}

/* NÚT GIỎ HÀNG VÀ THẺ SỐ ĐẾM THÔNG BÁO */
.ah-cart-wrapper {
    position: relative !important;
    display: inline-block !important;
}

.ah-cart-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    border: 1px solid #dcdcdc !important;
    border-radius: 4px !important;
    color: #333333;
    text-decoration: none !important;
    box-sizing: border-box !important;
    cursor: pointer;
    background: transparent;
    position: relative !important;
    transition: all 0.3s ease !important;
}

.ah-cart-btn:hover {
    border-color: #999999 !important;
}

.ah-cart-btn svg {
    stroke: #333333;
}

.ah-cart-count {
    position: absolute !important;
    top: -6px !important;
    right: -6px !important;
    background-color: #456C35 !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    min-width: 17px !important;
    height: 17px !important;
    line-height: 17px !important;
    border-radius: 50% !important;
    text-align: center !important;
    padding: 0 3px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #ffffff !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2) !important;
    z-index: 5 !important;
}

/* --------------------------------------------------------------------------
   5. MEGA MENU DESKTOP 
   -------------------------------------------------------------------------- */
.ah-mega-wrapper {
    position: absolute;
    top: 100%;
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s ease;
    z-index: 1000;
    text-align: left;
}

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

.ah-has-mega.ah-mega-full {
    position: static !important;
}

.ah-mega-products {
    left: 50% !important;
    right: auto !important;
    width: 100vw !important;
    transform: translateX(-50%) translateY(15px) !important;
    padding: 20px 0 !important;
    box-sizing: border-box;
    border-left: none !important;
    border-right: none !important;
}

.ah-menu-list>li:hover .ah-mega-products {
    transform: translateX(-50%) translateY(0) !important;
}

.ah-mega-products .mega-grid-4 {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.ah-mega-services,
.ah-mega-projects {
    left: 50%;
    transform: translate(-50%, 15px);
    width: 500px;
    padding: 20px;
    box-sizing: border-box;
}

.ah-menu-list>li:hover .ah-mega-services,
.ah-menu-list>li:hover .ah-mega-projects {
    transform: translate(-50%, 0);
}

.mega-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.mega-heading {
    display: block;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: #4a5c41 !important;
    margin-bottom: 20px !important;
    text-decoration: none !important;
}

.mega-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-col ul li {
    margin-bottom: 12px;
}

.mega-col ul li a {
    font-size: 14px !important;
    color: #555555 !important;
    text-decoration: none !important;
    transition: 0.3s;
}

.mega-col ul li a:hover {
    color: #7da061 !important;
}

/* --------------------------------------------------------------------------
   6. WOOCOMMERCE MINI CART DROPDOWN 
   -------------------------------------------------------------------------- */
.ah-mini-cart-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 330px;
    background: #ffffff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
    padding: 20px !important;
    z-index: 1005;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    cursor: default;
    text-align: left !important;
}

.ah-mini-cart-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ah-mini-cart-dropdown .widget_shopping_cart_content {
    width: 100% !important;
}

.ah-mini-cart-dropdown ul.cart_list,
.ah-mini-cart-dropdown ul.product_list_widget {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    max-height: 280px;
    overflow-y: auto;
}

.ah-mini-cart-dropdown ul.cart_list li,
.ah-mini-cart-dropdown ul.product_list_widget li {
    display: block !important;
    position: relative !important;
    padding: 12px 25px 12px 70px !important;
    min-height: 75px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    list-style-type: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.ah-mini-cart-dropdown ul.cart_list li::before,
.ah-mini-cart-dropdown ul.product_list_widget li::before {
    display: none !important;
}

.ah-mini-cart-dropdown ul.cart_list li img,
.ah-mini-cart-dropdown ul.product_list_widget li img {
    position: absolute !important;
    left: 0 !important;
    top: 12px !important;
    width: 55px !important;
    height: 55px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    border: 1px solid #eee !important;
    margin: 0 !important;
    float: none !important;
    display: block !important;
}

.ah-mini-cart-dropdown ul.cart_list li a:not(.remove),
.ah-mini-cart-dropdown ul.product_list_widget li a:not(.remove) {
    color: #333333 !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    line-height: 1.35 !important;
    text-decoration: none !important;
    display: block !important;
    margin-bottom: 4px !important;
    transition: color 0.2s ease;
}

.ah-mini-cart-dropdown ul.cart_list li a:not(.remove):hover,
.ah-mini-cart-dropdown ul.product_list_widget li a:not(.remove):hover {
    color: #456C35 !important;
}

.ah-mini-cart-dropdown ul.cart_list li .quantity,
.ah-mini-cart-dropdown ul.product_list_widget li .quantity {
    display: block !important;
    font-size: 12px !important;
    color: #777777 !important;
    font-weight: 500 !important;
}

.ah-mini-cart-dropdown ul.cart_list li .quantity .amount,
.ah-mini-cart-dropdown ul.product_list_widget li .quantity .amount {
    color: #456C35 !important;
    font-weight: 700 !important;
}

.ah-mini-cart-dropdown ul.cart_list li a.remove,
.ah-mini-cart-dropdown ul.product_list_widget li a.remove {
    position: absolute !important;
    right: 0 !important;
    top: 12px !important;
    color: #999999 !important;
    font-size: 18px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    width: 22px !important;
    height: 22px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    transition: all 0.2s ease;
    border: none !important;
    background: transparent !important;
}

.ah-mini-cart-dropdown ul.cart_list li a.remove:hover,
.ah-mini-cart-dropdown ul.product_list_widget li a.remove:hover {
    color: #e24040 !important;
    background-color: #fce4e4 !important;
}

.ah-mini-cart-dropdown .woocommerce-mini-cart__total {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-top: 1px solid #eeeeee !important;
    margin: 15px 0 0 0 !important;
    padding: 15px 0 0 0 !important;
    font-weight: 600 !important;
    color: #333333 !important;
    font-size: 14px !important;
}

.ah-mini-cart-dropdown .woocommerce-mini-cart__total .amount {
    color: #374426 !important;
    font-weight: 700 !important;
    font-size: 15px !important;
}

.ah-mini-cart-dropdown .woocommerce-mini-cart__buttons {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    margin: 15px 0 0 0 !important;
    padding: 0 !important;
}

.ah-mini-cart-dropdown .woocommerce-mini-cart__buttons a {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 10px 0 !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
}

.ah-mini-cart-dropdown .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout) {
    background-color: #456C35 !important;
    color: #ffffff !important;
    border: 1px solid #456C35 !important;
}

.ah-mini-cart-dropdown .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout):hover {
    background-color: #374426 !important;
    border-color: #374426 !important;
}

.ah-mini-cart-dropdown .woocommerce-mini-cart__buttons a.button.checkout {
    background-color: #0F0F0F !important;
    color: #ffffff !important;
    border: 1px solid #0F0F0F !important;
}

.ah-mini-cart-dropdown .woocommerce-mini-cart__buttons a.button.checkout:hover {
    background-color: #222222 !important;
    border-color: #222222 !important;
}

/* --------------------------------------------------------------------------
   7. MOBILE INTERFACE SYSTEM (ĐÃ CẬP NHẬT KIỂU MENU GIỐNG HỆT ĐÚNG ẢNH MẪU)
   -------------------------------------------------------------------------- */
@media (max-width: 850px) {
    .ah-container { padding: 10px 15px; }
    .ah-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); flex: none; }
    .ah-logo img { max-height: 40px !important; }

    .ah-mobile-left { flex: 1; display: flex; justify-content: flex-start; align-items: center; z-index: 1001; }
    .ah-mobile-right { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 15px; z-index: 10; }

    .ah-mobile-menu-toggle { background: transparent !important; border: none !important; padding: 0 !important; margin: 0 !important; cursor: pointer; width: 24px; height: 18px; display: flex; flex-direction: column; justify-content: space-between; }
    .ah-mobile-menu-toggle .bar { display: block; width: 100%; height: 2px; background-color: #333333; border-radius: 2px; transition: all 0.3s ease-in-out; }
    .ah-mobile-menu-toggle.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .ah-mobile-menu-toggle.active .bar:nth-child(2) { opacity: 0; }
    .ah-mobile-menu-toggle.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .ah-mobile-search-trigger { background: transparent !important; border: none !important; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #333333; }

    .ah-mobi-search-dropdown { display: none !important; position: absolute; top: 100%; left: 0; width: 100%; background: #ffffff !important; padding: 15px 20px; border-top: 1px solid #eee; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08); z-index: 998; box-sizing: border-box; }
    .ah-mobi-search-dropdown.open { display: block !important; }

    .ah-mobile-cart { position: relative; }
    .ah-mobile-cart .ah-cart-btn { border-color: #dcdcdc; background: transparent !important; }
    .ah-mobile-cart .ah-mini-cart-dropdown { top: calc(100% + 15px); right: -10px; width: 320px; max-width: calc(100vw - 20px); }

    /* MÀN HÌNH MỜ PHÍA SAU KHI MỞ MENU */
    .ah-mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.3) !important;
        backdrop-filter: blur(2px);
        z-index: 999;
        overflow-y: auto;
        padding: 75px 20px 30px 20px;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        box-sizing: border-box;
    }
    .ah-mobile-menu-overlay.open {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }

    /* KHUNG NỘI DUNG MENU BO GÓC NẰM GIỮA (CARD DESIGN) */
    .ah-mobile-menu-inner {
        background: #ffffff !important;
        border-radius: 6px !important;
        padding: 8px 0 !important;
        max-width: 100%;
        margin: 0 auto;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
        overflow: hidden;
    }
    .ah-mobile-menu-list { list-style: none; margin: 0; padding: 0; }
    .ah-mobile-menu-list>li { border-bottom: 1px solid #f2f2f2; }
    .ah-mobile-menu-list>li:last-child { border-bottom: none; }
    
    .ah-mobile-menu-list>li>a, .menu-item-flex>a {
        display: block;
        padding: 14px 20px;
        font-size: 15px;
        font-weight: 500;
        color: #222222;
        text-decoration: none;
        flex: 1;
      font-family: var( --font-sans), -apple-system, BlinkMacSystemFont, sans-serif !important;
    }
    .menu-item-flex { display: flex; justify-content: space-between; align-items: stretch; width: 100%; box-sizing: border-box; }
    .toggle-sub { width: 50px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #888; }
    .toggle-sub.active svg { transform: rotate(180deg); color: #7da061; }
    .sub-menu { list-style: none; margin: 0; padding: 0; display: none; background-color: #fff !important; width: 100%; box-sizing: border-box; }
    .sub-menu li a { display: block; padding: 12px 20px 12px 35px; font-size: 15px; color: #000; text-decoration: none; border-bottom: 1px solid #f0f0f0;font-family: var( --font-sans), -apple-system, BlinkMacSystemFont, sans-serif !important; }
}

/* ==========================================================================
   8. ĐẶT TOÀN BỘ QUY TẮC ĐỔI MÀU TRẮNG KHI TRONG SUỐT Ở DƯỚI CÙNG
   ========================================================================== */

/* BAN ĐẦU Ở TRANG CHỦ (CHƯA CUỘN > 30PX): TRONG SUỐT HOÀN TOÀN */
body.home .agency-header-v2:not(.is-scrolled),
body.front-page .agency-header-v2:not(.is-scrolled) {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: none !important;
}

/* TRÁO LOGO TRẮNG KHI TRONG SUỐT */
body.home .agency-header-v2:not(.is-scrolled) .ah-logo img.logo-main,
body.front-page .agency-header-v2:not(.is-scrolled) .ah-logo img.logo-main {
    display: none !important;
}

body.home .agency-header-v2:not(.is-scrolled) .ah-logo img.logo-white,
body.front-page .agency-header-v2:not(.is-scrolled) .ah-logo img.logo-white {
    display: block !important;
}

/* CHỮ, SỐ ĐIỆN THOẠI VÀ ICON MÀU TRẮNG TINH KHI TRONG SUỐT */
body.home .agency-header-v2:not(.is-scrolled) .ah-menu-list > li > a,
body.front-page .agency-header-v2:not(.is-scrolled) .ah-menu-list > li > a,
body.home .agency-header-v2:not(.is-scrolled) .ah-contact-top a,
body.front-page .agency-header-v2:not(.is-scrolled) .ah-contact-top a,
body.home .agency-header-v2:not(.is-scrolled) .ah-mobile-search-trigger {
    color: #ffffff !important;
}

body.home .agency-header-v2:not(.is-scrolled) .ah-menu-list > li > a svg,
body.front-page .agency-header-v2:not(.is-scrolled) .ah-menu-list > li > a svg,
body.home .agency-header-v2:not(.is-scrolled) .ah-cart-btn svg,
body.front-page .agency-header-v2:not(.is-scrolled) .ah-cart-btn svg,
body.home .agency-header-v2:not(.is-scrolled) .ah-search-icon {
    stroke: #ffffff !important;
    color: #ffffff !important;
}

body.home .agency-header-v2:not(.is-scrolled) .ah-search-input {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

body.home .agency-header-v2:not(.is-scrolled) .ah-search-input::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* NÚT GIỎ HÀNG VIỀN TRẮNG SẮC NÉT TRÊN BANNER TRANG CHỦ */
body.home .agency-header-v2:not(.is-scrolled) .ah-cart-btn,
body.front-page .agency-header-v2:not(.is-scrolled) .ah-cart-btn {
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}

body.home .agency-header-v2:not(.is-scrolled) .ah-mobile-menu-toggle .bar {
    background-color: #ffffff !important;
}

/* KHI KÉO CUỘN CHUỘT XUỐNG XUỐNG TRANG CHỦ (>30PX): TỰ ĐỘNG CHUYỂN SANG NỀN TRẮNG */
body.home .agency-header-v2.is-scrolled,
body.front-page .agency-header-v2.is-scrolled {
    background-color: #ffffff !important;
    border-bottom: 1px solid #eaeaea !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06) !important;
}