/* Smartphone Italia — desktop brand megamenu (tvcmsmegamenu) — 20260704-megamenu-brands
   Suppress ThemeVolty body.menu-open freeze + light brand row (no dark pills) */

@media (min-width: 992px) {
    /* ThemeVolty custom.js hover adds body.menu-open → half-wrapper-backdrop blocks page */
    body.menu-open:not(.si-megamenu-click-open) .tv-main-div .half-wrapper-backdrop,
    body.menu-open:not(.si-megamenu-click-open) .full-wrapper-backdrop,
    body.menu-open:not(.si-cart-open):not(.si-account-open):not(.classicCartOpen):not(.si-megamenu-click-open) .tv-main-div .half-wrapper-backdrop {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.menu-open:not(.si-megamenu-click-open),
    body.menu-open:not(.si-megamenu-click-open) .tv-main-div,
    body.menu-open:not(.si-megamenu-click-open) #wrapper,
    body.menu-open:not(.si-megamenu-click-open) #content-wrapper,
    body.menu-open:not(.si-megamenu-click-open) #content,
    body.menu-open:not(.si-megamenu-click-open) main,
    body.menu-open:not(.si-megamenu-click-open) .si-b2b-home {
        overflow: auto !important;
        touch-action: auto !important;
        pointer-events: auto !important;
        filter: none !important;
        -webkit-filter: none !important;
    }

    /* Brand row container — dropdown must escape header overflow */
    #tvdesktop-megamenu,
    #tvdesktop-megamenu .container_tv_megamenu,
    #tvdesktop-megamenu .tv-menu-horizontal,
    #tvdesktop-megamenu .tv-menu-horizontal .menu-content,
    .tvcms-header-menu-offer-wrapper .tvcmsmain-menu-wrapper {
        overflow: visible !important;
        position: relative;
    }

    /* Brand row — light header: undo module front.css white text + dark invert pills */
    #tvdesktop-megamenu .tv-menu-horizontal li.level-1 > a,
    #tvdesktop-megamenu .tv-menu-horizontal ul li.level-1 > a,
    .tvcms-header-menu-offer-wrapper .tv-menu-horizontal li.level-1 > a {
        background: transparent !important;
        background-color: transparent !important;
        color: var(--si-text, #1d1d1f) !important;
        text-shadow: none !important;
    }

    #tvdesktop-megamenu .tv-menu-horizontal li.level-1:not(.home_menu) > a:hover,
    .tvcms-header-menu-offer-wrapper .tv-menu-horizontal li.level-1:not(.home_menu) > a:hover {
        background: rgba(57, 181, 74, 0.08) !important;
    }

    #tvdesktop-megamenu .tv-menu-horizontal li.level-1 .img-icon,
    .tvcms-header-menu-offer-wrapper .tv-menu-horizontal li.level-1 .img-icon {
        filter: none !important;
        opacity: 1 !important;
    }

    #tvdesktop-megamenu .tv-menu-horizontal .menu-dropdown,
    #tvdesktop-megamenu .tv-menu-horizontal .tv-sub-menu.menu-dropdown,
    .tvcms-header-menu-offer-wrapper .tv-menu-horizontal .menu-dropdown,
    .tvcms-header-menu-offer-wrapper .tv-menu-horizontal .tv-sub-menu.menu-dropdown {
        background-color: #ffffff !important;
        background-image: none !important;
        border-bottom: 3px solid var(--si-accent, #39b54a) !important;
        border-radius: 0 0 12px 12px !important;
        box-shadow: var(--si-shadow-hover, 0 8px 28px rgba(0, 0, 0, 0.1)) !important;
        z-index: 10065 !important;
        max-height: min(70vh, calc(100dvh - 180px)) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Megamenu preset backgrounds from BO — keep white base, allow inline bg only inside panel */
    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.megamenu1 > .menu-dropdown,
    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.megamenu2 > .menu-dropdown {
        background-color: #ffffff !important;
        height: auto !important;
        min-height: 0 !important;
    }

    /* Hover: native ThemeVolty CSS :hover > .menu-dropdown (no page backdrop) */
    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.parent:hover > .menu-dropdown,
    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.parent:hover > .tv-sub-menu.menu-dropdown {
        opacity: 1 !important;
        visibility: visible !important;
        transform: scale(1, 1) !important;
        pointer-events: auto !important;
    }

    /* Click-pinned dropdown (si-megamenu.js) */
    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.si-megamenu-active > .menu-dropdown,
    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.si-megamenu-active > .tv-sub-menu.menu-dropdown {
        opacity: 1 !important;
        visibility: visible !important;
        transform: scale(1, 1) !important;
        pointer-events: auto !important;
        display: block !important;
    }

    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.si-megamenu-active > a {
        background: rgba(57, 181, 74, 0.08) !important;
    }

    /* Click-open: light page lock (same pattern as account, no #wrapper.visible) */
    body.si-megamenu-click-open:not(.si-cart-open):not(.classicCartOpen):not(.si-account-open) .tv-main-div,
    body.si-megamenu-click-open:not(.si-cart-open):not(.classicCartOpen):not(.si-account-open) #wrapper,
    body.si-megamenu-click-open:not(.si-cart-open):not(.classicCartOpen):not(.si-account-open) #content-wrapper,
    body.si-megamenu-click-open:not(.si-cart-open):not(.classicCartOpen):not(.si-account-open) #content,
    body.si-megamenu-click-open:not(.si-cart-open):not(.classicCartOpen):not(.si-account-open) main,
    body.si-megamenu-click-open:not(.si-cart-open):not(.classicCartOpen):not(.si-account-open) .si-b2b-home {
        pointer-events: none !important;
    }

    body.si-megamenu-click-open #tvdesktop-megamenu,
    body.si-megamenu-click-open #tvdesktop-megamenu .menu-dropdown,
    body.si-megamenu-click-open #tvdesktop-megamenu .tv-sub-menu.menu-dropdown,
    body.si-megamenu-click-open .si-page-backdrop {
        pointer-events: auto !important;
    }

    /* Header stays interactive when megamenu click-open */
    body.si-megamenu-click-open #header,
    body.si-megamenu-click-open .tvcms-header-menu-offer-wrapper {
        pointer-events: auto !important;
        z-index: 60;
    }
}

/* Mobile: do not interfere — drawer handled by si-mobile-menu.js */
@media (max-width: 991px) {
    body.menu-open .tv-main-div .half-wrapper-backdrop {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* 20260704-nav-bars-visual — brand row layout overrides (after module front.css) */
@media (min-width: 992px) {
    .tvcms-header-menu-offer-wrapper {
        min-height: 0 !important;
        background-color: var(--si-bg-alt, #f5f5f7) !important;
    }

    #tvdesktop-megamenu .container_tv_megamenu,
    #tvdesktop-megamenu .tv-menu-horizontal .menu-content {
        background: transparent !important;
    }

    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.parent > a::after {
        display: none !important;
    }

    #tvdesktop-megamenu .tv-menu-horizontal li.level-1 .icon-drop-mobile {
        align-self: center;
        margin-top: 0;
    }
}

/* ── Desktop menu stacking — brand megamenu above category bar + page (20260706-desktop-menu-stack) ── */
@media (min-width: 992px) {
    #header {
        position: relative;
        z-index: 200;
        overflow: visible !important;
    }

    #header .tvcms-header-menu-offer-wrapper,
    .tvcms-header-menu-offer-wrapper {
        position: relative;
        z-index: 60;
        overflow: visible !important;
    }

    .tvcmsdesktop-top-header-wrapper {
        position: relative;
        z-index: 60;
        overflow: visible !important;
    }

    .tvcms-header-menu-offer-wrapper .tvcms-header-menu,
    .tvcms-header-menu-offer-wrapper .tvcmsmain-menu-wrapper,
    .tvcms-header-menu-offer-wrapper .tvcmsmain-menu-wrapper.container,
    .tvcms-header-menu-offer-wrapper .tvcmsmain-menu-wrapper.si-brand-bar-inner,
    #tvdesktop-megamenu,
    #tvdesktop-megamenu .container_tv_megamenu,
    #tvdesktop-megamenu .tv-menu-horizontal,
    #tvdesktop-megamenu .tv-menu-horizontal .menu-content {
        overflow: visible !important;
    }

    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.parent {
        position: relative;
    }

    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.parent:hover,
    #tvdesktop-megamenu .tv-menu-horizontal li.level-1.si-megamenu-active {
        z-index: 10;
    }
}
