/* Unified auth surface: login, registration and one-time-code verification. */

.auth-page {
    isolation: isolate;
    position: relative;
    display: grid;
    min-height: 100dvh;
    place-items: center;
    overflow: hidden;
    padding-block: clamp(2rem, 6vw, 4.5rem);
    padding-inline: 1rem;
    z-index: 0;
    background:
        radial-gradient(ellipse 42rem 32rem at 94% 2%, rgba(37, 99, 235, .15), transparent 68%),
        radial-gradient(ellipse 36rem 30rem at 4% 96%, rgba(124, 58, 237, .12), transparent 70%),
        radial-gradient(ellipse 28rem 22rem at 50% 42%, rgba(79, 70, 229, .055), transparent 72%),
        linear-gradient(150deg, #ffffff 0%, #f5f8ff 52%, #fbf8ff 100%);
}

@media (min-width: 561px) {
    .auth-shell-page.auth-page {
        padding-block: clamp(2rem, 6vw, 4.5rem) !important;
    }
}

.auth-layout {
    min-height: 100dvh;
    background: #f7f9ff;
}

.auth-page::before {
    position: absolute;
    inset: 0;
    content: "";
    background-image:
        linear-gradient(rgba(37, 99, 235, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, .03) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 8%, transparent 72%);
    mask-image: radial-gradient(ellipse at center, #000 8%, transparent 72%);
    pointer-events: none;
}

.auth-orb {
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(2px);
}

.auth-orb--one {
    width: clamp(14rem, 30vw, 26rem);
    aspect-ratio: 1;
    top: -7rem;
    inset-inline-end: -6rem;
    border: 1px solid rgba(37, 99, 235, .12);
    background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, .8), rgba(37, 99, 235, .09));
}

.auth-orb--two {
    width: clamp(12rem, 24vw, 21rem);
    aspect-ratio: 1;
    bottom: -5rem;
    inset-inline-start: -4rem;
    border: 1px solid rgba(124, 58, 237, .1);
    background: radial-gradient(circle at 65% 30%, rgba(255, 255, 255, .7), rgba(124, 58, 237, .08));
}

.auth-shell {
    position: relative;
    z-index: 1;
    display: grid;
    width: 100%;
    place-items: center;
}

.auth-card--form {
    position: relative;
    width: min(100%, 27.5rem);
    overflow: hidden;
    border: 1px solid rgba(219, 228, 241, .9);
    border-radius: 1.85rem;
    background: rgba(255, 255, 255, .92);
    box-shadow:
        0 1.8rem 4.8rem rgba(23, 43, 77, .12),
        0 .35rem 1rem rgba(37, 99, 235, .06),
        inset 0 1px 0 rgba(255, 255, 255, .95);
    padding: clamp(1.35rem, 4.2vw, 2.15rem);
    backdrop-filter: blur(22px) saturate(145%);
    -webkit-backdrop-filter: blur(22px) saturate(145%);
    animation: auth-card-in 420ms cubic-bezier(.2, .8, .2, 1) both;
}

.auth-card--form::before {
    position: absolute;
    inset: 0 0 auto;
    height: .3rem;
    content: "";
    background: linear-gradient(90deg, #2563eb, #4f46e5 55%, #9333ea);
}

.auth-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.auth-logo {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: .85rem;
}

.auth-logo img {
    width: auto;
    max-width: 8.6rem;
    height: 3.75rem;
    object-fit: contain;
}

.auth-logo:focus-visible,
.auth-back-link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .3);
    outline-offset: 4px;
}

.auth-back-link {
    display: inline-flex;
    min-height: 2.25rem;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    border: 1px solid rgba(219, 228, 241, .95);
    border-radius: 999px;
    background: rgba(248, 250, 252, .9);
    color: #64748b;
    padding: .35rem .7rem;
    font-size: .78rem;
    font-weight: 850;
    line-height: 1.4;
    transition: border-color var(--transition-base), background var(--transition-base), color var(--transition-base), transform var(--transition-base);
}

.auth-back-link:hover {
    border-color: rgba(37, 99, 235, .28);
    background: #eff6ff;
    color: var(--color-primary);
    transform: translateY(-1px);
}

.auth-back-link svg {
    width: .95rem;
    height: .95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-card__head {
    display: grid;
    justify-items: center;
    gap: .35rem;
    margin-block: 1.3rem .15rem;
    text-align: center;
}

.auth-card__head h1,
.auth-card__head h2 {
    margin: 0;
    color: #14233d;
    font-size: clamp(1.35rem, 4.5vw, 1.6rem);
    font-weight: 950;
    line-height: 1.55;
    letter-spacing: -.02em;
}

.auth-card__head::after {
    width: 2.6rem;
    height: .22rem;
    margin-top: .55rem;
    border-radius: 999px;
    content: "";
    background: linear-gradient(90deg, #2563eb, #7c3aed);
    opacity: .9;
}

.auth-card__head p {
    max-width: 20rem;
    margin: 0;
    color: #64748b;
    font-size: .84rem;
    font-weight: 650;
    line-height: 1.95;
}

.auth-mobile-value {
    display: inline-flex;
    direction: ltr;
    color: var(--color-primary);
    font-weight: 950;
}

.auth-alert {
    width: 100%;
    margin: 0;
    border-radius: .95rem;
    padding: .7rem .85rem;
    font-size: .8rem;
    font-weight: 800;
    line-height: 1.8;
    text-align: center;
}

.auth-form {
    display: grid;
    gap: 1.1rem;
    margin-top: 1.2rem;
}

.auth-field {
    display: grid;
    gap: .5rem;
}

.auth-field label {
    color: #334155;
    font-size: .82rem;
    font-weight: 900;
}

.auth-input-shell {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 3.65rem;
    align-items: center;
    overflow: hidden;
    border: 1.5px solid rgba(37, 99, 235, .18);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.auth-input-shell:hover {
    border-color: rgba(37, 99, 235, .32);
}

.auth-input-shell:focus-within {
    border-color: rgba(37, 99, 235, .7);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .11), 0 10px 24px rgba(15, 23, 42, .06);
}

.auth-input-prefix {
    display: inline-flex;
    height: 100%;
    min-width: 3.15rem;
    align-items: center;
    justify-content: center;
    border-inline-start: 1px solid rgba(37, 99, 235, .1);
    background: linear-gradient(180deg, #f8fbff, #eff6ff);
    color: var(--color-primary);
}

.auth-input-prefix svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-input {
    width: 100%;
    min-height: 3.5rem;
    border: 0 !important;
    border-radius: 0;
    background: transparent;
    box-shadow: none !important;
    outline: none;
    padding-inline: .9rem;
    color: #14233d;
    font-size: .98rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.auth-input:focus {
    border: 0 !important;
    box-shadow: none !important;
}

.auth-input--ltr {
    direction: ltr;
    text-align: left;
}

.auth-input::placeholder {
    color: #a3b0c2;
    font-weight: 650;
    letter-spacing: .02em;
}

.auth-submit {
    min-height: 3.35rem !important;
    margin-top: .25rem !important;
    border-radius: .95rem !important;
    font-size: .9rem !important;
    font-weight: 950 !important;
}

.auth-submit:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 1.1rem 2.4rem rgba(37, 99, 235, .3) !important;
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .75rem;
    margin-block: 1.05rem;
    color: #94a3b8;
    font-size: .74rem;
    font-weight: 850;
}

.auth-divider::before,
.auth-divider::after {
    height: 1px;
    content: "";
    background: #e8eef6;
}

.auth-google-button {
    display: inline-flex;
    min-height: 3.25rem;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    border-color: #dce5f0;
    border-radius: .95rem;
    background: #fff;
    color: #1e293b;
    font-weight: 900;
}

.auth-google-button:disabled {
    cursor: wait;
    opacity: .75;
}

.auth-google-spinner {
    width: 1.35rem;
    height: 1.35rem;
    flex: 0 0 1.35rem;
}

.auth-google-mark {
    display: block;
    flex: 0 0 1.35rem;
    width: 1.5rem;
    height: 1.5rem;
}

.auth-link,
.auth-text-button {
    color: var(--color-primary);
    font-weight: 900;
}

.auth-text-button {
    border: 0;
    background: transparent;
    padding: 0;
}

.auth-text-button:disabled {
    color: #94a3b8;
    opacity: .72;
}

.field-error,
.validation-message {
    margin-top: .05rem;
    border: 0;
    border-radius: .55rem;
    background: transparent;
    padding: 0;
    color: var(--color-danger);
    font-size: .76rem;
    line-height: 1.75;
    text-align: right;
}

.auth-card--otp .field-error,
.auth-card--otp .validation-message {
    text-align: center;
}

.verify-form {
    gap: 1.15rem;
}

.otp-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    justify-content: center;
    gap: clamp(.42rem, 2vw, .65rem);
    width: min(100%, 21rem);
    margin-inline: auto;
    direction: ltr;
}

.auth-card--otp .otp-row input[data-otp-input] {
    width: 100%;
    min-width: 0;
    height: 3.75rem;
    border: 1.5px solid rgba(37, 99, 235, .2);
    border-radius: 1rem;
    background: #fff;
    color: #14233d;
    padding: 0;
    font-size: 1.35rem;
    font-weight: 950;
    text-align: center;
    direction: ltr;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .045);
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base), color var(--transition-base);
}

.auth-card--otp .otp-row input[data-otp-input]:hover {
    border-color: rgba(37, 99, 235, .34);
}

.auth-card--otp .otp-row input[data-otp-input]:focus {
    border-color: rgba(37, 99, 235, .74);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12), 0 10px 24px rgba(15, 23, 42, .06);
}

.auth-card--otp .otp-row--success input[data-otp-input],
.auth-card--otp .otp-row--success input[data-otp-input]:focus {
    border-color: rgba(22, 163, 74, .65);
    background: #f0fdf4;
    color: #047857;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, .11);
}

.auth-card--otp .otp-row--error input[data-otp-input],
.auth-card--otp .otp-row--error input[data-otp-input]:focus {
    border-color: rgba(220, 38, 38, .65);
    background: #fef2f2;
    color: #b91c1c;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, .1);
}

.auth-actions-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .6rem .95rem;
    margin-top: .4rem;
    border-top: 1px solid #edf2f8;
    padding-top: 1rem;
}

.auth-resend-button {
    display: inline-flex;
    min-height: 2.25rem;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border-radius: 999px;
    padding: .2rem .45rem;
    font-size: .8rem;
    line-height: 1.7;
}

.auth-countdown-badge {
    display: inline-flex;
    min-width: 3rem;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(37, 99, 235, .14);
    border-radius: 999px;
    background: #eff6ff;
    color: var(--color-primary);
    padding: .15rem .42rem;
    font-size: .72rem;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.auth-resend-button:disabled .auth-countdown-badge {
    border-color: #e5eaf2;
    background: #f8fafc;
    color: #94a3b8;
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card--form {
        animation: none;
    }
}

@media (max-width: 560px) {
    .auth-shell-page.auth-page {
        min-height: 100dvh;
        padding-block: 1.1rem 1.8rem !important;
    }

    .auth-shell {
        width: 100%;
    }

    .auth-card--form {
        width: min(100%, 27.5rem);
        border-radius: 1.45rem;
        padding: 1.15rem;
    }

    .auth-logo img {
        height: 3.3rem;
        max-width: 7.4rem;
    }

    .auth-back-link {
        min-height: 2.1rem;
        padding-inline: .55rem;
        font-size: .72rem;
    }

    .auth-card__head {
        margin-block: 1rem 0;
    }

    .auth-card__head p {
        font-size: .8rem;
    }

    .auth-form {
        margin-top: 1rem;
    }

    .otp-row {
        gap: .38rem;
        width: min(100%, 19.5rem);
    }

    .auth-card--otp .otp-row input[data-otp-input] {
        height: 3.25rem;
        border-radius: .85rem;
        font-size: 1.15rem;
    }
}

@media (max-width: 360px) {
    .auth-card--form {
        padding: 1rem;
    }

    .auth-logo img {
        max-width: 6.5rem;
        height: 3rem;
    }

    .otp-row {
        gap: .3rem;
    }

    .auth-card--otp .otp-row input[data-otp-input] {
        height: 3rem;
    }
}
