/* === TL_MOBILE_NAV_V2_START ===
   TehranLight shared graphical mobile navigation
   One shared partial, one visual system, preserved 66px footprint.
   === */

@media (max-width: 840px) {
    body:is(.storefront-body, .customer-account-body) .mobile-bottom-nav.tl-mobile-nav {
        --tl-nav-edge: 10px;
        --tl-nav-height: 66px;
        --tl-nav-item-height: 52px;
        --tl-nav-icon-size: 30px;

        position: fixed !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        z-index: 420 !important;

        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        align-items: center !important;
        gap: 4px !important;

        width: 100% !important;
        height: auto !important;
        min-height: calc(var(--tl-nav-height) + env(safe-area-inset-bottom)) !important;
        margin: 0 !important;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important;

        overflow: hidden !important;
        border: 0 !important;
        border-top: 1px solid color-mix(in srgb, var(--tl-color-line-strong) 78%, white 22%) !important;
        border-radius: 0 !important;
        background: color-mix(in srgb, var(--tl-color-surface) 96%, white 4%) !important;
        box-shadow:
            0 -10px 30px rgba(15,38,70,.10),
            0 -1px 0 rgba(255,255,255,.55) inset !important;

        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        isolation: isolate;
    }

    body.storefront-body,
    body.customer-account-body {
        padding-bottom: calc(78px + env(safe-area-inset-bottom)) !important;
    }

    body.storefront-body.checkout-route,
    body.storefront-body.product-detail-route,
    body:has(.customer-address-capture-page) {
        padding-bottom: 0 !important;
    }


    body:is(.storefront-body, .customer-account-body) .mobile-bottom-nav.tl-mobile-nav::before {
        content: none;
        position: absolute;
        z-index: -1;
        top: 2px;
        right: 18px;
        left: 18px;
        height: 1px;
        border-radius: 999px;
        background:
            linear-gradient(
                90deg,
                transparent,
                color-mix(in srgb, var(--tl-color-primary) 24%, white 76%),
                transparent);
        opacity: .75;
        pointer-events: none;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item {
        position: relative !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: var(--tl-nav-item-height) !important;
        min-height: var(--tl-nav-item-height) !important;

        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 1px !important;

        margin: 0 !important;
        padding: 1px 2px 2px !important;

        border: 0 !important;
        border-radius: 16px !important;
        color: color-mix(in srgb, var(--tl-color-muted) 92%, var(--tl-color-text) 8%) !important;
        background: transparent !important;
        box-shadow: none !important;

        text-decoration: none !important;
        transform: none !important;
        -webkit-tap-highlight-color: transparent;
        transition:
            color .18s ease,
            transform .18s ease !important;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item::after {
        content: none !important;
        display: none !important;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__icon,
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .mobile-cart-action .mobile-cart-icon {
        position: relative !important;
        width: var(--tl-nav-icon-size) !important;
        min-width: var(--tl-nav-icon-size) !important;
        height: var(--tl-nav-icon-size) !important;
        min-height: var(--tl-nav-icon-size) !important;

        display: grid !important;
        place-items: center !important;

        margin: 0 !important;
        padding: 0 !important;

        overflow: visible !important;
        border: 1px solid color-mix(in srgb, var(--tl-color-line) 82%, white 18%) !important;
        border-radius: 10px !important;
        color: color-mix(in srgb, var(--tl-color-muted) 88%, var(--tl-color-primary) 12%) !important;
        background:
            linear-gradient(150deg, rgba(255,255,255,.92), rgba(255,255,255,.48)),
            color-mix(in srgb, var(--tl-color-surface) 94%, transparent) !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.92),
            inset 0 -1px 0 rgba(21,58,98,.04),
            0 5px 12px rgba(19,45,77,.08) !important;

        transform: translateY(0) !important;
        transition:
            transform .18s ease,
            color .18s ease,
            border-color .18s ease,
            background .18s ease,
            box-shadow .18s ease !important;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__icon::before {
        content: "";
        position: absolute;
        top: 2px;
        right: 4px;
        left: 4px;
        height: 35%;
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(255,255,255,.72), transparent);
        opacity: .9;
        pointer-events: none;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__icon > svg,
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .mobile-cart-action .mobile-cart-icon > svg {
        position: relative;
        z-index: 1;
        width: 18px !important;
        height: 18px !important;
        fill: none !important;
        stroke: currentColor !important;
        stroke-width: 1.75 !important;
        stroke-linecap: round !important;
        stroke-linejoin: round !important;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__label {
        display: block !important;
        max-width: 100%;
        overflow: hidden;
        color: inherit !important;
        font-size: var(--tl-type-100) !important;
        font-weight: 780 !important;
        line-height: 1.15 !important;
        text-overflow: ellipsis;
        white-space: nowrap;
        transition: color .18s ease, font-weight .18s ease;
    }

    /* Active item: raised glossy icon rather than a flat full-cell rectangle. */
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active,
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] {
        color: var(--tl-color-primary) !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: translateY(-1px) !important;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active .tl-mobile-nav__icon,
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] .tl-mobile-nav__icon {
        width: 32px !important;
        min-width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;

        border-color: color-mix(in srgb, var(--tl-color-primary) 64%, white 24%) !important;
        border-radius: 11px !important;
        color: #fff !important;
        background:
            linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 43%),
            linear-gradient(145deg, var(--tl-color-primary-hover), var(--tl-color-primary) 52%, var(--tl-color-primary-deep)) !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.34),
            inset 0 -1px 0 rgba(0,0,0,.12),
            0 8px 16px color-mix(in srgb, var(--tl-color-primary) 28%, transparent),
            0 2px 5px rgba(12,36,67,.12) !important;
        transform: translateY(-2px) !important;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active .tl-mobile-nav__label,
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] .tl-mobile-nav__label {
        color: var(--tl-color-primary) !important;
        font-weight: 950 !important;
    }

    /* Cart badge remains visually special but the cart cell uses the same shared geometry. */
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .mobile-cart-action {
        margin-top: 0 !important;
        background: transparent !important;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .mobile-cart-icon .cart-count {
        position: absolute !important;
        z-index: 4 !important;
        top: -6px !important;
        left: -7px !important;
        right: auto !important;

        min-width: 17px !important;
        height: 17px !important;
        padding: 0 4px !important;

        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;

        border: 2px solid color-mix(in srgb, var(--tl-color-surface) 92%, white 8%) !important;
        border-radius: 999px !important;
        color: #172033 !important;
        background:
            linear-gradient(180deg, #ffe992, #f5c84c 58%, #d7a51d) !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.72),
            0 5px 10px rgba(114,81,0,.22) !important;

        font-size: var(--tl-type-100) !important;
        font-weight: 950 !important;
        line-height: 1 !important;
    }

    /* Preserve the current focused-route behavior. These pages intentionally
       hide shared navigation and use their own purchase/action docks. */
    body.storefront-body.checkout-route .mobile-bottom-nav.tl-mobile-nav,
    body.storefront-body.product-detail-route .mobile-bottom-nav.tl-mobile-nav,
    body:has(.customer-address-capture-page) .mobile-bottom-nav.tl-mobile-nav {
        display: none !important;
    }

    /* Cart intentionally keeps the SAME shared nav; existing total strip remains above it. */
    body.storefront-body.cart-route .mobile-bottom-nav.tl-mobile-nav {
        display: grid !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
}

@media (max-width: 840px) {
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body) .mobile-bottom-nav.tl-mobile-nav {
        border-top-color: color-mix(in srgb, var(--tl-color-line-strong) 88%, transparent) !important;
        background: color-mix(in srgb, var(--tl-color-surface) 93%, #07111f 7%) !important;
        box-shadow:
            0 -14px 32px rgba(0,0,0,.28),
            0 -1px 0 rgba(255,255,255,.05) inset !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__icon {
        border-color: color-mix(in srgb, var(--tl-color-line) 88%, transparent) !important;
        color: color-mix(in srgb, var(--tl-color-muted) 86%, white 14%) !important;
        background:
            linear-gradient(150deg, rgba(255,255,255,.06), rgba(255,255,255,.015)),
            color-mix(in srgb, var(--tl-color-surface) 94%, #07111f 6%) !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.07),
            inset 0 -1px 0 rgba(0,0,0,.20),
            0 6px 14px rgba(0,0,0,.16) !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active .tl-mobile-nav__icon,
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] .tl-mobile-nav__icon {
        color: #fff !important;
        border-color: color-mix(in srgb, var(--tl-color-primary) 76%, #7fb4ff 24%) !important;
        background:
            linear-gradient(180deg, rgba(255,255,255,.17), rgba(255,255,255,0) 43%),
            linear-gradient(145deg, #3a85ff, var(--tl-color-primary) 54%, var(--tl-color-primary-deep)) !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.22),
            inset 0 -1px 0 rgba(0,0,0,.18),
            0 9px 18px color-mix(in srgb, var(--tl-color-primary) 31%, transparent) !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .mobile-cart-icon .cart-count {
        border-color: #101d30 !important;
    }
}

@media (max-width: 365px) {
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav {
        right: 0 !important;
        left: 0 !important;
        gap: 2px !important;
        padding-inline: 6px !important;
    }

    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__label {
        font-size: var(--tl-type-100) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-bottom-nav.tl-mobile-nav *,
    .mobile-bottom-nav.tl-mobile-nav *::before,
    .mobile-bottom-nav.tl-mobile-nav *::after {
        transition: none !important;
    }
}
/* === TL_MOBILE_NAV_V2_END === */


/* === TL_MOBILE_NAV_DARK_CONTRAST_FIX_START === */
@media (max-width: 840px) {
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__icon,
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .mobile-cart-action .mobile-cart-icon {
        color: #f4f7ff !important;
        border-color: rgba(255,255,255,.28) !important;
        background: rgba(255,255,255,.08) !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__label {
        color: #f4f7ff !important;
        opacity: .96 !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active,
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] {
        color: #ffffff !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active .tl-mobile-nav__icon,
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] .tl-mobile-nav__icon {
        color: #ffffff !important;
        border-color: rgba(255,255,255,.45) !important;
        background: rgba(255,255,255,.14) !important;
    }
}
/* === TL_MOBILE_NAV_DARK_CONTRAST_FIX_END === */


/* === TL_MOBILE_NAV_ACTIVE_DARK_TEXT_FIX_V2 === */
@media (max-width: 840px) {
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav .tl-mobile-nav__label {
        color: #dce9ff !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active .tl-mobile-nav__label,
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] .tl-mobile-nav__label {
        color: #ffffff !important;
        font-weight: 700 !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active,
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] {
        color: #ffffff !important;
    }
}
/* === TL_MOBILE_NAV_ACTIVE_DARK_TEXT_FIX_V2_END === */


/* === TL_MOBILE_NAV_FOCUS_THEME_SYNC_V1_START === */
@media (max-width: 840px) {
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active .tl-mobile-nav__icon,
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] .tl-mobile-nav__icon {
        width: 32px !important;
        min-width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;
        border-radius: 11px !important;
        color: #ffffff !important;
        border-color: color-mix(in srgb, var(--tl-color-primary) 64%, white 24%) !important;
        background:
            linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 43%),
            linear-gradient(145deg, var(--tl-color-primary-hover), var(--tl-color-primary) 52%, var(--tl-color-primary-deep)) !important;
        box-shadow:
            inset 0 1px 0 rgba(255,255,255,.34),
            inset 0 -1px 0 rgba(0,0,0,.12),
            0 8px 16px color-mix(in srgb, var(--tl-color-primary) 28%, transparent),
            0 2px 5px rgba(12,36,67,.12) !important;
        transform: translateY(-2px) !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item.is-active .tl-mobile-nav__label,
    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item[aria-current="page"] .tl-mobile-nav__label {
        color: #ffffff !important;
        font-weight: 950 !important;
    }

    html[data-theme="dark"]
    body:is(.storefront-body, .customer-account-body)
    .mobile-bottom-nav.tl-mobile-nav > .tl-mobile-nav__item:not(.is-active):not([aria-current="page"]) .tl-mobile-nav__label {
        color: #dce9ff !important;
        font-weight: 780 !important;
    }
}
/* === TL_MOBILE_NAV_FOCUS_THEME_SYNC_V1_END === */
