/* Cross-platform auth fixes — iOS Safari, Android Chrome, desktop */

/* 16px prevents iOS Safari zoom-on-focus; improves paste/autofill UX */
.landing-auth-form-group input[type="email"],
.landing-auth-form-group input[type="password"],
.landing-auth-form-group input[type="text"],
.eo-auth-content .css-1019714 input,
.eo-auth-content .css-1019714 textarea {
    font-size: 16px !important;
    line-height: 1.4 !important;
    height: auto !important;
    min-height: 44px;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(37, 154, 243, 0.2);
    -webkit-user-select: text;
    user-select: text;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.eo-auth-content .css-1019714 input,
.eo-auth-content .css-1019714 textarea {
    text-overflow: clip !important;
    overflow: visible;
}

/* iOS Keychain / autofill visibility on dark inputs */
.landing-auth-form-group input:-webkit-autofill,
.landing-auth-form-group input:-webkit-autofill:hover,
.landing-auth-form-group input:-webkit-autofill:focus,
.eo-auth-content .css-1019714 input:-webkit-autofill,
.eo-auth-content .css-1019714 input:-webkit-autofill:hover,
.eo-auth-content .css-1019714 input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff !important;
    caret-color: #fff;
    box-shadow: 0 0 0 1000px #20293e inset !important;
    -webkit-box-shadow: 0 0 0 1000px #20293e inset !important;
    transition: background-color 99999s ease-out 0s;
}

/* Auth modal must sit above language overlay (99996), PWA (99990), and live chat */
.landing-auth-portal {
    z-index: 100010;
}

.landing-auth-overlay {
    z-index: 0;
}

.landing-auth-modal {
    z-index: 1;
}

body.landing-auth-open .landing-header__lang-drop,
body.landing-auth-open .landing-header__lang-drop.is-open,
body.landing-auth-open .landing-header__lang-backdrop {
    pointer-events: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

body.landing-auth-open .lc-widget,
body.landing-auth-open #pwa-install-banner {
    pointer-events: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* iOS-friendly scroll lock (no position:fixed on body — that breaks inputs) */
html.landing-auth-scroll-lock,
body.landing-auth-scroll-lock {
    overflow: hidden;
    overscroll-behavior: none;
}

/* Submit buttons — 44px tap targets for iOS */
.landing-auth-submit,
.eo-auth-content .css-wj16if,
.eo-auth-content button[type="submit"] {
    min-height: 44px !important;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.landing-auth-form,
.eo-auth-content form {
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

/* iOS keyboard: allow panel to scroll instead of clipping fields */
@media (max-width: 768px) {
    .landing-auth-portal.is-open {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
    }

    .landing-auth-modal {
        position: relative;
        top: auto;
        left: auto;
        transform: none !important;
        margin: 0 auto;
        opacity: 1 !important;
        flex-shrink: 0;
    }

    .landing-auth-portal.is-open .landing-auth-modal {
        transform: none !important;
    }

    .landing-auth-panel {
        overflow: visible;
        max-height: none;
    }

    .landing-auth-slider {
        overflow: visible;
        width: 100%;
        max-width: 320px;
    }

    /* Avoid transform-based slide — iOS Safari misaligns taps on transformed ancestors */
    .landing-auth-slides.is-stacked {
        width: 100% !important;
        display: block;
        transform: none !important;
    }

    .landing-auth-slides.is-stacked .landing-auth-slide {
        width: 100% !important;
        min-height: 0;
    }

    .landing-auth-form-group--split {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .landing-auth-form-group--split .landing-auth-submit {
        width: 100%;
        margin-top: 0;
    }
}

/* Register checkbox — hidden inputs must remain tappable on iOS */
.landing-auth-checkbox input {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    pointer-events: auto;
    z-index: 2;
}

.eo-auth-content .checkbox-input {
    z-index: 2 !important;
    width: 20px !important;
    height: 20px !important;
    cursor: pointer;
}

/* Dedicated /login page */
.eo-auth-content {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    position: relative;
    z-index: 5;
}

.is-ios .eo-auth-content input,
.is-ios .landing-auth-form-group input {
    transform: translateZ(0);
}

@media (max-width: 768px) {
    .landing-body:has(.eo-auth-content) .lc-widget:not([hidden]) {
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .landing-body:has(.eo-auth-content) .css-1bm6b4s {
        padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    }
}
