/* Mega Menu Wrapper */
body .fusion-tb-header {
    font-family: var(--body_typography-font-family);
    position: relative;
    width: 100%;
    z-index: 999;
}

body .fusion-tb-header ul.mega-menu-main {

    display: flex;
    justify-content: space-between;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

/* Main Menu Items */
body .fusion-tb-header .mega-menu-item {

    position: static;
    padding: 0.9375em 1.25em;
}

body .fusion-tb-header .mega-menu-link {

    position: relative;
    color: #031E33;
    text-decoration: none;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 1em;
    transition: color 0.3s ease;
}

body .fusion-tb-header .mega-menu-link .dropdown-icon {

    font-size: 10px;
    margin-left: 0.125em;
}

body .fusion-tb-header .menu-icon-img {

    width: 20px;
    height: 20px;
    object-fit: contain;
    margin-right: 0.5em;
}

body .fusion-tb-header .mega-menu-item:hover .mega-menu-link,
body .fusion-tb-header .mega-menu-item.active .mega-menu-link {

    color: #031E33;
    /* Theme Blue */
}

/* Hover effect under active link (similar to Tools active line) */
body .fusion-tb-header .mega-menu-link::after {

    content: '';
    position: absolute;
    bottom: -15px;
    left: 0;
    right: 0;
    height: 2px;
    background: #031E33;
    opacity: 0;
    transition: opacity 0.3s;
}

body .fusion-tb-header .mega-menu-item:hover .mega-menu-link::after,
body .fusion-tb-header .mega-menu-item.active .mega-menu-link::after {

    opacity: 1;
}

/* The Submenu Dropdown Container */
body .fusion-tb-header .mega-dropdown-wrapper {

    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    max-width: 1400px;
    /* Limit max width like in design */
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, margin-top 0.3s ease;
    margin-top: 0.625em;
    padding: 2.5rem;
    box-sizing: border-box;
    border-radius: 10px;
}

@media (min-width: 1025px) {
    body .fusion-tb-header .mega-menu-item:hover .mega-dropdown-wrapper {

        opacity: 1;
        visibility: visible;
        margin-top: 0;
    }
}

/* Inner Container */
body .fusion-tb-header .mega-dropdown-container {

    margin: 0 auto;
    width: 100%;
}

body .fusion-tb-header .mobile-back-btn {

    display: none;
}

/* ===== GRID LAYOUTS ===== */

/* 1. Text List Grid (Hardware / Shop Supplies) */
body .fusion-tb-header .text-list-grid {

    display: flex;
    justify-content: space-between;
    gap: 1.875em;
}

body .fusion-tb-header .text-list-grid .mega-col {

    flex: 1;
}

body .fusion-tb-header ul.mega-menu-main li.mega-menu-item.has-mega-dropdown:nth-child(4) .mega-grid.text-list-grid .mega-col {

    border: 1px solid #D9D9D9;
    border-radius: 20px;
    padding: 1.875rem;
}

body .fusion-tb-header ul.mega-menu-main li.mega-menu-item.has-mega-dropdown:nth-child(4) .mega-grid.text-list-grid .mega-col:last-child h5.col-title {

    display: none;
}

body .fusion-tb-header ul.mega-menu-main li.mega-menu-item.has-mega-dropdown:nth-child(4) .mega-grid.text-list-grid .mega-col:last-child ul.mega-links {

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    height: 100%;
}

body .fusion-tb-header ul.mega-menu-main li.mega-menu-item.has-mega-dropdown:nth-child(4) .mega-grid.text-list-grid .mega-col:last-child ul.mega-links>li>a {

    font-size: 20px;
    font-weight: 500;
}

body .fusion-tb-header .text-list-grid h5.col-title {

    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 0.625em;
    color: #031E33;
    border-bottom: 1px solid rgba(3, 30, 51, 0.2);
    padding-bottom: 0.25em;
}

body .fusion-tb-header ul.mega-menu-main li.mega-menu-item.has-mega-dropdown:nth-child(4) .mega-grid.text-list-grid .mega-col h5.col-title {
    font-weight: 500;
}

body .fusion-tb-header .mega-links {

    list-style: none;
    padding: 0;
    margin: 0;
}

body .fusion-tb-header .mega-links li {

    margin-bottom: 0.5em;
}

body .fusion-tb-header .mega-links a {

    color: #031E33;
    text-decoration: none;
    font-size: 1em;
    transition: color 0.2s;
}

body .fusion-tb-header .mega-links a:hover {

    color: #031E33;
}

/* 2. Product Items Grid (Tools) */
body .fusion-tb-header .product-items-grid {

    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.563rem;
}

body .fusion-tb-header .product-item {

    display: flex;
    flex-direction: column;
    text-align: left;
    background: transparent;
    padding: 0;
    text-decoration: none !important;
}

body .fusion-tb-header .product-item:hover .product-img {

    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

body .fusion-tb-header .product-img {

    width: 100%;
    height: auto;
    aspect-ratio: 225 / 191;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.9375em;
    background: #fff;
    border: 1px solid rgba(3, 30, 51, 0.2);
    border-radius: 8px;
    padding: 0.9375em;
    transition: box-shadow 0.3s;
}

body .fusion-tb-header .product-img img {

    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}

body .fusion-tb-header .product-title {

    font-size: 14px;
    font-weight: 600;
    color: #031E33;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

body .fusion-tb-header .product-title .dot,
body .fusion-tb-header .card-info .dot {

    display: flex;
    width: 36px;
    height: 36px;
    padding: 1px 9px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: 20px;
    border: 1px solid #D9D9D9;
    background: rgba(3, 30, 51, 0.05);
}


/* 3. Image Cards Grid (Fasteners) */
body .fusion-tb-header .image-cards-grid {

    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.563rem;
}

body .fusion-tb-header .image-card {

    display: flex;
    flex-direction: column;
    text-align: left;
    background: transparent;
    padding: 0;
    text-decoration: none !important;
}

body .fusion-tb-header .image-card:hover .card-img-wrap {

    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

body .fusion-tb-header .card-img-wrap {

    width: 100%;
    height: auto;
    aspect-ratio: 393 / 269;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid rgba(3, 30, 51, 0.2);
    border-radius: 8px;
    padding: 1.125em;
    /* 18px */
    margin-bottom: 0.9375em;
    transition: box-shadow 0.3s;
}

body .fusion-tb-header .card-img-wrap img {

    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    /* Soft inner radius if needed */
}

body .fusion-tb-header .card-info {

    font-size: 14px;
    font-weight: 600;
    color: #031E33;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

body .fusion-tb-header .image-card:hover .dot {

    background-color: #031E33;
    color: #fff;
}

body .fusion-tb-header .image-card:hover .dot svg path {

    stroke: #fff;
}


/* 4. Banner Cards Grid (Lighting) */
body .fusion-tb-header .banner-cards-grid {

    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25em;
}

body .fusion-tb-header .banner-card {

    display: block;
    background: #fff;
    border: 1px solid rgba(3, 30, 51, 0.2);
    border-radius: 20px;
    padding: 0.625em;
    /* 10px */
    text-decoration: none;
    transition: box-shadow 0.3s;
}

body .fusion-tb-header .banner-card:hover {

    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

body .fusion-tb-header .banner-card .banner-img {

    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 584 / 354;
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

body .fusion-tb-header .banner-card .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 60%);
}

body .fusion-tb-header .banner-text {
    position: relative;
    z-index: 2;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 500;
    padding-bottom: 20px;
    text-transform: none;
    /* Changed from uppercase to match design */
}


/* ===== MOBILE TOGGLE ANIMATED BUTTON ===== */
body .fusion-tb-header .custom-mobile-toggle {

    display: none;
    width: 24px;
    height: 18px;
    cursor: pointer;
    z-index: 1005;
    position: relative;
    padding: 0;
}

body .fusion-tb-header .custom-mobile-toggle .line {

    display: block;
    height: 2px;
    background-color: #fff;
    /* Thay màu theo Header nếu cần */
    border-radius: 2px;
    position: absolute;
    right: 0;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* 3. Image 3: Hamburger right-aligned */
body .fusion-tb-header .custom-mobile-toggle .line-1 {

    top: 0;
    width: 70%;
}

body .fusion-tb-header .custom-mobile-toggle .line-2 {

    top: 50%;
    margin-top: -1px;
    /* Căn giữa hoàn hảo cho line 2px */
    width: 100%;
}

body .fusion-tb-header .custom-mobile-toggle .line-3 {

    bottom: 0;
    width: 70%;
}

/* 4. Image 4: X shape */
body .fusion-tb-header .custom-mobile-toggle.is-open .line-1 {

    width: 100%;
    top: 50%;
    margin-top: -1px;
    transform: rotate(45deg);
}

body .fusion-tb-header .custom-mobile-toggle.is-open .line-2 {

    opacity: 0;
    transform: rotate(45deg) scale(0);
    /* Hide nicely */
}

body .fusion-tb-header .custom-mobile-toggle.is-open .line-3 {

    width: 100%;
    bottom: auto;
    top: 50%;
    margin-top: -1px;
    transform: rotate(-45deg);
}

/* 5. Image 5: Back Arrow < */
body .fusion-tb-header .custom-mobile-toggle.is-back .line-1 {

    width: 55%;
    top: 50%;
    margin-top: -1px;
    transform: rotate(-45deg);
    transform-origin: left center;
}

body .fusion-tb-header .custom-mobile-toggle.is-back .line-2 {

    opacity: 0;
}

body .fusion-tb-header .custom-mobile-toggle.is-back .line-3 {

    width: 55%;
    bottom: auto;
    top: 50%;
    margin-top: -1px;
    transform: rotate(45deg);
    transform-origin: left center;
}

body .fusion-tb-header .mega-menu-overlay {

    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

/* ===== TABLET & MOBILE (Max 1024px) ===== */
@media (max-width: 1024px) {
    body .fusion-tb-header .custom-mobile-toggle {

        display: flex;
        /* Kích hoạt Toggle Custom */
    }

    body .fusion-tb-header .menu-mobile-toggle {

        display: none !important;
        /* Ẩn nút cơ bản cũ nếu còn sót */
    }

    /* 1. Main Menu Screen */
    body .fusion-tb-header ul.mega-menu-main {

        position: fixed;
        top: var(--mega-mobile-top, 80px);
        left: -100vw;
        width: var(--mega-mobile-width, 100vw);
        background: #D9DDE1;
        flex-direction: column;
        align-items: stretch;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding: 2.5rem 0 0 0;
        z-index: 1000;
        margin: 0;
        justify-content: flex-start;
        height: calc(100vh - var(--mega-mobile-top, 80px));
        gap: 2.5rem;
    }

    body .fusion-tb-header ul.mega-menu-main:after {

        content: '';
        display: block;
        width: 100%;
        height: 100%;
        background-color: #fff;
        background-image: url('../../Avada-Child-Theme/images/logo-blur.png');
        background-repeat: no-repeat;
        background-position: bottom;
        background-size: contain;
    }

    body .fusion-tb-header ul.mega-menu-main.open {

        left: var(--mega-mobile-left, 0);
    }

    body .fusion-tb-header .mega-menu-overlay.open {

        display: block;
    }

    body .fusion-tb-header .mega-menu-item {

        width: 100%;
        padding: 0;
    }

    body .fusion-tb-header .mega-menu-item::after {

        display: none;
    }

    body .fusion-tb-header .mega-menu-link {

        font-weight: 400;
        padding: 0 1.875rem;
        justify-content: flex-start;
    }

    /* Chevron icon override */
    body .fusion-tb-header .mega-menu-link .dropdown-icon {

        font-size: 10px;
        position: absolute;
        right: 1.875rem;
    }

    /* 2. Submenu Dropdown Behavior (Image 2) */
    body .fusion-tb-header .mega-dropdown-wrapper {

        position: fixed;
        top: var(--mega-mobile-top, 80px);
        left: 100vw;
        /* Bắt đầu slide tà phải sang */
        width: var(--mega-mobile-width, 100vw);
        height: calc(100vh - var(--mega-mobile-top, 80px));
        margin-top: 0;
        border: none;
        border-radius: 0;
        transform: none;
        background: #fff;
        /* Nền trắng như thiết kế Image 2 */
        z-index: 1099;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        visibility: hidden;
        opacity: 0;
        overflow-y: auto;
        padding: 20px;
        /* Bỏ padding top thừa, để nguyên 20 quanh */
    }

    body .fusion-tb-header .mega-dropdown-wrapper.open {

        visibility: visible;
        opacity: 1;
        left: var(--mega-mobile-left, 0);
        /* Cover chồng lên Main Menu */
    }



    body .fusion-tb-header .mobile-back-btn {

        display: none;
        /* Không cần back button vì Toggle Header lo việc này */
    }

    /* Mobile Grid Overrides (Responsive cột thành hàng dọc) */
    body .fusion-tb-header .text-list-grid,
    body .fusion-tb-header .product-items-grid,
    body .fusion-tb-header .image-cards-grid,
    body .fusion-tb-header .banner-cards-grid {

        display: flex;
        flex-direction: column;
        gap: 1.25em;
    }

    body .fusion-tb-header .mega-grid.product-items-grid {

        width: 100%;
        display: grid;
        grid-template-rows: 1fr;
        grid-template-columns: repeat(2, 1fr);
        grid-column-gap: 1.063rem;
        grid-row-gap: 1.063rem;
    }

    body .fusion-tb-header .product-img {

        height: auto;
    }

    body .fusion-tb-header .header-top-right-pc .fusion-column-wrapper {

        padding: 0;
        margin: 0;
    }

    body .fusion-tb-header .header-top-right-pc .fusion-column-wrapper .fusion-search-element.fusion-search-element-1.search-form {

        width: 100%;
    }
}