:root {
    --mobile-auth-primary: #53186d;
    --mobile-auth-primary-hover: #421257;
    --mobile-auth-border: #e8e4ea;
    --mobile-auth-muted: #8c8790;
    --mobile-auth-danger: #c72d3b;
}

[x-cloak] {
    display: none !important;
}

.mobile-auth-modal {
    --bs-modal-width: 520px;
    font-family: 'PingAR', sans-serif;
}

.modal-backdrop.show {
    background-color: rgb(24 12 29 / 38%);
    opacity: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-open .mobile-bottom-nav {
    z-index: 1040;
}

.mobile-auth-modal .modal-dialog {
    padding: 20px;
}

.mobile-auth-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 28px;
    box-shadow: 0 24px 80px rgb(34 15 43 / 28%);
}

.mobile-auth-modal__scroll {
    max-height: min(780px, calc(100dvh - 48px));
    padding: 24px 34px 28px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d7d1da transparent;
}

.mobile-auth-modal__grabber {
    display: none;
}

.mobile-auth-modal__close {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 4;
    display: inline-flex;
    width: 38px;
    height: 38px;
    padding: 0;
    align-items: center;
    justify-content: center;
    color: #625d66;
    background: #f3f1f4;
    border: 0;
    border-radius: 50%;
    transition: color .2s ease, background-color .2s ease, transform .2s ease;
}

.mobile-auth-modal__close:hover,
.mobile-auth-modal__close:focus-visible {
    color: #fff;
    background: var(--mobile-auth-primary);
    transform: rotate(5deg);
}

.mobile-auth-modal__hero {
    display: flex;
    min-height:115px;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.mobile-auth-modal__hero img {
    display: block;
    width: 70px;
    max-height: 165px;
    object-fit: contain;
}

.mobile-auth-modal__heading {
    margin-bottom: 26px;
    text-align: center;
}

.mobile-auth-modal__heading h2 {
    margin: 0 0 8px;
    color: #201d22;
    font-size: 20px;
    font-weight: 800;
    line-height: 1.35;
}

.mobile-auth-modal__heading p {
    margin: 0;
    color: var(--mobile-auth-muted);
    font-size: 14px;
    line-height: 1.7;
}

.mobile-auth-panel {
    transform-origin: center bottom;
}

.mobile-auth-panel-enter,
.mobile-auth-panel-leave {
    transition: opacity .28s ease, transform .34s cubic-bezier(.22, 1, .36, 1);
}

.mobile-auth-panel-enter-start,
.mobile-auth-panel-leave-end {
    opacity: 0;
    transform: translateX(-28px) scale(.985);
}

.mobile-auth-panel-enter-end,
.mobile-auth-panel-leave-start {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.mobile-auth-field {
    margin-bottom: 10px;
}

.mobile-auth-field > label {
    display: block;
    margin-bottom: 8px;
    color: #39343c;
    font-size: 14px;
    font-weight: 700;
}

.mobile-auth-input,
.mobile-auth-phone,
.mobile-auth-password {
    width: 100%;
    min-height: 54px;
    color: #262229;
    background: #fff;
    border: 1px solid var(--mobile-auth-border);
    border-radius: 15px;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.mobile-auth-input {
    padding: 0 16px;
    outline: none;
}

select.mobile-auth-input {
    appearance: auto;
}

.mobile-auth-phone,
.mobile-auth-password {
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.mobile-auth-phone {
    direction: ltr;
}

.mobile-auth-phone > span {
    display: flex;
    min-width: 82px;
    align-items: center;
    justify-content: center;
    color: #4f4952;
    background: #faf9fa;
    border-inline-end: 1px solid var(--mobile-auth-border);
    font-size: 15px;
    font-weight: 700;
}

.mobile-auth-phone input,
.mobile-auth-password input {
    min-width: 0;
    flex: 1;
    padding: 0 16px;
    color: inherit;
    background: transparent;
    border: 0;
    outline: 0;
}

.mobile-auth-phone input::placeholder,
.mobile-auth-password input::placeholder,
.mobile-auth-input::placeholder {
    color: #aaa5ad;
}

.mobile-auth-password button {
    display: inline-flex;
    width: 52px;
    flex: 0 0 52px;
    align-items: center;
    justify-content: center;
    color: #8d8791;
    background: transparent;
    border: 0;
}

.mobile-auth-input:focus,
.mobile-auth-phone:focus-within,
.mobile-auth-password:focus-within {
    border-color: var(--mobile-auth-primary);
    box-shadow: 0 0 0 4px rgb(83 24 109 / 10%);
}

.mobile-auth-input.is-invalid,
.mobile-auth-phone.is-invalid,
.mobile-auth-password.is-invalid {
    border-color: var(--mobile-auth-danger);
}

.mobile-auth-error {
    margin-top: 6px;
    color: var(--mobile-auth-danger);
    font-size: 12px;
    line-height: 1.5;
}

.mobile-auth-error--terms {
    margin: -8px 2px 14px;
}

.mobile-auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 22px;
    font-size: 13px;
}

.mobile-auth-options a,
.mobile-auth-switch button,
.mobile-auth-terms a {
    color: var(--mobile-auth-primary);
    text-decoration: none;
}

.mobile-auth-options a:hover,
.mobile-auth-options a:focus-visible,
.mobile-auth-switch button:hover,
.mobile-auth-switch button:focus-visible,
.mobile-auth-terms a:hover,
.mobile-auth-terms a:focus-visible {
    text-decoration: underline;
}

.mobile-auth-remember,
.mobile-auth-terms {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #5f5962;
    cursor: pointer;
}

.mobile-auth-remember input,
.mobile-auth-terms input {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    accent-color: var(--mobile-auth-primary);
}

.mobile-auth-terms {
    margin: 2px 0 18px;
    font-size: 13px;
}

.mobile-auth-alert {
    margin-bottom: 14px;
    padding: 10px 12px;
    color: #92212e;
    background: #fff1f3;
    border: 1px solid #f3cbd0;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
}

.mobile-auth-submit {
    display: inline-flex;
    width: 100%;
    min-height: 56px;
    padding: 12px 22px;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--mobile-auth-primary);
    border: 0;
    border-radius: 15px;
    box-shadow: 0 10px 24px rgb(83 24 109 / 22%);
    font-size: 16px;
    font-weight: 800;
    transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.mobile-auth-submit:hover,
.mobile-auth-submit:focus-visible {
    color: #fff;
    background: var(--mobile-auth-primary-hover);
    box-shadow: 0 12px 28px rgb(83 24 109 / 30%);
    transform: translateY(-1px);
}

.mobile-auth-submit:disabled {
    cursor: wait;
    opacity: .7;
}

.mobile-auth-switch {
    margin: 20px 0 0;
    color: #77717a;
    font-size: 14px;
    text-align: center;
}

.mobile-auth-switch button {
    padding: 2px 5px;
    background: transparent;
    border: 0;
    font-weight: 800;
}

@media (max-width: 991.98px) {
    body.modal-open {
        padding-right: 0 !important;
    }

    .mobile-auth-modal {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .mobile-auth-modal .modal-dialog {
        width: 100%;
        max-width: none;
        min-height: 100%;
        margin: 0;
        padding: 0;
        align-items: flex-end;
    }

    .mobile-auth-modal.fade .modal-dialog {
        transform: translateY(100%);
        transition: transform .42s cubic-bezier(.22, 1, .36, 1);
    }

    .mobile-auth-modal.show .modal-dialog {
        transform: translateY(0);
    }

    .mobile-auth-modal .modal-content {
        max-height: calc(100dvh - 72px);
        border-radius: 28px 28px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .mobile-auth-modal__scroll {
        max-height: calc(100dvh - 72px - env(safe-area-inset-bottom));
        padding: 30px 24px 26px;
    }

    .mobile-auth-modal__grabber {
        position: absolute;
        top: 15px;
        left: 50%;
        z-index: 4;
        display: block;
        width: 50px;
        height: 5px;
        background: #d8d5da;
        border-radius: 999px;
        transform: translateX(-50%);
    }

    .mobile-auth-modal__close {
        top: 24px;
        left: 20px;
    }

    .mobile-auth-modal__hero {
        min-height: 117px;
    }

    .mobile-auth-modal__hero img {
        width: 70px;
        max-height: 150px;
    }
}

@media (max-width: 390px) {
    .mobile-auth-modal__scroll {
        padding-inline: 18px;
    }

    .mobile-auth-modal__heading h2 {
        font-size: 25px;
    }

    .mobile-auth-options {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-auth-modal.fade .modal-dialog,
    .mobile-auth-panel-enter,
    .mobile-auth-panel-leave,
    .mobile-auth-submit,
    .mobile-auth-modal__close {
        transition-duration: .01ms !important;
    }
}
