/**
 * Elementor Mega Menu Styles
 */

/* Reset */
.emm-mega-menu-item {
    position: relative !important;
}

/* Mega menu container */
.emm-mega-menu-wrapper {
    position: absolute !important;
    z-index: 99999;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    visibility: hidden;
    opacity: 0;
    min-width: 250px;
    border-radius: 4px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Inner wrapper for better positioning */
.emm-mega-menu-inner {
    position: relative;
    padding: 20px;
    background: inherit;
    border-radius: inherit;
}

/* Menu positioning and transitions */
.emm-depth-0.emm-mega-menu-wrapper {
    left: 0;
    right: 0;
    transform: translateY(15px);
}

.emm-depth-1.emm-mega-menu-wrapper {
    top: 0;
    left: 100%;
    transform: translateX(15px);
}

/* Show mega menu on hover/active */
#site-navigation .emm-mega-menu-item:hover > .emm-mega-menu-wrapper,
#site-navigation .emm-mega-menu-item.emm-hover > .emm-mega-menu-wrapper,
#site-navigation .emm-mega-menu-item.emm-active > .emm-mega-menu-wrapper {
    visibility: visible !important;
    opacity: 1 !important;
    transform: translate(0) !important;
    pointer-events: auto !important;
}

/* Menu width variations */
.emm-mega-menu-wrapper.emm-full-width {
    width: 100vw;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) translateY(15px);
}

.emm-mega-menu-item:hover .emm-mega-menu-wrapper.emm-full-width,
.emm-mega-menu-item.emm-hover .emm-mega-menu-wrapper.emm-full-width,
.emm-mega-menu-item.emm-active .emm-mega-menu-wrapper.emm-full-width {
    transform: translateX(-50%) translateY(0);
}

.emm-mega-menu-wrapper.emm-container-width {
    width: 1140px;
    max-width: 90vw;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) translateY(15px);
}

.emm-mega-menu-item:hover .emm-mega-menu-wrapper.emm-container-width,
.emm-mega-menu-item.emm-hover .emm-mega-menu-wrapper.emm-container-width,
.emm-mega-menu-item.emm-active .emm-mega-menu-wrapper.emm-container-width {
    transform: translateX(-50%) translateY(0);
}

/* Content styling */
.emm-mega-menu-content {
    padding: 20px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
    background: inherit;
}

/* Custom scrollbar styling */
.emm-mega-menu-content::-webkit-scrollbar {
    width: 6px;
}

.emm-mega-menu-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.emm-mega-menu-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.emm-mega-menu-content::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Loading state */
.emm-loading .emm-mega-menu-content {
    position: relative;
}

.emm-loading .emm-mega-menu-content:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1;
    border-radius: inherit;
}

.emm-loading .emm-mega-menu-content:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    z-index: 2;
    animation: emmSpin 1s linear infinite;
}

/* Indicator for items with mega menus */
.emm-indicator {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 5px;
    vertical-align: middle;
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    transition: transform 0.2s ease;
}

.emm-mega-menu-item.emm-active > a .emm-indicator,
.emm-mega-menu-item:hover > a .emm-indicator {
    transform: rotate(180deg);
}

.emm-depth-1 .emm-indicator {
    transform: rotate(-90deg);
}

.emm-depth-1.emm-active > a .emm-indicator,
.emm-depth-1:hover > a .emm-indicator {
    transform: rotate(90deg);
}

/* Animations */
@keyframes emmSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes emmFadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.emm-animation-fade .emm-mega-menu-wrapper {
    animation: emmFadeInUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base theme compatibility */
.emm-mega-menu-wrapper img {
    max-width: 100%;
    height: auto;
}

.emm-mega-menu-wrapper * {
    box-sizing: border-box;
}

/* Elementor compatibility */
.emm-mega-menu-content .elementor-section-wrap {
    width: 100%;
}

.emm-mega-menu-content .elementor img {
    max-width: 100%;
    height: auto;
}
.emm-mega-menu-wrapper.emm-active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.emm-mega-menu-item.emm-active > a {
    color: #000; /* Or your theme's active color */
}

/* Mobile specific */
@media (max-width: 767px) {
    .emm-mega-menu-wrapper.emm-active {
        display: block;
        transform: translateX(0);
    }
}
/* Mega menu panel */
.elementskit-megamenu-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    visibility: hidden;
    opacity: 0;
    z-index: 99999;
    transition: all 0.3s ease;
    pointer-events: none;
    padding: 20px;
    width: 100% !important;
    /* Position it below header */
    margin-top: var(
        --header-height,
        80px
    ); /* Adjust this value to match your header height */
}

/* Container for content */
.emm-template-content {
    max-width: 1200px; /* or your desired max-width */
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
}

/* Show mega menu on hover */
.emm-mega-menu-item:hover > .elementskit-megamenu-panel {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Responsive styles */
@media screen and (min-width: 1024px) {
    .elementskit-megamenu-panel {
        margin-top: 0; /* Adjust based on your header height */
    }

    .emm-template-content {
        padding: 40px 20px;
    }
}

@media screen and (max-width: 1023px) {
    .elementskit-megamenu-panel {
        margin-top: 0; /* Adjust based on your mobile header height */
    }

    .emm-template-content {
        padding: 20px;
    }
}

@media screen and (max-width: 767px) {
    .elementskit-megamenu-panel {
        overflow-y: auto;
        max-height: calc(100vh - 60px); /* Adjust based on your header height */
    }

    .emm-template-content {
        padding: 15px;
    }
}

/* Elementor content styling */
.emm-template-content .elementor-section-wrap {
    width: 100%;
}

.emm-template-content
    .elementor-section.elementor-section-boxed
    > .elementor-container {
    max-width: 100%;
}

.emm-template-content .elementor-column {
    width: 100%;
}

/* Animation */
@keyframes emmFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.elementskit-megamenu-panel {
    animation: emmFadeIn 0.3s ease-out;
}
