/*
Theme Name: SoltanShop runtime foundations
Purpose: layout-critical fallbacks for authentication and mobile search.
*/

[hidden] {
    display: none !important;
}

/*
 * Both header variants are rendered in the same cached document. CSS owns
 * the viewport switch, so a desktop cache entry can never replace mobile UI.
 */
.soltanshop-mobile-header {
    display: none !important;
}

html.soltanshop-modal-open,
body.soltanshop-auth-popup-open,
body.soltanshop-mobile-search-open {
    overflow: hidden;
}

.authentication-popup-wrapper {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 12px;
    background: rgba(20, 30, 58, .36);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.authentication-popup-wrapper:not([hidden]) {
    display: block;
}

.authentication-popup-wrapper .authentication-wrapper {
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.authentication-popup-wrapper .authentication-container {
    position: relative;
    max-width: 100%;
}

.mobile-ajax-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: none;
    background: rgba(2, 25, 89, .18);
}

.mobile-ajax-search-overlay:not([hidden]) {
    display: block;
}

.mobile-header-bottom-search,
.mobile-header-bottom-search-form {
    position: relative;
}

.mobile-search-form__ajax-search-wrapper {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 9995;
    max-height: min(68vh, 560px);
    overflow-y: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(2, 25, 89, .16);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.mobile-search-form__ajax-search-wrapper.disable,
.mobile-search-form__ajax-search-wrapper[hidden] {
    display: none !important;
}

.mobile-search-form__ajax-search-wrapper:not(.disable):not([hidden]) {
    display: block;
}

.mobile-bottom-menu-wrapper {
    contain: layout style;
}

@media (min-width: 992px) {
    .mobile-ajax-search-overlay,
    .mobile-search-form__ajax-search-wrapper,
    .mobile-bottom-menu-wrapper {
        display: none !important;
    }
}

@media (max-width: 991px) {
    .soltanshop-desktop-header {
        display: none !important;
    }

    .soltanshop-mobile-header {
        display: block !important;
    }

    .authentication-popup-wrapper {
        padding: 12px 8px;
    }

    .authentication-popup-wrapper .authentication-container {
        width: min(100%, 480px);
        margin: auto;
    }

    body.soltanshop-has-mobile-bottom-menu {
        padding-bottom: max(72px, env(safe-area-inset-bottom));
    }
}
