body.auth-modal-open { overflow: hidden; }

.auth-modal-overlay,
.auth-modal-overlay * { box-sizing: border-box; }

.auth-modal-overlay[hidden],
.auth-modal-form[hidden],
.auth-modal-alerts[hidden],
.auth-modal-switch-prompt[hidden],
.auth-modal-switch-button[hidden],
.auth-modal-legal[hidden] { display: none !important; }

.auth-modal-overlay {
    position: fixed;
    z-index: 5000;
    inset: 0;
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
    place-items: center;
    overflow-y: auto;
    background: rgb(18 22 30 / 68%);
    font-family: Arial, Helvetica, sans-serif;
    isolation: isolate;
}

.auth-modal-dialog {
    display: flex;
    flex-direction: column;
    width: min(470px, 100%);
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow: auto;
    border-radius: 21px;
    background: #fff;
    color: #111318;
    box-shadow: 0 22px 70px rgb(0 0 0 / 26%);
    animation: auth-modal-appear .2s ease-out both;
}

.auth-modal-main { padding: 34px 38px 30px; background: #fff; }
.auth-modal-title { margin: 0 0 16px; color: #101217; font-size: 27px; font-weight: 650; letter-spacing: -.035em; line-height: 1.2; }
.auth-modal-form { display: grid; gap: 10px; }
.auth-modal-input { width: 100%; min-height: 48px; padding: 0 17px; border: 2px solid transparent; border-radius: 14px; outline: 0; background: #f1f1f2; color: #171a20; font: inherit; font-size: 15px; transition: border-color .16s ease, background-color .16s ease; }
.auth-modal-input::placeholder { color: #85868a; opacity: 1; }
.auth-modal-input:focus { border-color: #39b9f4; background: #fff; }
.auth-modal-options { display: flex; align-items: center; min-height: 24px; margin: 1px 0 10px; }
.auth-modal-remember { display: inline-flex; align-items: center; gap: 10px; color: #17191e; font-size: 15px; line-height: 1.3; cursor: pointer; }
.auth-modal-remember input { width: 18px; height: 18px; margin: 0; accent-color: var(--BRAND_BLUE); }
.auth-modal-submit { display: inline-flex; align-items: center; justify-content: center; justify-self: start; gap: 7px; min-width: 82px; min-height: 42px; padding: 0 17px; border: 0; border-radius: 8px; background: var(--BRAND_BLUE); color: #fff; font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: background-color .16s ease; }
.auth-modal-submit:hover:not(:disabled) { background: var(--BRAND_BLUE_DARK); }
.auth-modal-submit:disabled { opacity: .8; cursor: wait; }
#authRegisterForm .auth-modal-submit { margin-top: 4px; }
.auth-modal-footer { padding: 25px 38px 27px; background: #f3f0ec; }
.auth-modal-switch-prompt { margin: 0 0 11px; color: #17191e; font-size: 15px; line-height: 1.4; }
.auth-modal-switch-button { display: inline-flex; align-items: center; justify-content: center; min-height: 41px; padding: 0 16px; border: 1px solid #e9e5e0; border-radius: 9px; background: #fff; box-shadow: 0 3px 9px rgb(37 31 24 / 12%); color: #17191e; font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: background-color .16s ease, box-shadow .16s ease; }
.auth-modal-switch-button:hover { background: #fafafa; box-shadow: 0 4px 12px rgb(37 31 24 / 16%); }
.auth-modal-legal { max-width: 360px; margin: 12px 0 0; color: #96989d; font-size: 12px; line-height: 1.5; }
.auth-modal-alerts { display: grid; gap: 8px; margin: 0 0 13px; }
.auth-modal-alert { margin: 0; padding: 10px 12px; border-radius: 9px; background: #fff1f0; color: #a62c27; font-size: 13px; line-height: 1.45; }
.auth-modal-close { position: fixed; z-index: 1; top: 8px; right: 17px; display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 0; background: transparent; color: #fff; font-family: Arial, Helvetica, sans-serif; font-size: 42px; font-weight: 300; line-height: 1; cursor: pointer; opacity: .9; }
.auth-modal-close:hover { opacity: 1; }
.auth-modal-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.auth-modal-spinner { display: none; width: 16px; height: 16px; border: 2px solid rgb(255 255 255 / 48%); border-top-color: #fff; border-radius: 50%; animation: auth-spin .8s linear infinite; }
.auth-modal-spinner.is-visible { display: inline-block; }

@keyframes auth-modal-appear { from { opacity: 0; transform: translateY(7px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (max-width: 540px) {
    .auth-modal-overlay { padding: 14px 12px; }
    .auth-modal-dialog { max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); border-radius: 18px; }
    .auth-modal-main { padding: 27px 24px 24px; }
    .auth-modal-footer { padding: 21px 24px 23px; }
    .auth-modal-close { top: 2px; right: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-modal-dialog { animation: none; }
    .auth-modal-input, .auth-modal-submit, .auth-modal-switch-button { transition: none; }
}
