/**
 * CE Mega Menu Styles
 */

/* ====================
   Main Container
   ==================== */
.ce-megamenu {
    position: relative;
    width: 100%;
}

/* ====================
   Mobile Toggle Button
   ==================== */
.ce-megamenu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: relative;
}

.ce-megamenu-toggle-icon {
    display: block;
    width: 20px;
    height: 14px;
    position: relative;
}

.ce-megamenu-toggle-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: #333;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

.ce-megamenu-toggle-icon span:nth-child(1) {
    top: 0;
}

.ce-megamenu-toggle-icon span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.ce-megamenu-toggle-icon span:nth-child(3) {
    bottom: 0;
}

/* Mobile menu close button */
.ce-megamenu-header {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
}

.ce-megamenu-close {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 20px 10px
}

.ce-megamenu-close-icon {
    display: block;
    width: 20px;
    height: 14px;
    position: relative;
}

.ce-megamenu-close-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: #333;
    position: absolute;
    left: 0;
    transition: all 0.3s ease;
}

/* Close icon mobile */
.ce-megamenu-close .ce-megamenu-close-icon span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.ce-megamenu-close .ce-megamenu-close-icon span:nth-child(2) {
    opacity: 0;
}

.ce-megamenu-close .ce-megamenu-close-icon span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* ====================
   Navigation
   ==================== */
.ce-megamenu-nav {
    display: block;
}

.ce-megamenu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

.ce-megamenu-list.level-0 {
    align-items: center;
}

/* ====================
   Menu Items
   ==================== */
.ce-menu-item {
    position: relative;
    margin: 0;
    padding: 0;
}

.ce-menu-item.level-0 {
    margin-right: 0;
}

.ce-menu-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.ce-menu-link:hover {
    color: #007bff;
    text-decoration: none;
}

.ce-menu-icon {
    margin-right: 8px;
    font-size: 16px;
}

.ce-menu-title {
    display: inline-block;
}

.ce-menu-arrow {
    margin-left: 8px;
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    transition: transform 0.3s ease;
}

/* ====================
   Dropdowns & Mega Menus
   ==================== */
.ce-submenu,
.ce-megamenu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 200px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* Desktop hover - only on larger screens */
@media (min-width: 992px) {
    .ce-menu-item:hover > .ce-submenu,
    .ce-menu-item:hover > .ce-megamenu-dropdown {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* Standard Dropdown */
.ce-submenu {
    flex-direction: column;
}

.ce-submenu .ce-menu-item {
    display: block;
    width: 100%;
}

.ce-submenu .ce-menu-link {
    padding: 10px 20px;
    white-space: normal;
}

/* Nested Submenu */
.ce-submenu .ce-submenu {
    top: 0;
    left: 100%;
    margin-left: 5px;
}

/* Nested submenu hover - only on desktop */
@media (min-width: 992px) {
    .ce-submenu .ce-menu-item:hover > .ce-submenu {
        display: block;
    }
}

.ce-submenu .ce-menu-arrow {
    margin-left: auto;
    border-left: 6px solid currentColor;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Mega Menu Dropdown */
.ce-megamenu-dropdown.megamenu-content {
    min-width: 600px;
    max-width: 1200px;
    padding: 20px;
}

.ce-megamenu-inner {
    width: 100%;
}

/* CE Content inside mega menu */
.ce-megamenu-dropdown .elementor-section {
    margin: 0;
}

.ce-megamenu-dropdown .elementor-column-gap-default > .elementor-column > .elementor-element-populated {
    padding: 10px;
}

/* ====================
   Active States
   ==================== */
.ce-menu-item.active > .ce-menu-link,
.ce-menu-item.current > .ce-menu-link {
    color: #007bff;
    font-weight: 600;
}

/* ====================
   Mobile Overlay
   ==================== */
.ce-megamenu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ce-megamenu-overlay.active {
    display: block;
    opacity: 1;
}

/* ====================
   Responsive Design
   ==================== */
@media (max-width: 991px) {
    /* Show mobile toggle and close */
    .ce-megamenu-toggle, .ce-megamenu-close {
        display: block;
    }

    /* Hide menu by default on mobile */
    .ce-megamenu-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 300px;
        height: 100vh;
        background: #fff;
        z-index: 1000;
        overflow-y: auto;
        transition: left 0.3s ease;
        padding: 0 0 20px;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .ce-megamenu-nav.active {
        left: 0;
    }

    /* Mobile menu list */
    .ce-megamenu-list {
        flex-direction: column;
        width: 100%;
    }

    .ce-menu-item {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }

    .ce-menu-link {
        padding: 15px 20px;
        justify-content: space-between;
        white-space: normal;
    }

    .ce-menu-arrow {
        margin-left: auto;
        border-left: 7px solid transparent;
        border-right: 7px solid transparent;
        border-top: 7px solid currentColor;
    }

    /* Mobile dropdowns */
    .ce-submenu,
    .ce-megamenu-dropdown {
        position: static;
        display: none !important; /* Force hide by default */
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        background: #f8f9fa;
        transform: none;
        opacity: 1;
        visibility: visible;
    }

    /* Show dropdown only when parent has active class (clicked) */
    .ce-menu-item.active > .ce-submenu,
    .ce-menu-item.active > .ce-megamenu-dropdown {
        display: block !important;
    }

    /* Mega menu on mobile */
    .ce-megamenu-dropdown.megamenu-content {
        min-width: 100%;
        max-width: 100%;
        padding: 15px;
    }

    /* Nested items indentation */
    .ce-submenu .ce-menu-link {
        padding-left: 40px;
    }

    .ce-submenu .ce-submenu .ce-menu-link {
        padding-left: 60px;
    }

    /* Arrow rotation for mobile */
    .ce-menu-item.active > .ce-menu-link .ce-menu-arrow {
        transform: rotate(180deg);
    }
}

@media (max-width: 991px) {
    .ce-megamenu-nav {
        width: 280px;
    }

    .ce-menu-link {
        padding: 12px 15px;
        font-size: 16px;
    }
}

/* ====================
   Accessibility
   ==================== */
.ce-menu-link:focus,
.ce-megamenu-toggle:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ====================
   RTL Support
   ==================== */
[dir="rtl"] .ce-menu-icon {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .ce-menu-arrow {
    margin-left: 0;
    margin-right: 8px;
}

[dir="rtl"] .ce-submenu .ce-submenu {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 5px;
}

@media (max-width: 991px) {
    [dir="rtl"] .ce-megamenu-nav {
        left: auto;
        right: -100%;
    }

    [dir="rtl"] .ce-megamenu-nav.active {
        left: auto;
        right: 0;
    }
}

/* ====================
   Theme Compatibility
   ==================== */
.ce-megamenu a {
    color: inherit;
}

.ce-megamenu ul {
    list-style: none;
}

/* Clear floats */
.ce-megamenu-dropdown::after,
.ce-megamenu-inner::after {
    content: "";
    display: table;
    clear: both;
}
