/* Layouts */
.nexus-menu-wrapper {
    width: 100%;
    position: relative;
}

.nexus-menu-main {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: stretch;
    /* Vertically align items */
}

.nexus-menu-main>li {
    display: block;
    /* Ensure list items are blocks */
}

.nexus-menu-main>li>a {
    display: flex;
    /* Changed from block to flex for better alignment */
    align-items: center;
    /* CRITICAL: Allows padding to affect height properly */
    text-decoration: none;
    transition: all 0.3s ease;
    /* Smooth transition for everything */
    z-index: 1002;
    /* Ensure it sits above submenu for tab effect */
}

/* Horizontal */
.nexus-menu-layout-horizontal .nexus-menu-main {
    flex-direction: row;
    flex-wrap: wrap;
}

/* Vertical */
.nexus-menu-layout-vertical .nexus-menu-main {
    flex-direction: column;
    align-items: flex-start;
    /* Align left in vertical */
}

.nexus-menu-layout-vertical .nexus-menu-main>li {
    width: 100%;
}

/* Dropdown (Default Layout) */
.nexus-menu-layout-dropdown .nexus-menu-main {
    flex-direction: column;
}

/* Alignments */
.nexus-menu-align-left .nexus-menu-main {
    justify-content: flex-start;
}

.nexus-menu-align-center .nexus-menu-main {
    justify-content: center;
}

.nexus-menu-align-right .nexus-menu-main {
    justify-content: flex-end;
}

.nexus-menu-align-justify .nexus-menu-main {
    justify-content: space-between;
}

.nexus-menu-align-justify .nexus-menu-main>li {
    flex-grow: 1;
    text-align: center;
}

/* Pointer: Underline */
.nexus-menu-pointer-underline .nexus-menu-main>li>a {
    position: relative;
}

.nexus-menu-pointer-underline .nexus-menu-main>li>a:before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nexus-menu-pointer-underline .nexus-menu-main>li>a:hover:before,
.nexus-menu-pointer-underline .nexus-menu-main>li.current-menu-item>a:before {
    transform: scaleX(1);
}

/* Pointer: Overline */
.nexus-menu-pointer-overline .nexus-menu-main>li>a {
    position: relative;
}

.nexus-menu-pointer-overline .nexus-menu-main>li>a:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: currentColor;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nexus-menu-pointer-overline .nexus-menu-main>li>a:hover:before,
.nexus-menu-pointer-overline .nexus-menu-main>li.current-menu-item>a:before {
    transform: scaleX(1);
}

/* Pointer: Framed */
.nexus-menu-pointer-framed .nexus-menu-main>li>a {
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    margin: 2px;
    /* Prevent jump on border add? No, border is transparent usually */
}

/* Use box-sizing border-box to handle borders cleanly */
.nexus-menu-main>li>a {
    box-sizing: border-box;
}

.nexus-menu-pointer-framed .nexus-menu-main>li>a:hover,
.nexus-menu-pointer-framed .nexus-menu-main>li.current-menu-item>a {
    border-color: currentColor;
}

/* Pointer: Background */
.nexus-menu-pointer-background .nexus-menu-main>li>a {
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    /* Ensure centering or full stretch if needed */
    align-items: center;
    /* keep text centered vertically if height is large */
}

.nexus-menu-pointer-background .nexus-menu-main>li>a:hover,
.nexus-menu-pointer-background .nexus-menu-main>li.current-menu-item>a {
    background-color: rgba(0, 0, 0, 0.05);
    /* Default subtle background */
}

/* Submenus */
.nexus-menu-main .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 999;
    background: #fff;
    list-style: none;
    margin: 0;
    padding: 0;
    /* Remove default padding, user can add if needed or items have padding */
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    /* Fix for border radius */
}

.nexus-menu-main .sub-menu li {
    display: block;
    margin: 0;
}

.nexus-menu-main .sub-menu li a {
    display: block;
    /* Ensure padding works */
    text-decoration: none;
    position: relative;
}

.nexus-menu-main li {
    position: relative;
}

/* Ensure submenu positioning relative to item */
.nexus-menu-main li:hover>.sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nexus-menu-main .sub-menu .sub-menu {
    top: 0;
    left: 100%;
}

/* Mega Menu Styles */


/* Full Width Logic: 
   To make it full width of the MENU CONTAINER (ul), the UL needs relative and Li static. 
   But if we make Li static, normal submenus break.
   Solution: Only make Li static if it HAS a mega menu? 
   We added 'nexus-mega-menu-item' class in the walker.
*/
.nexus-menu-main>li.nexus-mega-menu-item {
    position: static;
}

.nexus-mega-menu-full-width {
    width: 100%;
    left: 0;
    right: 0;
}

/* Custom Width Logic */
/* .nexus-mega-menu-custom-width handled by inline style for width */
/* We might want to center it or align left? Default is left aligned to the parent Item if Li is relative. 
   If Li is static (added above), it aligns to UL.
*/


/* Menu Icons */
.nexus-menu-icon {
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

.nexus-menu-icon-img {
    width: 20px;
    /* Default */
    height: auto;
}

/* Dropdown Indicators */
.nexus-submenu-icon-arrow .menu-item-has-children>a:after {
    content: '\f107';
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-left: 5px;
}

.nexus-submenu-icon-plus .menu-item-has-children>a:after {
    content: '+';
    margin-left: 5px;
}

.nexus-submenu-icon-chevron .menu-item-has-children>a:after {
    content: '\f078';
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-left: 5px;
}

/* Toggle Button */
.nexus-menu-toggle-wrapper {
    display: none;
    cursor: pointer;
}

.nexus-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.nexus-menu-toggle svg {
    fill: currentColor;
    /* Default fill */
    transition: fill 0.3s ease;
}

.nexus-menu-toggle i {
    transition: color 0.3s ease;
}

/* Responsive Logic */
@media (max-width: 1024px) {
    .nexus-menu-breakpoint-tablet .nexus-menu-toggle-wrapper {
        display: block;
    }

    .nexus-menu-breakpoint-tablet .nexus-menu-container {
        display: block;
        position: absolute;
        width: 100%;
        left: 0;
        top: 100%;
        z-index: 999;

        /* Animation Base */
        transform: scaleY(0);
        transform-origin: top;
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        overflow: hidden;
    }

    .nexus-menu-breakpoint-tablet .nexus-menu-container.nexus-menu-open {
        transform: scaleY(1);
        opacity: 1;
        visibility: visible;
        overflow-y: auto;
        /* Ensure max-height if needed, but scaleY handles visual */
        max-height: 80vh;
        /* scrollable if long */
    }

    .nexus-menu-breakpoint-tablet .nexus-menu-main {
        flex-direction: column;
        align-items: stretch;
    }

    .nexus-menu-breakpoint-tablet .nexus-menu-main .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding-left: 0;
        display: none;
        transition: none;
        /* JS handles toggle */
    }


}

@media (max-width: 767px) {
    .nexus-menu-breakpoint-mobile .nexus-menu-toggle-wrapper {
        display: block;
    }

    .nexus-menu-breakpoint-mobile .nexus-menu-container {
        display: block;
        position: absolute;
        width: 100%;
        left: 0;
        top: 100%;
        z-index: 999;

        /* Animation Base */
        transform: scaleY(0);
        transform-origin: top;
        opacity: 0;
        visibility: hidden;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        overflow: hidden;
    }

    .nexus-menu-breakpoint-mobile .nexus-menu-container.nexus-menu-open {
        transform: scaleY(1);
        opacity: 1;
        visibility: visible;
        overflow-y: auto;
        max-height: 80vh;
    }

    .nexus-menu-breakpoint-mobile .nexus-menu-main {
        flex-direction: column;
        align-items: stretch;
    }

    .nexus-menu-breakpoint-mobile .nexus-menu-main .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding-left: 0;
        display: none;
        transition: none;
    }


}

/* Full Width Logic - Explicit Dropdown Layout (Desktop Hamburger) */
.nexus-menu-layout-dropdown.nexus-menu-mobile-full-width-yes .nexus-menu-container {
    width: 100vw;
    position: absolute;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    border-radius: 0 !important;
}

/* Layout Utilities for Dual Menu Logic */
.nexus-menu-desktop-only {
    display: block;
}

.nexus-menu-mobile-only {
    display: none;
}

/* Tablet Breakpoint Logic */
@media (max-width: 1024px) {
    .nexus-menu-breakpoint-tablet .nexus-menu-desktop-only {
        display: none !important;
    }

    .nexus-menu-breakpoint-tablet .nexus-menu-mobile-only {
        display: block;
        /* Let the container logic handle absolute/hidden state */
    }
}

/* Mobile Breakpoint Logic */
@media (max-width: 767px) {
    .nexus-menu-breakpoint-mobile .nexus-menu-desktop-only {
        display: none !important;
    }

    .nexus-menu-breakpoint-mobile .nexus-menu-mobile-only {
        display: block;
    }
}

/* Layout: Dropdown - Enforce Hamburger/Toggle Always (Desktop & Mobile) */
.nexus-menu-layout-dropdown .nexus-menu-toggle-wrapper {
    display: block !important;
}

.nexus-menu-layout-dropdown .nexus-menu-container {
    display: block;
    position: absolute;
    width: 100%;
    left: 0;
    top: 100%;
    /* Default background removed */
    z-index: 999;

    transform: scaleY(0);
    transform-origin: top;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
}

.nexus-menu-layout-dropdown .nexus-menu-container.nexus-menu-open {
    transform: scaleY(1);
    opacity: 1;
    visibility: visible;
    overflow-y: auto;
    max-height: 80vh;
}

.nexus-menu-layout-dropdown .nexus-menu-main {
    flex-direction: column;
    align-items: stretch;
}

.nexus-menu-layout-dropdown .nexus-menu-main .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    padding-left: 0;
    display: none;
    transition: none;
}



/* Divider Logic */
.nexus-menu-divider-yes .nexus-menu-main>li {
    position: relative;
}

.nexus-menu-divider-yes .nexus-menu-main>li:not(:last-child):after {
    content: '';
    position: absolute;
    display: block;
    pointer-events: none;
    z-index: 1005;
    /* Ensure visibility over background pointers */
    /* Don't interfere with clicks */
}

/* Horizontal Layout: Vertical Divider */
.nexus-menu-layout-horizontal.nexus-menu-divider-yes .nexus-menu-main>li:not(:last-child):after {
    top: 50%;
    /* Position divider in the center of the margin-right gap */
    right: calc(var(--nexus-menu-space-between, 0px) / -2);
    transform: translateY(-50%) translateX(50%);
    /* Center strictly */
    /* Width/Height controlled by settings */
}

/* Vertical Layout: Horizontal Divider */
.nexus-menu-layout-vertical.nexus-menu-divider-yes .nexus-menu-main>li:not(:last-child):after {
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    /* Width/Height controlled by settings */
}

/* Clean handling for Custom Icons */
.nexus-menu-divider-yes .nexus-menu-main>li:not(:last-child):after {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Hide Divider on Tablet and Mobile if Breakpoint matches */
@media (max-width: 1024px) {
    .nexus-menu-breakpoint-tablet.nexus-menu-divider-yes .nexus-menu-main>li:after {
        display: none !important;
    }

    /* Full Width Logic - Tablet Breakpoint */
    .nexus-menu-breakpoint-tablet.nexus-menu-mobile-full-width-yes .nexus-menu-container {
        width: 100vw;
        position: absolute;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        border-radius: 0 !important;
    }
}

@media (max-width: 767px) {

    /* Hide divider for Mobile Breakpoint */
    .nexus-menu-breakpoint-mobile.nexus-menu-divider-yes .nexus-menu-main>li:after {
        display: none !important;
    }

    /* Full Width Logic - Mobile Breakpoint */
    .nexus-menu-breakpoint-mobile.nexus-menu-mobile-full-width-yes .nexus-menu-container {
        width: 100vw;
        position: absolute;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        border-radius: 0 !important;
    }
}

/* Hide Divider explicitly for Dropdown Layout (Hamburger) */
.nexus-menu-layout-dropdown.nexus-menu-divider-yes .nexus-menu-main>li:after {
    display: none !important;
}

/* Mega Menu: Container Width Logic */
.nexus-mega-menu-container-width {
    /* JS handles width and position to match container */
    box-sizing: border-box;
}

/* Ensure padding doesn't break on small screens */
@media (max-width: 1140px) {
    .nexus-mega-menu-container-width {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

/* Mobile Active State - Disable Pointers */
.nexus-layout-mobile-active.nexus-menu-pointer-underline .nexus-menu-main>li>a:before,
.nexus-layout-mobile-active.nexus-menu-pointer-overline .nexus-menu-main>li>a:before {
    display: none !important;
}

.nexus-layout-mobile-active.nexus-menu-pointer-framed .nexus-menu-main>li>a {
    border-color: transparent !important;
}

/* Reset background pointer for mobile so it doesn't conflict with custom styles */
.nexus-layout-mobile-active.nexus-menu-pointer-background .nexus-menu-main>li>a:hover,
.nexus-layout-mobile-active.nexus-menu-pointer-background .nexus-menu-main>li.current-menu-item>a {
    background-color: transparent;
}

/* Reset Border Radius AND MARGIN for Mobile Active Layout */
.nexus-layout-mobile-active .nexus-menu-main>li>a {
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Reset margin for list items in mobile layout to prevent gaps */
.nexus-layout-mobile-active .nexus-menu-main>li {
    margin-right: 0 !important;
    margin-left: 0 !important;
    --nexus-menu-space-between: 0px;
    /* Reset CSS variable if used */
}

/* Fix Mobile Overflow so background colors don't bleed out of rounded corners */
.nexus-layout-mobile-active .nexus-menu-main {
    overflow: hidden;
    padding: 0 !important;
    list-style: none !important;
    max-width: 100%;
    background: #fff;
}

/* Ensure the container is scrollable if content is too long on mobile */
.nexus-layout-mobile-active .nexus-menu-container {
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    /* Force correct width/position for mobile, overriding JS calculations if necessary */
    width: 100% !important;
    left: 0 !important;
    right: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Reset Submenu Distance: The 'Dropdown Distance' control should only affect the main menu container in mobile, NOT the submenus inside */
.nexus-layout-mobile-active .nexus-menu-main .sub-menu {
    margin-top: 0 !important;
}