﻿/* Theme-aware mobile-first */
#top-menu-list .mobile-megamenu,
#top-menu-list li.dropdown > ul {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    padding: 0;
    background: var(--surface-color);
    color: var(--default-color);
    box-shadow: none;
    transition: max-height 320ms ease, opacity 200ms ease, visibility 200ms;
}

/* Mobile open state */
@media (max-width: 991px) {
    #top-menu-list li.open > .mobile-megamenu,
    #top-menu-list li.open > ul,
    #top-menu-list li.open > ul.mobile-megamenu,
    #top-menu-list li.dropdown.open > ul {
        max-height: 60vh;
        opacity: 1;
        visibility: visible;
        overflow: auto;
        padding: 0.25rem 0;
        box-shadow: var(--shadow-md);
    }

    #top-menu-list > li {
        display: block;
    }

        #top-menu-list > li > a {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.75rem 1rem;
            min-height: 44px;
            color: var(--default-color);
        }

    #top-menu-list li.open > .mobile-megamenu {
        max-height: calc(60vh - 2rem);
        overflow-y: auto;
    }
}

/* Desktop */
@media (min-width: 992px) {
    #top-menu-list .mobile-megamenu {
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        overflow: hidden;
        transition: none;
    }

    #top-menu-list li.open > .desktop-megamenu {
        display: block;
        background: var(--surface-color);
        color: var(--default-color);
        box-shadow: var(--shadow-md);
    }

    .desktop-megamenu {
        position: absolute;
        left: 0;
        top: 100%;
        z-index: 1000;
        display: none;
    }
}

#top-menu-list a:hover {
    color: var(--accent-color);
}


/* Mobile only fix */
@media (max-width: 991px) {
    #top-menu-list .mobile-megamenu,
    #top-menu-list li.dropdown > ul {
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        overflow: hidden;
        padding: 0;
        margin: 0;
        list-style: none;
        background: var(--surface-color);
        color: var(--default-color);
        box-shadow: none;
        transition: max-height 320ms ease, opacity 200ms ease, visibility 200ms ease, padding 200ms ease;
        display: block;
    }

        #top-menu-list > li,
        #top-menu-list li.dropdown,
        #top-menu-list .mobile-megamenu li {
            display: block;
            width: 100%;
        }

            #top-menu-list > li > a,
            #top-menu-list li.dropdown > a,
            #top-menu-list .mobile-megamenu li > a,
            #top-menu-list li.dropdown > ul li > a {
                display: flex;
                align-items: center;
                justify-content: space-between;
                width: 100%;
                min-height: 44px;
                padding: 0.75rem 1rem;
                color: var(--default-color);
            }

    #top-menu-list .toggle-dropdown,
    #top-menu-list .bi-chevron-down {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 36px;
        min-height: 36px;
        cursor: pointer;
        flex-shrink: 0;
    }

    #top-menu-list li.open > .mobile-megamenu,
    #top-menu-list li.open > ul,
    #top-menu-list li.open > ul.mobile-megamenu,
    #top-menu-list li.dropdown.open > ul {
        max-height: 60vh;
        opacity: 1;
        visibility: visible;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0.25rem 0;
        box-shadow: var(--shadow-md);
    }

    #top-menu-list li.open > .mobile-megamenu {
        max-height: calc(60vh - 2rem);
    }

    #top-menu-list li.open > a .toggle-dropdown,
    #top-menu-list li.open > a .bi-chevron-down {
        transform: rotate(180deg);
        transition: transform 0.25s ease;
    }
}

/* ============================================================
   Mobile storefront preferences
   INSIDE the hamburger navigation list
   ============================================================ */

@media (max-width: 991px) {

    #top-menu-list > li.mobile-storefront-preferences {
        display: block;
        width: 100%;
        margin: 0;
        padding: 0 1rem 1rem;
        list-style: none;
        background: var(--nav-mobile-background-color, var(--surface-color));
        color: var(--default-color);
    }

    .mobile-preference-divider {
        height: 1px;
        margin: 0.5rem 0 0.35rem;
        background-color: var(--border-color);
    }

    .mobile-preference-row {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

        .mobile-preference-row:last-child {
            border-bottom: 0;
        }

    .mobile-preference-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        width: 100%;
        min-height: 48px;
        padding: 0.75rem 0.25rem;
        border: 0;
        border-radius: var(--radius-md);
        background: transparent;
        color: var(--default-color);
        font: inherit;
        text-align: start;
        cursor: pointer;
        transition: color 0.18s ease, background-color 0.18s ease;
    }

        .mobile-preference-toggle:hover,
        .mobile-preference-toggle:focus {
            color: var(--accent-color);
            background-color: var(--accent-soft);
            outline: none;
        }

        .mobile-preference-toggle:focus-visible {
            outline: 2px solid var(--accent-color);
            outline-offset: 2px;
        }

    .mobile-preference-label,
    .mobile-preference-current {
        display: inline-flex;
        align-items: center;
    }

    .mobile-preference-label {
        gap: 0.65rem;
        font-weight: 600;
    }

        .mobile-preference-label > i {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 1.25rem;
            color: var(--accent-color);
            font-size: 1rem;
        }

    .mobile-preference-current {
        gap: 0.45rem;
        color: var(--muted-color);
        font-size: 0.9rem;
        font-weight: 500;
    }

        .mobile-preference-current .bi-chevron-down {
            font-size: 0.75rem;
            transition: transform 0.2s ease;
        }

    .mobile-preference-toggle[aria-expanded="true"]
    .mobile-preference-current .bi-chevron-down {
        transform: rotate(180deg);
    }

    .mobile-preference-panel {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        float: none !important;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0.1rem 0 0.7rem;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

        .mobile-preference-panel[hidden] {
            display: none !important;
        }

    #mobileCurrencyMenu,
    #mobileLanguageMenu {
        position: static !important;
        width: 100%;
        max-height: min(260px, 38vh);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 0.15rem 0;
        background: transparent;
        scrollbar-width: thin;
        scrollbar-color: color-mix(in srgb, var(--accent-color), transparent 35%) transparent;
    }

    .mobile-preference-option {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        width: 100%;
        min-height: 42px;
        margin: 0.15rem 0;
        padding: 0.6rem 0.75rem;
        border: 1px solid transparent;
        border-radius: var(--radius-md);
        background: transparent;
        color: var(--default-color);
        font: inherit;
        font-size: 0.9rem;
        text-align: start;
        cursor: pointer;
        transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
    }

        .mobile-preference-option:hover,
        .mobile-preference-option:focus {
            color: var(--accent-color);
            background-color: var(--accent-soft);
            outline: none;
        }

        .mobile-preference-option.active {
            color: var(--accent-color);
            background-color: var(--accent-soft-2);
            border-color: color-mix(in srgb, var(--accent-color), transparent 55%);
            font-weight: 600;
        }

            .mobile-preference-option.active .bi-check2 {
                color: var(--accent-color);
                font-size: 1rem;
            }

    .mobile-preference-loading {
        padding: 0.65rem 0.75rem;
        color: var(--muted-color);
        font-size: 0.85rem;
    }

    #mobileCurrencyMenu::-webkit-scrollbar,
    #mobileLanguageMenu::-webkit-scrollbar {
        width: 7px;
    }

    #mobileCurrencyMenu::-webkit-scrollbar-thumb,
    #mobileLanguageMenu::-webkit-scrollbar-thumb {
        border-radius: 999px;
        background: color-mix(in srgb, var(--accent-color), transparent 35%);
    }

    html[dir="rtl"] .mobile-preference-toggle,
    html[dir="rtl"] .mobile-preference-option {
        text-align: right;
    }
}

@media (min-width: 992px) {
    #top-menu-list > li.mobile-storefront-preferences {
        display: none !important;
    }
}


/* =====================================================================
   SoftSpin V9.1 - Mobile Navigation Drawer Repair
   ---------------------------------------------------------------------
   Root causes fixed:
   1) The hamburger is `d-xl-none` (mobile/tablet below 1200px), while the
      custom top-menu rules previously stopped at 991px.
   2) The theme's generic mobile navigation positions the menu <ul> as an
      inset panel. Storefront/chrome rules could leave that panel constrained
      to a single row, producing the tiny scroll box seen on phones.
   3) Nested menu scrolling competed with the main menu scrolling.

   This block deliberately owns the COMPLETE mobile/tablet navigation layout
   below 1200px while leaving desktop >= 1200px unchanged.
   ===================================================================== */

@media (max-width: 1199.98px) {

    /* -------------------------------------------------------------
       Full-screen navigation overlay
       ------------------------------------------------------------- */
    body.mobile-nav-active {
        overflow: hidden !important;
        overscroll-behavior: none;
    }

        body.mobile-nav-active #header #navmenu {
            position: fixed !important;
            inset: 0 !important;
            z-index: 9998 !important;
            display: block !important;
            width: 100vw !important;
            height: 100dvh !important;
            min-width: 0 !important;
            min-height: 0 !important;
            margin: 0 !important;
            padding: 76px 12px 16px !important;
            overflow: hidden !important;
            background: color-mix( in srgb, var(--heading-color, #111827) 56%, transparent ) !important;
            backdrop-filter: blur(7px);
            -webkit-backdrop-filter: blur(7px);
        }

            /* -------------------------------------------------------------
       Main menu sheet
       ------------------------------------------------------------- */
            body.mobile-nav-active #header #navmenu > #top-menu-list {
                position: relative !important;
                inset: auto !important;
                top: auto !important;
                right: auto !important;
                bottom: auto !important;
                left: auto !important;
                display: block !important;
                width: min(100%, 560px) !important;
                height: auto !important;
                min-height: 0 !important;
                max-height: calc(100dvh - 96px) !important;
                margin: 0 auto !important;
                padding: 10px !important;
                overflow-x: hidden !important;
                overflow-y: auto !important;
                overscroll-behavior: contain;
                list-style: none !important;
                border: 1px solid color-mix( in srgb, var(--border-color) 82%, transparent ) !important;
                border-radius: 18px !important;
                background: color-mix( in srgb, var(--surface-color) 98%, var(--background-color) 2% ) !important;
                color: var(--default-color) !important;
                box-shadow: 0 30px 80px rgba(0, 0, 0, .28), 0 8px 24px rgba(0, 0, 0, .10) !important;
                scrollbar-width: thin;
                scrollbar-color: color-mix( in srgb, var(--accent-color) 35%, transparent ) transparent;
            }

                body.mobile-nav-active #header #navmenu > #top-menu-list::-webkit-scrollbar {
                    width: 7px;
                }

                body.mobile-nav-active #header #navmenu > #top-menu-list::-webkit-scrollbar-thumb {
                    border-radius: 999px;
                    background: color-mix( in srgb, var(--accent-color) 35%, transparent );
                }

        /* -------------------------------------------------------------
       Root items
       ------------------------------------------------------------- */
        body.mobile-nav-active #top-menu-list > li {
            position: relative !important;
            display: block !important;
            width: 100% !important;
            height: auto !important;
            min-height: 0 !important;
            margin: 0 !important;
            border-bottom: 1px solid color-mix( in srgb, var(--border-color) 72%, transparent );
        }

            body.mobile-nav-active #top-menu-list > li:last-child {
                border-bottom: 0;
            }

            body.mobile-nav-active #top-menu-list > li > a {
                position: relative !important;
                display: flex !important;
                align-items: center !important;
                justify-content: space-between !important;
                gap: 12px !important;
                width: 100% !important;
                min-height: 52px !important;
                margin: 0 !important;
                padding: 12px 12px !important;
                border: 0 !important;
                border-radius: 11px !important;
                background: transparent !important;
                color: var(--heading-color) !important;
                font-family: inherit !important;
                font-size: 15px !important;
                font-weight: 700 !important;
                line-height: 1.25 !important;
                letter-spacing: 0 !important;
                text-decoration: none !important;
                white-space: normal !important;
                box-shadow: none !important;
                transition: color .18s ease, background-color .18s ease !important;
            }

                body.mobile-nav-active #top-menu-list > li > a::after {
                    display: none !important;
                    content: none !important;
                }

                body.mobile-nav-active #top-menu-list > li > a:hover,
                body.mobile-nav-active #top-menu-list > li > a:focus,
                body.mobile-nav-active #top-menu-list > li > a.active,
                body.mobile-nav-active #top-menu-list > li.active > a,
                body.mobile-nav-active #top-menu-list > li.open > a {
                    background: color-mix( in srgb, var(--accent-color) 9%, transparent ) !important;
                    color: var(--accent-color) !important;
                }

        /* -------------------------------------------------------------
       Chevron / dropdown control
       ------------------------------------------------------------- */
        body.mobile-nav-active #top-menu-list .toggle-dropdown,
        body.mobile-nav-active #top-menu-list .bi-chevron-down {
            display: inline-grid !important;
            flex: 0 0 36px !important;
            width: 36px !important;
            min-width: 36px !important;
            height: 36px !important;
            min-height: 36px !important;
            margin: -4px -4px -4px auto !important;
            padding: 0 !important;
            place-items: center;
            border-radius: 9px !important;
            background: color-mix( in srgb, var(--accent-color) 8%, transparent ) !important;
            color: var(--accent-color) !important;
            font-size: 12px !important;
            line-height: 1 !important;
            transition: transform .22s ease, background-color .18s ease !important;
        }

        body.mobile-nav-active #top-menu-list li.open > a .toggle-dropdown,
        body.mobile-nav-active #top-menu-list li.open > a .bi-chevron-down {
            transform: rotate(180deg) !important;
            background: color-mix( in srgb, var(--accent-color) 14%, transparent ) !important;
        }

        /* -------------------------------------------------------------
       Nested menus / mobile mega menus.
       They expand INSIDE the one main scrolling sheet. They do not
       create a second independent viewport scrollbar anymore.
       ------------------------------------------------------------- */
        body.mobile-nav-active #top-menu-list .mobile-megamenu,
        body.mobile-nav-active #top-menu-list li.dropdown > ul,
        body.mobile-nav-active #top-menu-list li > ul {
            position: static !important;
            inset: auto !important;
            display: block !important;
            width: 100% !important;
            height: auto !important;
            margin: 0 !important;
            padding: 0 !important;
            max-height: 0 !important;
            overflow: hidden !important;
            visibility: hidden !important;
            opacity: 0 !important;
            border: 0 !important;
            border-radius: 0 !important;
            background: transparent !important;
            box-shadow: none !important;
            transform: none !important;
            transition: max-height .30s ease, opacity .20s ease, visibility .20s ease, padding .20s ease !important;
        }

        body.mobile-nav-active #top-menu-list li.open > .mobile-megamenu,
        body.mobile-nav-active #top-menu-list li.open > ul,
        body.mobile-nav-active #top-menu-list li.dropdown.open > ul {
            max-height: 65vh !important;
            padding: 3px 0 10px 12px !important;
            overflow: visible !important;
            visibility: visible !important;
            opacity: 1 !important;
        }

        body.mobile-nav-active #top-menu-list .mobile-megamenu li,
        body.mobile-nav-active #top-menu-list li.dropdown > ul li {
            display: block !important;
            width: 100% !important;
            height: auto !important;
            margin: 0 !important;
            padding: 0 !important;
        }

            body.mobile-nav-active #top-menu-list .mobile-megamenu li > a,
            body.mobile-nav-active #top-menu-list li.dropdown > ul li > a {
                display: flex !important;
                align-items: center !important;
                justify-content: space-between !important;
                gap: 10px !important;
                width: 100% !important;
                min-height: 44px !important;
                margin: 0 !important;
                padding: 9px 10px !important;
                border-radius: 9px !important;
                background: transparent !important;
                color: var(--default-color) !important;
                font-size: 13px !important;
                font-weight: 550 !important;
                line-height: 1.35 !important;
                white-space: normal !important;
            }

                body.mobile-nav-active #top-menu-list .mobile-megamenu li > a:hover,
                body.mobile-nav-active #top-menu-list li.dropdown > ul li > a:hover {
                    background: color-mix( in srgb, var(--accent-color) 7%, transparent ) !important;
                    color: var(--accent-color) !important;
                }

        /* Desktop mega menu is never part of the mobile drawer. */
        body.mobile-nav-active #top-menu-list .desktop-megamenu {
            display: none !important;
        }

        /* -------------------------------------------------------------
       Language / currency preferences
       ------------------------------------------------------------- */
        body.mobile-nav-active #top-menu-list > li.mobile-storefront-preferences {
            display: block !important;
            width: 100% !important;
            margin: 6px 0 0 !important;
            padding: 8px 4px 2px !important;
            border-top: 1px solid color-mix( in srgb, var(--border-color) 75%, transparent ) !important;
            background: transparent !important;
        }

        /* -------------------------------------------------------------
       The hamburger becomes the close button.
       Keep it above the overlay and comfortably tappable.
       ------------------------------------------------------------- */
        body.mobile-nav-active #header .mobile-nav-toggle {
            position: fixed !important;
            z-index: 10000 !important;
            top: max( 16px, env(safe-area-inset-top) ) !important;
            right: max( 16px, env(safe-area-inset-right) ) !important;
            display: inline-grid !important;
            width: 44px !important;
            height: 44px !important;
            margin: 0 !important;
            padding: 0 !important;
            place-items: center;
            border-radius: 50% !important;
            background: rgba(255, 255, 255, .14) !important;
            color: #fff !important;
            font-size: 28px !important;
            line-height: 1 !important;
            box-shadow: 0 8px 24px rgba(0, 0, 0, .16) !important;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }

        /* Prevent storefront navigation wrappers from clipping the drawer. */
        body.mobile-nav-active #header .ss-chrome-navigation-shell,
        body.mobile-nav-active #header .ss-commerce-nav-container,
        body.mobile-nav-active #header .ss-commerce-nav-row,
        body.mobile-nav-active #header .ss-storefront-navigation-slot,
        body.mobile-nav-active #header .header-nav,
        body.mobile-nav-active #header .header-nav > .container-fluid,
        body.mobile-nav-active #header .header-nav .position-relative {
            position: static !important;
            width: auto !important;
            height: auto !important;
            min-width: 0 !important;
            min-height: 0 !important;
            margin: 0 !important;
            padding: 0 !important;
            overflow: visible !important;
            transform: none !important;
        }
}

/* Small phone tuning */
@media (max-width: 575.98px) {

    body.mobile-nav-active #header #navmenu {
        padding: calc(68px + env(safe-area-inset-top)) 10px calc(12px + env(safe-area-inset-bottom)) !important;
    }

        body.mobile-nav-active #header #navmenu > #top-menu-list {
            width: 100% !important;
            max-height: calc( 100dvh - 82px - env(safe-area-inset-top) - env(safe-area-inset-bottom) ) !important;
            padding: 8px !important;
            border-radius: 15px !important;
        }

    body.mobile-nav-active #top-menu-list > li > a {
        min-height: 50px !important;
        padding: 11px 10px !important;
        font-size: 14px !important;
    }
}
