/* =================================================================== */
/* MEGA MENU STYLES                                                   */
/* =================================================================== */

/* Base navigation styling - ensure normal header items display correctly */
.mainMenu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 20px;
}

.navItem {
    position: relative;
    display: inline-block;
}

.navItem.hasMegaMenu,
.navItem.hasDropdown {
/*     position: relative; */
	position: static;
}

.navLink {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-family: 'Heebo', sans-serif;
    font-size: 16px;
    font-weight: 500;
    padding: 12px 16px;
    transition: color 0.3s ease;
}

.navLink:hover {
    color: #007cba;
}

/* Hide all sub-menus by default */
.megaMenu,
.dropdownMenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Mega menu full-width positioning */
.megaMenu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    transform: translateY(-10px);
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: none;
    border-top: 1px solid #e5e5e5;
}

/* Mega menu content container */
.megaMenuContainer {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Show mega menu on hover */
.navItem.hasMegaMenu:hover .megaMenu,
.navItem.hasDropdown:hover .dropdownMenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.navItem.hasMegaMenu:hover .megaMenu {
    transform: translateY(0);
}

.megaMenuContainer {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
/*     width: fit-content; */
	width: 100%;

}

.megaMenuContent {
    position: relative;
    z-index: 2;
    padding: 40px 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Background image overlay */
.megaMenuBackground {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.1;
    z-index: 1;
}

/* Mega menu items container */
.megaMenuItems {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 300px;
    width: 100%;
    align-items: flex-start;
    gap: 0;
}

/* Text items - category headers and subcategories - left side columns */
.megaMenuItem.categoryHeader,
.megaMenuItem.textItem:not(.subcategory) {
    flex: 1 1 calc(25% - 15px);
    margin: 0 15px 20px 0;
    min-width: 180px;
    max-width: calc(25% - 15px);
}

/* Create space for featured items by limiting text items to 3 columns max */
.megaMenuItem.categoryHeader:nth-of-type(4n),
.megaMenuItem.textItem:not(.subcategory):nth-of-type(4n) {
    margin-right: 0;
}

/* Featured items container - group all featured items in a single div */
.featuredItemsContainer {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-left: auto; /* Push entire container to right */
    order: 999; /* Force to end */
}

.featuredItemsContainer .megaMenuItem.imageItem {
    flex: 0 0 240px;
    width: 240px;
    margin: 0; /* Remove individual margins, use gap instead */
}

/* Subcategory container styling */
.subMenuItems {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
    padding-left: 12px;
}

.subMenuItems .megaMenuItem.subcategory {
    margin-bottom: 4px;
}

/* Individual mega menu items */
.megaMenuItem {
    position: relative;
    margin: 0;
    padding: 0;
    border-radius: 0;
    transition: all 0.3s ease;
    display: block;
}

/* Text-based menu items (category listings) */
.megaMenuItem.textItem {
    margin-bottom: 4px;
}

/* Image-based menu items (featured products) */
.megaMenuItem.imageItem {
    margin-bottom: 20px;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.megaMenuItem.imageItem:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.megaMenuItem:hover {
    background: #f8f9fa;
}

.megaMenuItem.featured {
    background: linear-gradient(135deg, #f8f9ff 0%, #e8f0ff 100%);
    border: 2px solid #007cba;
    border-radius: 8px;
    padding: 20px;
}


/* Only show mega menu items inside the dropdown */
.megaMenu .megaMenuItem {
    display: block;
}

/* Note: Menu visibility is now controlled by opacity/visibility for smooth transitions */

/* =================================================================== */
/* REGULAR DROPDOWN MENU STYLES                                       */
/* =================================================================== */

/* Regular dropdown positioning */
.dropdownMenu {
    min-width: 200px;
    max-width: 300px;
    left: 0;
    transform: none;
    padding: 10px 0;
}

.dropdownMenuInner {
    padding: 0;
}

.dropdownList {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dropdownArrow {
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #ffffff;
    z-index: 1001;
}

.dropdownArrow:before {
    content: '';
    position: absolute;
    top: -1px;
    left: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #e5e5e5;
}

/* Dropdown items */
.dropdownItem {
    display: block;
    border-bottom: 1px solid #f0f0f0;
}

.dropdownItem:last-child {
    border-bottom: none;
}

.dropdownLink {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.3s ease;
}

.dropdownLink:hover {
    background: #f8f9fa;
    color: #007cba;
    padding-left: 25px;
}


.dropdownMenu .dropdownItem {
    display: block;
}

/* Mega menu item content with image */
.megaMenuItemContent {
    display: block;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.megaMenuItemImage {
    width: 100%;
    height: 160px;
    overflow: hidden;
    position: relative;
}

.megaMenuItemImage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.megaMenuItemContent:hover .megaMenuItemImage img {
    transform: scale(1.1);
}

.megaMenuItemContent:hover {
    color: #007cba;
}

.megaMenuItemText {
    padding: 16px;
    background: #ffffff;
}

/* Mega menu links and text */
.megaMenuLink {
    text-decoration: none;
    color: #333;
    transition: color 0.3s ease;
    display: block;
}

.megaMenuLink:hover {
    color: #007cba;
}

.megaMenuItemTitle {
    font-family: 'Heebo', sans-serif;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #2c2c2c;
    line-height: 1.4;
    text-align: center;
}

.megaMenuItemDesc {
    display: none;
}

/* Category header styling - Level 1 items without images */
.megaMenuItem.categoryHeader {
    margin-bottom: 20px;
}

.megaMenuItem.categoryHeader > .megaMenuLink {
    font-family: 'Heebo', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #2c2c2c;
    text-decoration: none;
    padding: 0 0 8px 0;
    margin-bottom: 12px;
    border-bottom: 2px solid #007cba;
    display: block;
    transition: color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.megaMenuItem.categoryHeader > .megaMenuLink:hover {
    color: #007cba;
}

/* Subcategory items - Level 2 items under category headers */
.megaMenuItem.subcategory {
    margin-bottom: 0;
    padding: 0;
}

.megaMenuItem.subcategory .megaMenuLink {
    font-family: 'Heebo', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #555;
    text-decoration: none;
    padding: 6px 0;
    display: block;
    transition: all 0.3s ease;
    border-radius: 4px;
    line-height: 1.4;
}

.megaMenuItem.subcategory .megaMenuLink:hover {
    color: #007cba;
    padding-left: 8px;
    background: rgba(0, 124, 186, 0.05);
}

/* Subcategory container */
.subMenuItems {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-left: 8px;
}

.subMenuItems .megaMenuItem {
    margin-bottom: 4px;
}

/* Regular text menu items (for non-hierarchical items) */
.megaMenuItem.textItem:not(.subcategory) .megaMenuLink {
    font-family: 'Heebo', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #555;
    text-decoration: none;
    padding: 8px 0;
    display: block;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.megaMenuItem.textItem:not(.subcategory) .megaMenuLink:hover {
    color: #007cba;
    padding-left: 8px;
    background: rgba(0, 124, 186, 0.05);
}

/* Navigation items with images (top level) */
.navItem.hasImage > .navLink {
    display: flex;
    align-items: center;
    gap: 8px;
}


.megaMenuItem  a:after {
    display: none;
}

.navImage {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
}

/* Mega menu icon */
.megaMenuIcon {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.navItem.hasMegaMenu:hover .megaMenuIcon {
    transform: rotate(180deg);
}

/* Arrow pointer for mega menu */
.megaMenu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #ffffff;
    z-index: 3;
}

.megaMenu::after {
    content: '';
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 9px solid #e5e5e5;
    z-index: 2;
}

/* Submenu handling within mega menu */
.megaMenuItem.hasSubmenu .subMenu {
    margin-top: 10px;
    padding-left: 20px;
    border-left: 2px solid #f0f0f0;
}

.subMenu .megaMenuItem {
    margin-bottom: 5px;
}

.subMenu .megaMenuLink {
    font-size: 14px;
    font-weight: 400;
    color: #666;
    padding: 6px 12px;
}

.subMenu .megaMenuLink:hover {
    color: #007cba;
    background: #f8f9fa;
}


/* =================================================================== */
/* RTL SUPPORT                                                         */
/* =================================================================== */

/* RTL support - full width remains the same */
[dir="rtl"] .megaMenu {
    left: 0;
    right: 0;
    margin-left: calc(-50vw + 50%);
}

[dir="rtl"] .navItem.hasMegaMenu:hover .megaMenu {
    transform: translateY(0);
}

[dir="rtl"] .dropdownMenu {
    left: auto;
    right: 0;
}

[dir="rtl"] .dropdownArrow {
    left: auto;
    right: 20px;
}

[dir="rtl"] .megaMenuItemContent {
    flex-direction: row-reverse;
}

[dir="rtl"] .dropdownLink:hover {
    padding-left: 20px;
    padding-right: 25px;
}

[dir="rtl"] .megaMenuIcon,
[dir="rtl"] .dropdownIcon {
    margin-left: 0;
    margin-right: 8px;
	display: none;
}

/* =================================================================== */
/* HEADER LAYOUT PROTECTION                                            */
/* =================================================================== */

/* Ensure mega menu doesn't affect header height or layout */
.header {
    z-index: 100;
}

.mainNav {
    position: relative;
    z-index: 101;
}

.mainMenu {
/*     position: relative; */
    z-index: 102;
}

/* Ensure dropdowns appear above other content but below modals */
.megaMenu,
.dropdownMenu {
    z-index: 1000;
}

/* Mobile handling - hide mega menus on small screens for now */
@media (max-width: 975px) {
    .megaMenu,
    .dropdownMenu {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
    
    .navItem:hover .megaMenu,
    .navItem:hover .dropdownMenu {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* =================================================================== */
/* MEGA MENU RESPONSIVE STYLES                                        */
/* =================================================================== */

/* Large screens */
@media (min-width: 1200px) {
    .megaMenu {
        max-width: 1400px;
        width: fit-content;
        min-width: 0px;
    }
    
    .megaMenu[data-columns="4"] .megaMenuItems {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Medium screens */
@media (max-width: 1199px) and (min-width: 768px) {
    .megaMenu {
        max-width: 900px;
    }
    
    .megaMenu[data-columns="4"] .megaMenuItems {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .megaMenuContent {
        padding: 25px;
    }
}

/* Small screens and tablets */
@media (max-width: 767px) {
    .megaMenu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        min-width: auto;
        max-width: none;
        border-radius: 0;
        border: none;
        background: #ffffff;
        overflow-y: auto;
        z-index: 9999;
    }
    
    .navItem.hasMegaMenu:hover .megaMenu {
        transform: none;
    }
    
    .megaMenuItems {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .megaMenuContent {
        padding: 20px;
        padding-top: 70px; /* Space for close button */
    }
    
    .megaMenuItemContent {
        flex-direction: column;
        text-align: center;
        padding: 20px;
        border: 1px solid #f0f0f0;
        border-radius: 12px;
        margin-bottom: 15px;
    }
    
    .megaMenuItemImage {
        width: 120px;
        height: 120px;
        align-self: center;
        margin-bottom: 15px;
    }
    
    .megaMenuItemTitle {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .megaMenuItemDesc {
        font-size: 14px;
        text-align: center;
    }
    
    /* Mobile close button */
    .megaMenu::before {
        content: '✕';
        position: fixed;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        background: #333;
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        font-weight: bold;
        cursor: pointer;
        z-index: 10000;
        transition: all 0.3s ease;
    }
    
    .megaMenu::before:hover {
        background: #007cba;
        transform: scale(1.1);
    }
    
    .megaMenu::after {
        display: none;
    }
    
    /* Mobile mega menu backdrop */
    .megaMenu.mobile-active::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
    }
    
    /* Improved touch interactions */
    .megaMenuItem {
        padding: 10px;
        border-radius: 8px;
        transition: background 0.3s ease;
    }
    
    .megaMenuItem:active {
        background: #f8f9fa;
        transform: scale(0.98);
    }
    
    /* Better spacing for mobile */
    .megaMenuContent {
        padding: 25px 20px 40px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .megaMenuContent {
        padding: 15px;
        padding-top: 50px;
    }
    
    .megaMenuItemTitle {
        font-size: 14px;
    }
    
    .megaMenuItemDesc {
        font-size: 12px;
    }
}