/* SR Power mobile top bar final fix
   Purpose: keep top Wishlist and Cart separate, aligned, and inside the header on all mobile widths.
   This file is intentionally loaded after customer/wishlist CSS so it can safely override older conflicting rules. */

@media (max-width: 768px) {
    .premium-site-header .header-shell,
    .site-header .header-shell {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        grid-template-areas:
            "brand actions"
            "search search" !important;
        align-items: center !important;
        column-gap: 12px !important;
        row-gap: 12px !important;
        padding-top: 14px !important;
        padding-bottom: 14px !important;
    }

    .premium-site-header .brand-logo,
    .site-header .brand-logo {
        grid-area: brand !important;
        min-width: 0 !important;
        white-space: nowrap !important;
        font-size: clamp(22px, 6vw, 28px) !important;
        line-height: 1 !important;
    }

    .premium-site-header .header-actions,
    .site-header .header-actions {
        grid-area: actions !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 14px !important;
        width: auto !important;
        min-width: 106px !important;
        max-width: none !important;
        overflow: visible !important;
        flex-wrap: nowrap !important;
        justify-self: end !important;
    }

    .premium-site-header .header-search,
    .premium-site-header .header-search-form,
    .site-header .header-search,
    .site-header .header-search-form {
        grid-area: search !important;
        grid-column: 1 / -1 !important;
        width: 100% !important;
        min-width: 0 !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 10px !important;
        align-items: center !important;
    }

    .premium-site-header .header-account-wrap,
    .site-header .header-account-wrap,
    .premium-site-header .desktop-menu-toggle,
    .site-header .desktop-menu-toggle,
    .premium-site-header .menu-toggle,
    .site-header .menu-toggle {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .premium-site-header .header-wishlist-btn,
    .premium-site-header .top-cart-icon-btn,
    .site-header .header-wishlist-btn,
    .site-header .top-cart-icon-btn {
        position: relative !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 48px !important;
        min-width: 48px !important;
        max-width: 48px !important;
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 18px !important;
        background: #ffffff !important;
        border: 1px solid rgba(203, 213, 225, .95) !important;
        box-shadow: 0 10px 22px rgba(15, 23, 42, .10) !important;
        overflow: visible !important;
        flex: 0 0 48px !important;
        transform: none !important;
    }

    .premium-site-header .wishlist-top-icon,
    .premium-site-header .top-cart-icon,
    .site-header .wishlist-top-icon,
    .site-header .top-cart-icon {
        width: 23px !important;
        height: 23px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .premium-site-header .wishlist-top-icon svg,
    .premium-site-header .top-cart-icon svg,
    .site-header .wishlist-top-icon svg,
    .site-header .top-cart-icon svg {
        width: 22px !important;
        height: 22px !important;
        display: block !important;
    }

    .premium-site-header .header-wishlist-badge,
    .premium-site-header .wishlist-count,
    .premium-site-header .top-cart-badge,
    .premium-site-header .cart-count,
    .site-header .header-wishlist-badge,
    .site-header .wishlist-count,
    .site-header .top-cart-badge,
    .site-header .cart-count {
        position: absolute !important;
        top: -9px !important;
        right: -9px !important;
        z-index: 4 !important;
        min-width: 22px !important;
        height: 22px !important;
        padding: 0 6px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 999px !important;
        background: #0f172a !important;
        color: #ffffff !important;
        border: 2px solid #ffffff !important;
        font-size: 11px !important;
        line-height: 1 !important;
        font-weight: 900 !important;
        box-shadow: 0 8px 16px rgba(15, 23, 42, .22) !important;
        transform: none !important;
        pointer-events: none !important;
    }
}

@media (max-width: 390px) {
    .premium-site-header .header-shell,
    .site-header .header-shell {
        column-gap: 10px !important;
    }

    .premium-site-header .header-actions,
    .site-header .header-actions {
        gap: 10px !important;
        min-width: 100px !important;
    }

    .premium-site-header .header-wishlist-btn,
    .premium-site-header .top-cart-icon-btn,
    .site-header .header-wishlist-btn,
    .site-header .top-cart-icon-btn {
        width: 45px !important;
        min-width: 45px !important;
        max-width: 45px !important;
        height: 45px !important;
        min-height: 45px !important;
        max-height: 45px !important;
        flex-basis: 45px !important;
        border-radius: 17px !important;
    }
}

/* Phase 1 production stability patch: safe header, bottom nav, and checkout spacing. */
html {
    overflow-x: hidden;
}

body {
    overflow-x: clip;
}

.site-header,
.premium-site-header {
    isolation: isolate;
}

.header-action-btn svg {
    fill: currentColor;
}

.cart-count:empty,
.wishlist-count:empty {
    display: none !important;
}

@media (max-width: 768px) {
    body {
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }

    .premium-site-header .header-search-field,
    .site-header .header-search-field {
        min-width: 0 !important;
    }

    .premium-site-header .header-search input,
    .site-header .header-search input {
        min-width: 0 !important;
        width: 100% !important;
        font-size: 16px !important;
    }

    .premium-site-header .header-search button,
    .site-header .header-search button {
        white-space: nowrap !important;
        min-height: 44px !important;
    }

    .mobile-bottom-nav,
    .sr-mobile-bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
        z-index: 999 !important;
    }

    .premium-checkout-layout,
    .checkout-page .premium-checkout-layout {
        grid-template-columns: 1fr !important;
    }

    .premium-checkout-summary {
        order: -1;
    }

    .checkout-submit-btn[disabled],
    .checkout-submit-btn[aria-busy="true"] {
        cursor: wait !important;
        opacity: .72 !important;
    }
}

@media (max-width: 360px) {
    .premium-site-header .header-actions,
    .site-header .header-actions {
        gap: 8px !important;
        min-width: 92px !important;
    }

    .premium-site-header .brand-logo,
    .site-header .brand-logo {
        font-size: clamp(20px, 5.7vw, 24px) !important;
    }
}
