/* ==========================================================================
   AGENCY HEADER V2 SYSTEM (FULL-WIDTH, STICKY TOP & SLIDE MENU TRÁI)
   ========================================================================== */
.agency-header-v2, .agency-header-v2 input, .agency-header-v2 button, .agency-header-v2 a, .agency-header-v2 span {
    font-family: var(--font-sans), sans-serif !important;
}

/* Header dính sát mép trên */
.agency-header-v2 {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100%;
    z-index: 1000;
    background-color: #ffffff;
    border-bottom: 1px solid #eaeaea; 
}

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

/* Khung layout trải Full màn hình */
.ah-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 12px 40px; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    position: relative;
}

/* Ẩn Hiện Component */
.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; }
}

/* ==========================================================================
   DESKTOP LAYOUT (CANH TÂM TUYỆT ĐỐI & LOGO TO LÊN)
   ========================================================================== */
.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; } /* Cập nhật kích thước Logo Desktop lớn hơn */

.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; }

/* Menu Chính Desktop */
.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 !important; 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); }

/* Khối Tiện Ích Desktop */
.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; }
.ah-cart-wrapper { position: relative; }
.ah-cart-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid #dcdcdc; border-radius: 2px !important; color: #333333; text-decoration: none !important; box-sizing: border-box; cursor: pointer;}
.ah-cart-btn:hover { border-color: #999999; }
.ah-cart-btn svg { stroke: #333333; }

/* Mega Menu Desktop */
.ah-mega-wrapper { position: absolute; top: 100%; background-color: #ffffff; border: 1px solid rgba(0,0,0,0.05); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08); border-radius: 8px; 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: 0; width: 100%; padding: 40px 50px; box-sizing: border-box; }
.mega-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px; }
.ah-mega-services, .ah-mega-projects { left: 50%; transform: translate(-50%, 15px); width: 500px; padding: 30px; 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: 40px; }
.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; }

/* Mini Cart Box (Chung Desktop & Mobile) */
.ah-mini-cart-dropdown { position: absolute; top: calc(100% + 10px); right: 0; width: 320px; background: #fff; border: 1px solid #e5e5e5; border-radius: 4px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); padding: 20px; z-index: 1005; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease; cursor: default; }
.ah-mini-cart-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.ah-mini-cart-dropdown ul.cart_list { list-style: none !important; margin: 0 !important; padding: 0 !important; max-height: 240px; overflow-y: auto; }
.ah-mini-cart-dropdown ul.cart_list li { display: block !important; position: relative !important; padding: 10px 0 10px 65px !important; min-height: 70px !important; border-bottom: 1px solid #eee !important; }
.ah-mini-cart-dropdown ul.cart_list li img { position: absolute !important; left: 0 !important; top: 10px !important; width: 50px !important; height: 50px !important; object-fit: cover !important; border-radius: 4px !important; border: 1px solid #eee !important; margin: 0 !important; float: none !important; }
.ah-mini-cart-dropdown ul.cart_list li a:not(.remove) { color: #333 !important; font-weight: 500 !important; font-size: 13.5px !important; text-decoration: none !important; display: block !important; margin-bottom: 4px !important; transition: 0.3s; }
.ah-mini-cart-dropdown ul.cart_list li a:not(.remove):hover { color: #7da061 !important; }
.ah-mini-cart-dropdown ul.cart_list li a.remove { position: absolute !important; right: 0 !important; top: 10px !important; color: #888 !important; font-size: 18px !important; font-weight: 300 !important; text-decoration: none !important; }
.ah-mini-cart-dropdown .woocommerce-mini-cart__total { display: flex !important; justify-content: space-between !important; border-top: 1px solid #eee !important; margin: 15px 0 0 0 !important; padding: 15px 0 0 0 !important; font-weight: 600 !important; color: #333 !important; font-size: 14px !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: 14px !important; text-transform: uppercase; text-decoration: none !important; transition: 0.3s; }
.ah-mini-cart-dropdown .woocommerce-mini-cart__buttons a.button.wc-forward:not(.checkout) { background-color: #7da061 !important; color: #fff !important; border: 1px solid #7da061 !important; }
.ah-mini-cart-dropdown .woocommerce-mini-cart__buttons a.button.checkout { background-color: #333 !important; color: #fff !important; border: 1px solid #333 !important; }

/* ==========================================================================
   MOBILE INTERFACE SYSTEM (TÌM KIẾM, GIỎ HÀNG, MENU TRÀN VIỀN)
   ========================================================================== */
@media (max-width: 850px) {
    .ah-container { padding: 10px 15px; }
    
    /* Canh giữa Logo tuyệt đối trên Mobile */
    .ah-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); flex: none; }
    .ah-logo img { max-height: 45px !important; }

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

    /* ==========================================================================
   FIX LỖI: MẶC ĐỊNH ẨN THANH TÌM KIẾM MOBILE (CHỈ HIỆN KHI BẤM KÍNH LÚP)
   ========================================================================== */
/* Mặc định ẩn 100% khi vào trang */
.ah-mobi-search-dropdown {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    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;
}

/* CHỈ hiển thị khi bấm vào kính lúp (có class .open) */
.ah-mobi-search-dropdown.open {
    display: block !important;
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
    /* Giỏ hàng Mobile Dropdown Fix */
    .ah-mobile-cart { position: relative; }
    .ah-cart-btn { border-color: #dcdcdc; color: #333; }
    .ah-cart-btn svg { stroke: #333; }
    .ah-mobile-cart .ah-mini-cart-dropdown {
        top: calc(100% + 15px);
        right: -10px; 
        width: 320px;
        max-width: calc(100vw - 20px); 
    }

    /* ================= MENU TRÀN VIỀN (SLIDE TỪ TRÁI SANG) ================= */
    .ah-mobile-menu-overlay {
        position: fixed; 
        top: 0;
        left: 0;
        width: 100%; 
        height: 100vh;
        background-color: #ffffff;
        z-index: 999; 
        overflow-y: auto;
        padding-top: 65px; 
        transform: translateX(-100%); /* Ẩn đi bằng cách đẩy lùi sang trái */
        transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
        box-sizing: border-box;
    }
    .ah-mobile-menu-overlay.open { display: block !important; transform: translateX(0); }

    /* Cấu trúc Danh mục trọn vẹn, không bị hẹp hay dư lề */
    .ah-mobile-menu-inner { padding: 0; }
    .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 > a, .menu-item-flex > a {
        display: block; 
        padding: 18px 25px; 
        font-size: 16px; 
        font-weight: 500; 
        color: #333333; 
        text-decoration: none;
        flex: 1;
    }
    
    .menu-item-flex { display: flex; justify-content: space-between; align-items: stretch; width: 100%; box-sizing: border-box; }
    
    .toggle-sub { 
        width: 60px; 
        display: flex; 
        align-items: center; 
        justify-content: center; 
        cursor: pointer; 
        color: #888;
        border-left: 1px solid #f9f9f9; 
    }
    .toggle-sub svg { transition: transform 0.3s; }
    .toggle-sub.active svg { transform: rotate(180deg); color: #7da061; }
    
    /* Menu Con Dropdown - Sang trọng, xóa lề thò thụt thừa */
    .sub-menu { 
        list-style: none; 
        margin: 0; 
        padding: 0; 
        display: none; 
        background-color: #fcfcfc; 
        width: 100%; 
        box-sizing: border-box;
    }
    .sub-menu li a { 
        display: block; 
        padding: 15px 25px 15px 45px; 
        font-size: 15px; 
        color: #555; 
        text-decoration: none; 
        border-bottom: 1px solid #f5f5f5;
    }
    .sub-menu li:last-child a { border-bottom: none; }
}

/* ==========================================================================
   HỆ THỐNG MEGA MENU DYNAMIC (CHUẨN THIẾT KẾ THEO ẢNH)
   ========================================================================== */
.ah-mega-wrapper {
    position: absolute;
    top: 100%;
    background-color: #ffffff; /* Nền mặc định */
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    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); 
}

/* === SẢN PHẨM (Trải dài hết màn hình - Nền Xám Nhạt #F9F9F9) === */
.ah-has-mega.ah-mega-full { position: static !important; }

.ah-mega-products { 
    left: 0; 
    width: 100%; 
    padding: 40px 50px; 
    box-sizing: border-box; 
    background-color: #f9f9f9; /* Màu nền xám nhạt như ảnh */
    max-height: 80vh; /* Chống tràn nếu có quá nhiều dòng */
    overflow-y: auto;
}

/* Tùy chỉnh thanh cuộn cho đẹp */
.ah-mega-products::-webkit-scrollbar { width: 5px; }
.ah-mega-products::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 4px; }

/* Grid 4 cột - Tự động đẩy Kệ hoa, Hộp hoa xuống dòng 2 rất đẹp */
.mega-grid-4 { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 35px 30px; /* Khoảng cách dọc (35px) và ngang (30px) */
    align-items: start; /* Ép các khối nằm sát trên, không bị giãn dọc */
}

/* === DỊCH VỤ & DỰ ÁN (2 Cột) === */
.ah-mega-services, .ah-mega-projects { 
    left: 50%; 
    transform: translate(-50%, 15px); 
    width: 500px; 
    padding: 30px; 
    box-sizing: border-box; 
    background-color: #ffffff; /* Dịch vụ/Dự án giữ nền trắng */
}

.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: 40px; align-items: start; }

/* === TYPOGRAPHY (FONT CHỮ CHUẨN NHƯ ẢNH) === */

/* Tiêu đề Cha (Bình Hoa, Bó hoa...) */
.mega-heading { 
    display: inline-block; 
    font-size: 16px !important; 
    font-weight: 700 !important; 
    color: #435436 !important; /* Xanh rêu đậm */
    margin-bottom: 16px !important; 
    text-decoration: none !important; 
}

/* Danh mục Con (Hoa đại sảnh, Hoa cưới...) */
.mega-col ul { list-style: none; padding: 0; margin: 0; }
.mega-col ul li { margin-bottom: 12px; }
.mega-col ul li:last-child { margin-bottom: 0; }

.mega-col ul li a { 
    font-size: 13.5px !important; 
    color: #777777 !important; /* Màu xám thanh lịch */
    text-decoration: none !important; 
    transition: color 0.3s ease; 
}

.mega-col ul li a:hover { 
    color: #7da061 !important; /* Đổi màu xanh Midori khi trỏ chuột */
}