.mega-menu-root {
    position: absolute;
    top: 100%;
    left: 0;
    display: none;
    background: #fff;
    min-width: 240px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 9999;
}

.mega-menu-root .nav-item-link {
    color: #333 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    background: none;
    text-shadow: none;
}

.custom-mega-dropdown:hover .mega-menu-root {
    display: block;
}

.flyout-list {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    background: #fff;
    border: 1px solid #eee;
}

.nav-item-wrapper {
    position: relative;
}

.flyout-panel {
    position: absolute;
    top: -11px;
    left: 100%;
    display: none;
    min-width: 240px;
    height: auto;
}

.nav-item-wrapper:hover > .flyout-panel {
    display: block;
}

.submenu-toggle-btn {
    touch-action: none !important;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    background: #f8f9fa;
    border: none;
    border-left: 1px solid #eee;
    padding: 12px 20px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
}

.submenu-toggle-btn:hover {
    background: #f0f0f0;
    color: #e31e24;
}

.arrow-right {
    font-size: 10px;
    transition: transform 0.3s ease;
}

@media (min-width: 992px) {
    .custom-mega-dropdown:hover .mega-menu-root {
        display: block;
    }
    .nav-item-wrapper:hover > .flyout-panel {
        display: block;
    }
    .submenu-toggle-btn {
        background: transparent;
        border-left: none;
        pointer-events: none;
    }
}

@media (max-width: 991px) {
    .mega-menu-root {
        position: fixed !important;
        top: 180px !important;
        left: 5% !important;
        right: 5% !important;
        width: 90% !important;
        max-height: 70vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0);
        background: #fff;
        z-index: 10000 !important;
        box-shadow: 0 20px 50px rgba(0,0,0,0.3) !important;
        border-radius: 12px;
        display: none !important;
    }

    .custom-mega-dropdown.show-mobile .mega-menu-root {
        display: block !important;
    }

    .flyout-list {
        border: none;
    }

    .nav-item-header {
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        display: flex !important;
        pointer-events: auto !important;
    }

    .submenu-toggle-btn {
        min-width: 60px;
        min-height: 50px;
        background: #fcfcfc;
        border: none;
        border-left: 1px solid #eee;
        touch-action: manipulation;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .flyout-panel {
        position: static !important;
        display: none;
        width: 100% !important;
        padding-left: 15px !important;
        border-left: 3px solid var(--brand-red, #e31e24) !important;
        background: #fafafa !important;
        box-shadow: none !important;
    }

    .nav-item-wrapper.is-open > .flyout-panel {
        display: block !important;
    }

    .nav-item-wrapper.is-open > .nav-item-header .arrow-right {
        transform: rotate(90deg);
        color: var(--brand-red, #e31e24);
    }

    .mega-menu-root .nav-item-link {
        white-space: normal !important;
        padding: 12px 15px;
        flex-grow: 1;
    }
}