/* Mega Menu Styles */
.products-menu-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #CD0018;
    color: #fff !important;
    padding: 13px 15px 11px 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    background: url(/img/cart-button-background.png) top left repeat-x;
}

.products-menu-toggle:hover {
    background: #a50014;
}

.products-menu-toggle.active {
    background: #a50014;
}

.hamburger-icon {
    font-size: 13px;
    line-height: 1;
}

#header {
    position: relative;
    z-index: 1000;
}

.links.header-row {
    position: relative;
}

.products-mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #D0D0D0;
    border-top: 2px solid #CD0018;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
    margin-top: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

/* .mega-menu-wrapper uses .wrapper-full class for consistent sizing */

.mega-menu-content {
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* New Layout: Left-Right */
.mega-menu-layout {
    display: flex;
    min-height: 400px;
}

/* Left: Primary Categories */
.mega-menu-primary {
    width: 280px;
    background: #f8f8f8;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    max-height: 80vh;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mega-menu-primary-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu-primary-item {
    border-bottom: 1px solid #e0e0e0;
}

.mega-menu-primary-item:last-child {
    border-bottom: none;
}

.mega-menu-primary-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-transform: uppercase;
    transition: all 0.2s ease;
    background: transparent;
}

.mega-menu-primary-item:hover .mega-menu-primary-link,
.mega-menu-primary-item.active .mega-menu-primary-link {
    background: #fff;
    color: #CD0018;
    font-weight: 600;
}

.mega-menu-arrow {
    color: #999;
    font-size: 18px;
    margin-left: 10px;
}

.mega-menu-primary-item:hover .mega-menu-arrow,
.mega-menu-primary-item.active .mega-menu-arrow {
    color: #CD0018;
}

/* Right: Subcategories */
.mega-menu-secondary {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    max-height: 80vh;
    position: relative;
}

.mega-menu-secondary-panel {
    display: none;
    position: absolute;
    top: 20px;
    left: 30px;
    right: 30px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mega-menu-secondary-panel.active {
    display: block;
    position: relative;
    opacity: 1;
}

.mega-menu-secondary-content {
    columns: 4;
    column-width: 200px;
    column-gap: 30px;
    column-fill: balance;
    width: 100%;
}

.mega-menu-subcategory-item {
    margin-bottom: 10px;
    break-inside: avoid;
    page-break-inside: avoid;
    display: block;
    width: 100%;
}

.mega-menu-subcategory-link {
    color: #CD0018;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
    transition: color 0.2s ease;
}

.mega-menu-subcategory-link:hover {
    color: #a50014;
    text-decoration: underline;
}

.mega-menu-sub-subcategories {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
}

.mega-menu-sub-subcategories > li {
    /* margin-bottom: 6px; */
}

.mega-menu-sub-subcategories > li > a {
    color: #666;
    font-size: 13px;
    text-decoration: none;
    display: block;
    padding-bottom: 4.2px;
    padding-top: 4.2px;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.mega-menu-sub-subcategories > li > a:hover {
    color: #CD0018;
    padding-left: 8px;
}

.mega-menu-secondary-empty {
    padding: 40px 20px;
    text-align: center;
}

.mega-menu-view-all {
    color: #CD0018;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    padding: 15px 30px;
    border: 2px solid #CD0018;
    display: inline-block;
    transition: all 0.2s ease;
}

.mega-menu-view-all:hover {
    background: #CD0018;
    color: #fff;
}

/* Sidebar remains visible on desktop - other modules need to be displayed */
/* Uncomment below if you want to hide sidebar on desktop when using mega menu */
/*
@media (min-width: 992px) {
    .col2-left-layout .col-left.sidebar {
        display: none !important;
    }
    
    .col2-left-layout .col-main {
        width: 100% !important;
        margin-left: 0 !important;
        float: none !important;
    }
}
*/

/* Responsive adjustments */
@media (max-width: 1279px) {
    .mega-menu-secondary-content {
        columns: 3;
        column-width: 180px;
        column-gap: 25px;
    }
}

@media (max-width: 991px) {
    .mega-menu-layout {
        flex-direction: column;
        min-height: auto;
    }
    
    .mega-menu-primary {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .mega-menu-primary-list {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
    }
    
    .mega-menu-primary-item {
        border-bottom: none;
        border-right: 1px solid #e0e0e0;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .mega-menu-primary-item:last-child {
        border-right: none;
    }
    
    .mega-menu-secondary {
        padding: 15px 20px;
    }
    
    .mega-menu-secondary-content {
        columns: 2;
        column-width: 150px;
        column-gap: 20px;
    }
    
    /* Show sidebar on mobile */
    .col2-left-layout .col-left.sidebar {
        display: block !important;
    }
    
    .col2-left-layout .col-main {
        width: auto !important;
    }
}

@media (max-width: 767px) {
    .mega-menu-secondary-content {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar styling for mega menu */
.products-mega-menu::-webkit-scrollbar {
    width: 8px;
}

.products-mega-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.products-mega-menu::-webkit-scrollbar-thumb {
    background: #CD0018;
    border-radius: 4px;
}

.products-mega-menu::-webkit-scrollbar-thumb:hover {
    background: #a50014;
}
