/* ==========================================
   HEADER MAIN STYLES (PURE HTML/CSS)
   ========================================== */

.site-header {
    width: 100%;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.site-header.sticky {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}


/* ==========================================
   1. HEADER TOP (Beige row)
   ========================================== */
.header-top {
    background-color: #FFF;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 85px;
    width: auto;
    object-fit: contain;
    transition: height 0.3s ease;
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: 1.5px;
}

.site-header.sticky .logo-img {
    height: 50px;
}

/* Action block (Search, Hotline, Showroom, Cart) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 25px;
}

/* Search Form (Desktop & Mobile) */
.header-search {
    flex: 1;
    max-width: 480px;
    margin: 0 30px;
    position: relative;
}

.header-search-form {
    display: flex;
    align-items: center;
    background-color: #f5f5f7;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    padding: 5px 6px 5px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.header-search-form:focus-within {
    background-color: #ffffff;
    border-color: var(--color-5);
    /* box-shadow: 0 0 0 3px rgba(226, 5, 15, 0.15); */
}

.header-search-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 15px;
    color: #1a1a1a;
    background: transparent;
    /* padding: 8px 0; */
    font-weight: 400;
    /* line-height: 30px; */
    font-family: system-ui;
}

.header-search-input::placeholder {
    color: #757575;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.header-search-input:focus::placeholder {
    opacity: 0.5;
}

.header-search-submit {
    background: var(--color-5);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.header-search-submit .material-symbols-outlined {
    font-size: 20px;
}

.header-search-submit:hover {
    background-color: var(--color-3);
    /* transform: scale(1.05); */
}

/* Action Item details */
.header-action-item {
    display: block;
}

.header-action-item .action-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #2d251e;
    gap: 8px;
    transition: color 0.3s ease;
}

.header-action-item .action-link:hover {
    color: var(--color-5);
}

.header-action-item .icon {
    font-size: 40px;
    color: #2d251e;
}

.header-action-item .action-link:hover .icon {
    color: var(--color-5);
}

.header-action-item .action-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.header-action-item .action-text .label {
    font-size: 14px;
    font-weight: 400;
    /* text-transform: uppercase; */
}

.header-action-item .action-text .value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-5);
}

/* Special styling for Cart Icon & Badge */
.cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-count.badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: var(--color-5);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Hamburger toggle menu */
.header-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 25px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
}

.toggle-line {
    width: 100%;
    height: 2px;
    background-color: #2d251e;
    transition: all 0.3s ease;
}

/* ==========================================
   2. HEADER BOTTOM (Dark red menu bar)
   ========================================== */
.header-bottom {
    background-color: var(--color-3);
    color: #ffffff;
    height: 48px;
}

.header-bottom-container {
    display: flex;
    align-items: center;
    height: 48px;
}

/* Category dropdown wrapper */
.category-dropdown-wrapper {
    position: relative;
    height: 100%;
    background-color: var(--color-5);
}

.category-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 20px;
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.3s ease;
}

.category-dropdown-btn:hover {
    background-color: var(--color-5);
}

.category-dropdown-btn .icon {
    font-size: 20px;
}

.category-dropdown-btn .arrow {
    font-size: 18px;
    margin-left: auto;
}

/* 3-Level Category Megamenu */
.category-megamenu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 330px;
    background-color: #ffffff;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 4px 4px;
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.category-dropdown-wrapper:hover .category-megamenu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.cat-level-1 {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cat-item-1 {
    position: relative;
}

.cat-link-1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    font-size: 13.5px;
    color: #333333;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cat-link-1:hover,
.cat-item-1:hover>.cat-link-1 {
    background-color: #f9f9f9;
    color: var(--color-5);
}

.cat-link-1 .arrow-right {
    font-size: 16px;
    color: #999999;
    transition: transform 0.2s ease;
    transform: rotate(90deg);
}

.cat-item-1:hover>.cat-link-1 .arrow-right {
    transform: rotate(90deg);
}

/* Level 2 Wrapper: nằm ngay bên dưới cat-item-1 (dropdown xuống) */
.cat-level-2-wrapper {
    /* position: absolute;
    top: 100%;
    left: 0; */
    flex-direction: row;
    background-color: #ffffff;
    /* box-shadow: 5px 8px 20px rgba(0, 0, 0, 0.12); */
    /* border-top: 2px solid var(--color-5); */
    z-index: 1000;
    min-width: 240px;
    /* display: none; */
}

/* .cat-item-1:hover>.cat-level-2-wrapper {
    display: flex;
} */

.cat-level-2 {
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 240px;
    flex-shrink: 0;
    padding-left: 20px;
}

.cat-item-2 {
    position: relative;
}

.cat-link-2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    font-size: 13px;
    color: #444444;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cat-link-2:hover,
.cat-item-2:hover>.cat-link-2 {
    background-color: #f9f9f9;
    color: var(--color-5);
}

.cat-link-2 .arrow-right {
    font-size: 16px;
    color: #999999;
}

/* Level 3 Wrapper: flyout sang phải của cat-level-2 khi hover cat-item-2 */
.cat-level-3-wrapper {
    position: absolute;
    top: 0;
    left: 100%;
    width: 240px;
    min-height: 100%;
    height: max-content;
    background-color: #ffffff;
    border-left: 2px solid #f0f0f0;
    box-shadow: 5px 5px 20px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    display: none;
}

.cat-item-2:hover>.cat-level-3-wrapper {
    display: block;
}

.cat-level-3 {
    list-style: none;
    padding: 0;
    margin: 0;
}


.cat-link-3 {
    display: block;
    padding: 12px 20px;
    font-size: 13px;
    color: #555555;
    font-weight: 400;
    text-decoration: none;
    border-bottom: 1px solid #fafafa;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cat-link-3:hover {
    background-color: #f9f9f9;
    color: var(--color-5);
}


/* ==========================================
   3. NAVIGATION MENU (Horizontal in red row)
   ========================================== */
.header-nav {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
}

.menu-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    margin-left: 30px;
    height: 100%;
    width: 100%;
    justify-content: space-between;
    gap: 15px;
}

.menu-item {
    display: flex;
    align-items: center;
    position: relative;
    height: 100%;
}

.menu-link {
    display: flex;
    align-items: center;
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    text-transform: uppercase;
    transition: color 0.3s ease;
    height: 100%;
    gap: 4px;
}

.menu-link .submenu-arrow-icon {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
}

.menu-link:hover,
.menu-item:hover>.menu-link,
.menu-item.active>.menu-link {
    color: var(--color-5);
}


.menu-link:hover .submenu-arrow-icon,
.menu-item:hover>.menu-link .submenu-arrow-icon {
    color: var(--color-5);
}

/* ==========================================
   4. STANDARD SUBMENU DROPDOWN FOR MENU
   ========================================== */
.submenu-list {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background-color: #fff;
    min-width: 200px;
    width: max-content;
    list-style: none;
    padding: 8px 0;
    margin: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s ease;
}

.submenu-item {
    position: relative;
    list-style: none;
}

.menu-item:hover>.submenu-list {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.submenu-item {
    position: relative;
}

.submenu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    color: var(--color-3);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.submenu-link .submenu-arrow-right-icon {
    font-size: 16px;
    color: #888888;
}

.submenu-link:hover,
.submenu-item:hover>.submenu-link {
    color: var(--color-5);
    background-color: rgba(223, 172, 64, 0.08);
    padding-left: 24px;
}

/* Level 3 Submenu (bay sang phai) */
.submenu-list.level-3 {
    top: 0;
    left: 100%;
}

.submenu-item:hover>.submenu-list.level-3 {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.submenu-toggle {
    display: none;
    /* Mobile only toggle element */
}

/* Hide mobile-only elements on desktop */
.mobile-only-item,
.mobile-search-wrapper {
    display: none;
}


/* ==========================================
   5. SEARCH MODAL OVERLAY
   ========================================== */
.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 15, 17, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-container {
    width: 90%;
    max-width: 650px;
    background-color: #ffffff;
    border-radius: 16px;
    padding: 45px 35px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-modal-overlay.active .search-modal-container {
    transform: scale(1);
}

.search-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #666666;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.search-modal-close:hover {
    color: var(--color-5);
    transform: rotate(90deg);
}

.search-modal-close .material-symbols-outlined {
    font-size: 28px;
}

.search-modal-content {
    width: 100%;
}

.search-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin-top: 0;
    margin-bottom: 25px;
    text-align: center;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
    transition: border-color 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--color-5);
}

.search-modal-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 17px;
    color: #1a1a1a;
    padding: 10px 45px 10px 5px;
    background: transparent;
}

.search-modal-input::placeholder {
    color: #999999;
}

.search-modal-submit {
    position: absolute;
    right: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #666666;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    transition: color 0.2s ease;
}

.search-modal-submit:hover {
    color: var(--color-5);
}

.search-modal-submit .material-symbols-outlined {
    font-size: 24px;
}

/* Trending Keywords */
.search-trending {
    margin-top: 25px;
}

.trending-label {
    font-size: 13.5px;
    font-weight: 600;
    color: #666666;
    display: block;
    margin-bottom: 12px;
}

.trending-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.trending-tag {
    display: inline-block;
    background-color: #f3f3f3;
    color: #444444;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.trending-tag:hover {
    background-color: var(--color-5);
    color: #ffffff;
    transform: translateY(-1px);
}


/* ==========================================
   6. RESPONSIVE LAYOUTS (Tablet & Mobile)
   ========================================== */

/* â”€â”€ Hamburger active state â”€â”€ */
.header-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 19px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
}

.header-toggle.active .toggle-line:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
    background-color: var(--color-3);
}

.header-toggle.active .toggle-line:nth-child(2) {
    opacity: 0;
}

.header-toggle.active .toggle-line:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
    background-color: var(--color-3);
}

/* Overlay khi má»Ÿ menu */
body.menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 998;
}

@media (max-width: 1400px) {
    .header-top {
        padding: 6px 0;
    }

    .header-bottom,
    .header-bottom-container {
        height: 48px;
    }

    .menu-link,
    .category-dropdown-btn {
        font-size: 13px;
    }

    .cat-link-2 {
        padding: 4px 20px;
        font-size: 12px;
    }

    .cat-link-1 {
        padding: 3px 20px;
        font-size: 11.5px;
    }

    .cat-link-3 {
        padding: 6px 20px;
        font-size: 12px;
    }
}

@media (max-width: 991px) {

    /* â”€â”€ TOP HEADER ROW â”€â”€ */
    .header-top {
        padding: 8px 0;
    }

    /* Wrap thÃ nh 2 hÃ ng:
       HÃ ng 1: logo | cart + hamburger
       HÃ ng 2: search (full width) */
    .header-top-container {
        flex-wrap: wrap;
        row-gap: 0;
        align-items: center;
    }

    /* HÃ ng 1: Logo - co láº¡i bÃªn trÃ¡i */
    .header-logo {
        order: 1;
        flex: 1;
    }

    .logo-img {
        height: 30px;
    }

    .site-header.sticky .logo-img {
        height: 30px;
    }

    /* HÃ ng 1: Actions - bÃªn pháº£i, chá»‰ giá» hÃ ng + hamburger */
    .header-actions {
        order: 2;
        gap: 12px;
        flex-shrink: 0;
    }

    /* áº¨n hotline trÃªn mobile */
    .header-hotline,
    .header-showroom {
        display: none;
    }

    /* áº¨n text label giá» hÃ ng, chá»‰ giá»¯ icon */
    .header-action-item .action-text {
        display: none;
    }

    .header-action-item .icon {
        font-size: 26px;
    }

    /* HÃ ng 2: Search - full width */
    .header-search {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin: 12px 0 0;
        flex-basis: 100%;
    }

    /* Hiá»‡n hamburger button */
    .header-toggle {
        display: flex;
    }

    /* áº¨n thanh bottom menu bar */
    .header-bottom {
        height: auto;
    }

    .header-bottom-container {
        height: auto;
    }

    .category-dropdown-wrapper {
        display: none;
    }

    /* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
       MOBILE DRAWER - slide tá»« trÃ¡i sang
    â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .header-nav {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        max-width: 85vw;
        height: 100vh;
        background-color: #ffffff;
        flex-direction: column;
        align-items: flex-start;
        padding: 0;
        transition: left 0.38s cubic-bezier(0.77, 0.2, 0.05, 1);
        z-index: 1000;
        overflow-y: auto;
        overflow-x: hidden;
        display: block;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .header-nav.active {
        left: 0;
    }

    /* Drawer header vá»›i logo */
    .mobile-menu-logo {
        display: flex;
        align-items: center;
        padding: 16px 18px;
        background-color: var(--color-3);
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        margin-bottom: 0;
    }

    .mobile-menu-logo .logo-img {
        height: 38px !important;
        width: auto !important;
        display: block;
        filter: brightness(0) invert(1);
    }

    /* Search bÃªn trong drawer - áº©n vÃ¬ Ä‘Ã£ cÃ³ á»Ÿ ngoÃ i */
    .mobile-search-wrapper {
        display: none;
    }

    /* â”€â”€ Menu List â”€â”€ */
    .menu-list {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        width: 100%;
        margin-left: 0;
        gap: 0;
        padding: 8px 0;
    }

    .menu-item {
        width: 100%;
        height: auto;
        margin: 0;
        flex-direction: column;
        align-items: flex-start;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
    }

    .menu-link {
        width: 100%;
        padding: 13px 18px;
        font-size: 16px;
        font-weight: 600;
        height: auto;
        justify-content: space-between;
        color: #1a1a1a;
        text-transform: none;
        letter-spacing: 0;
    }

    .menu-link:hover,
    .menu-item:hover>.menu-link,
    .menu-item.active>.menu-link {
        color: var(--color-3);
        background-color: #f5f8ff;
    }

    /* Hiá»‡n danh má»¥c mobile */
    .mobile-only-item {
        display: flex;
    }

    /* â”€â”€ Submenu accordion â”€â”€ */
    .menu-item.has-submenu {
        position: relative;
    }

    .submenu-toggle {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        width: 50px;
        height: 46px;
        z-index: 10;
        cursor: pointer;
    }

    .submenu-arrow,
    .menu-link .submenu-arrow-icon,
    .submenu-link .submenu-arrow-right-icon {
        display: none !important;
    }

    /* Chevron cho toggle */
    .submenu-toggle::after {
        content: '';
        position: absolute;
        top: 18px;
        right: 16px;
        width: 7px;
        height: 7px;
        border-bottom: 2px solid #888;
        border-right: 2px solid #888;
        transform: rotate(45deg);
        transition: transform 0.25s ease;
    }

    .menu-item.open>.submenu-toggle::after,
    .submenu-item.open>.submenu-toggle::after {
        transform: rotate(-135deg);
        border-color: var(--color-3);
    }

    /* Submenu accordion */
    .submenu-list {
        position: static;
        width: 100%;
        visibility: visible;
        opacity: 1;
        transform: none;
        background-color: #f9fafc;
        border-top: 1px solid #eaeef3;
        box-shadow: none;
        padding: 4px 0 8px 36px;
        min-width: 100%;
        display: none;
        box-sizing: border-box;
        list-style: disc;
    }

    .submenu-list .submenu-item {
        list-style: disc;
        color: var(--color-3);
    }

    .submenu-list.level-3 {
        position: static;
        background-color: #f2f4f8;
        padding-left: 32px;
        list-style: circle;
    }

    .submenu-list.level-3 .submenu-item {
        list-style: circle;
    }

    .menu-item.open>.submenu-list,
    .submenu-item.open>.submenu-list {
        display: block;
    }

    .submenu-link {
        padding: 10px 35px 10px 0;
        border-bottom: 1px solid #edf0f5;
        color: #333;
        font-size: 13.5px;
    }

    .submenu-link:hover,
    .submenu-item:hover>.submenu-link {
        color: var(--color-3);
        background-color: transparent;
        padding-left: 6px;
    }

    .submenu-item {
        border-bottom: none;
    }
}