@import url('buttons.css');
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --auth-primary: #4481eb;
    --auth-primary-dark: #3568c4;
    --auth-accent: #04befe;
    --auth-text: #1e293b;
    --auth-text-muted: #64748b;
    --auth-surface: #ffffff;
    --auth-surface-muted: #f8fafc;
    --auth-border: #e2e8f0;
    --auth-radius: 16px;
    --auth-input-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body.auth-page {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    overflow-x: hidden;
    --btn-radius: 12px;
    --gradient-start: var(--auth-primary);
    --gradient-end: var(--auth-accent);
    background: var(--auth-surface);
    min-height: 100vh;
    min-height: 100dvh;
}

body.auth-page--test-env {
    padding-bottom: 48px;
}

.auth-page .container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--auth-surface);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    border: none;
}

.auth-page .forms-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 5;
    pointer-events: none;
}

.auth-page .signin-signup {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    left: 75%;
    width: 50%;
    max-width: 560px;
    transition: left 1s 0.7s ease-in-out, transform 1s 0.7s ease-in-out;
    display: grid;
    grid-template-columns: 1fr;
    z-index: 5;
    pointer-events: auto;
}

.auth-page form {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.25rem, 4vw, 3.5rem);
    transition: opacity 0.2s 0.7s;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 100vh;
    max-height: 100dvh;
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    -webkit-overflow-scrolling: touch;
}

.auth-page form.sign-up-form {
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.auth-page form.sign-in-form {
    z-index: 2;
}

.auth-page .auth-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}

.auth-page .auth-brand__logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 8px 20px rgba(68, 129, 235, 0.22);
}

.auth-page .auth-brand__name {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--auth-text);
}

.auth-page .title {
    font-size: clamp(1.45rem, 2.4vw, 1.85rem);
    font-weight: 800;
    color: var(--auth-text);
    margin-bottom: 0.35rem;
    letter-spacing: -0.03em;
    line-height: 1.15;
    text-align: center;
}

.auth-page .auth-subtitle {
    font-size: 0.92rem;
    color: var(--auth-text-muted);
    margin-bottom: 1.25rem;
    text-align: center;
    max-width: 380px;
    line-height: 1.45;
}

.auth-page .login-alerts {
    width: 100%;
    max-width: 380px;
    margin-bottom: 0.75rem;
}

.auth-page .login-alert {
    padding: 0.75rem 2.25rem 0.75rem 0.9rem;
    margin-bottom: 0.55rem;
    border-radius: var(--auth-input-radius);
    font-size: 0.86rem;
    line-height: 1.4;
    position: relative;
    font-weight: 500;
}

.auth-page .login-alert--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-page .login-alert--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.auth-page .login-alert--warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.auth-page .login-alert--info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.auth-page .login-alert__close {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    color: inherit;
    opacity: 0.65;
}

.auth-page .login-alert__close:hover {
    opacity: 1;
}

.auth-page .input-field {
    max-width: 380px;
    width: 100%;
    background: var(--auth-surface-muted);
    margin: 0.45rem 0;
    min-height: 52px;
    border-radius: var(--auth-input-radius);
    display: grid;
    grid-template-columns: 46px 1fr;
    padding: 0 0.85rem 0 0;
    border: 1px solid var(--auth-border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-page .input-field:focus-within,
.auth-page .input-field.active {
    background: #fff;
    border-color: color-mix(in srgb, var(--auth-primary) 55%, var(--auth-border));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--auth-primary) 14%, transparent);
}

.auth-page .input-field i {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-text-muted);
    transition: color 0.2s ease;
    font-size: 1rem;
}

.auth-page .input-field:focus-within i,
.auth-page .input-field.active i {
    color: var(--auth-primary);
}

.auth-page .input-field input {
    background: none;
    outline: none;
    border: none;
    line-height: 1.2;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--auth-text);
    width: 100%;
    padding: 0.85rem 0;
}

.auth-page .input-field input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.auth-page .input-field input:-webkit-autofill,
.auth-page .input-field input:-webkit-autofill:hover,
.auth-page .input-field input:-webkit-autofill:focus,
.auth-page .input-field input:-webkit-autofill:active,
.auth-page .input-field input:autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--auth-surface-muted) inset;
    box-shadow: 0 0 0 1000px var(--auth-surface-muted) inset;
    -webkit-text-fill-color: var(--auth-text);
    caret-color: var(--auth-text);
    transition: background-color 9999s ease-out 0s;
}

.auth-page .input-field:focus-within input:-webkit-autofill,
.auth-page .input-field:focus-within input:autofill,
.auth-page .input-field.active input:-webkit-autofill,
.auth-page .input-field.active input:autofill {
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    box-shadow: 0 0 0 1000px #fff inset;
}

.auth-page .remember-me {
    max-width: 380px;
    width: 100%;
    margin: 0.35rem 0 0.65rem;
    text-align: left;
}

.auth-page .auth-signin-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    max-width: 380px;
    margin: 0.35rem 0 0.65rem;
}

.auth-page .auth-signin-options .remember-me {
    width: auto;
    max-width: none;
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.auth-page .auth-forgot-link {
    flex-shrink: 0;
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--auth-primary);
    text-decoration: none;
    white-space: nowrap;
}

.auth-page .auth-forgot-link:hover {
    text-decoration: underline;
}

.auth-page .remember-me__label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--auth-text-muted);
}

.auth-page .remember-me__input {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}

.auth-page .remember-me__input:checked {
    background: var(--auth-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' d='M1 5l3 3 7-7'/%3E%3C/svg%3E") center/10px 10px no-repeat;
    border-color: var(--auth-primary);
}

.auth-page .btn {
    width: 100%;
    max-width: 380px;
    min-height: 50px;
    margin: 0.55rem 0 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.auth-page .panels-container {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

.auth-page .container::before {
    content: "";
    position: absolute;
    height: 220vh;
    width: 220vh;
    max-height: 2400px;
    max-width: 2400px;
    top: 50%;
    right: 50%;
    transform: translate(8%, -50%);
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22), transparent 45%),
        linear-gradient(135deg, var(--auth-primary) 0%, #3b6fd4 42%, var(--auth-accent) 100%);
    transition: transform 1.8s ease-in-out;
    border-radius: 50%;
    z-index: 6;
}

.auth-page .panel-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, clamp(180px, 22vw, 280px));
    flex-shrink: 0;
    transition: transform 1.1s ease-in-out;
    transition-delay: 0.4s;
}

.auth-page .panel-illustration__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    border: 2px solid rgba(255, 255, 255, 0.38);
    color: #fff;
    font-size: clamp(3.5rem, 8vw, 5.5rem);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(6px);
}

.auth-page .panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    text-align: left;
    z-index: 6;
    gap: clamp(1rem, 2.5vw, 1.5rem);
    padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 5vw, 4rem);
}

.auth-page .left-panel {
    pointer-events: all;
    padding-right: clamp(1.5rem, 8vw, 12%);
    padding-left: clamp(1.25rem, 6vw, 10%);
}

.auth-page .right-panel {
    pointer-events: none;
    align-items: flex-start;
    padding-left: clamp(1.5rem, 8vw, 12%);
    padding-right: clamp(1.25rem, 6vw, 10%);
}

.auth-page .panel .content {
    color: #fff;
    transition: transform 0.9s ease-in-out, opacity 0.9s ease-in-out;
    transition-delay: 0.6s;
    max-width: 360px;
}

.auth-page .panel h3 {
    font-weight: 800;
    line-height: 1.15;
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
}

.auth-page .panel p {
    font-size: clamp(0.88rem, 1.4vw, 0.95rem);
    line-height: 1.55;
    opacity: 0.92;
    margin-bottom: 1.25rem;
}

.auth-page .btn.transparent {
    margin: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    width: auto;
    min-width: 148px;
    min-height: 44px;
    max-width: none;
    padding: 0 1.25rem;
    font-weight: 700;
    font-size: 0.88rem;
    border-radius: 999px;
    box-shadow: none;
    backdrop-filter: blur(6px);
    color: #fff;
}

.auth-page .btn.transparent:hover {
    background: #fff;
    color: var(--auth-primary);
    border-color: #fff;
    transform: translateY(-1px);
    filter: none;
}

.auth-page .right-panel .panel-illustration,
.auth-page .right-panel .content {
    transform: translateX(120%);
    opacity: 0;
}

.auth-page .container.sign-up-mode::before {
    transform: translate(92%, -50%);
}

.auth-page .container.sign-up-mode .left-panel .panel-illustration,
.auth-page .container.sign-up-mode .left-panel .content {
    transform: translateX(-120%);
    opacity: 0;
}

.auth-page .container.sign-up-mode .signin-signup {
    left: 25%;
}

.auth-page .container.sign-up-mode form.sign-up-form {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
}

.auth-page .container.sign-up-mode form.sign-in-form {
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.auth-page .container.sign-up-mode .right-panel .panel-illustration,
.auth-page .container.sign-up-mode .right-panel .content {
    transform: translateX(0);
    opacity: 1;
}

.auth-page .container.sign-up-mode .left-panel {
    pointer-events: none;
}

.auth-page .container.sign-up-mode .right-panel {
    pointer-events: all;
}

@media (max-width: 1100px) and (min-aspect-ratio: 3/2) {
    .auth-page .signin-signup {
        width: 52%;
        max-width: none;
    }

    .auth-page .container.sign-up-mode .signin-signup {
        left: 22%;
    }
}

/* Узкий, квадратный или портретный экран — одна колонка (split с кругом ломается
   при aspect-ratio ≲ 3/2, напр. 1191×1184). max-aspect-ratio = width/height. */
@media (max-width: 1024px),
       (max-width: 1500px) and (max-aspect-ratio: 3/2),
       (orientation: portrait) and (max-width: 1600px) {
    .auth-page .container {
        display: flex;
        flex-direction: column;
        min-height: 100dvh;
        height: auto;
        background: var(--auth-surface);
    }

    .auth-page .container::before {
        display: none;
    }

    .auth-page .panels-container {
        order: 1;
        position: relative;
        flex: 0 0 auto;
        height: auto;
        min-height: 0;
        display: block;
        background: linear-gradient(135deg, var(--auth-primary) 0%, #3b6fd4 48%, var(--auth-accent) 100%);
        border-radius: 0 0 28px 28px;
        overflow: hidden;
    }

    .auth-page .forms-container {
        order: 2;
        position: relative;
        flex: 1 0 auto;
        width: 100%;
        height: auto;
        min-height: 0;
        pointer-events: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .auth-page .container.sign-up-mode .signin-signup {
        left: auto;
    }

    .auth-page .signin-signup {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        max-width: none;
        margin: 0;
        transition: none;
    }

    .auth-page .panel {
        position: relative;
        inset: auto;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 1.35rem 1.25rem 1.25rem;
        gap: 0.75rem;
        transform: none !important;
        opacity: 1 !important;
    }

    .auth-page .left-panel,
    .auth-page .right-panel {
        padding: 1.35rem 1.25rem 1.25rem;
    }

    .auth-page .right-panel {
        display: none;
    }

    .auth-page .container.sign-up-mode .left-panel {
        display: none;
        pointer-events: none;
    }

    .auth-page .container.sign-up-mode .right-panel {
        display: flex;
        pointer-events: all;
    }

    .auth-page .left-panel {
        display: flex;
        pointer-events: all;
    }

    .auth-page .panel .content {
        max-width: 420px;
        transform: none !important;
        opacity: 1 !important;
    }

    .auth-page .panel-illustration {
        width: min(120px, 32vw);
        transform: none !important;
        opacity: 1 !important;
    }

    .auth-page .panel-illustration__icon {
        font-size: clamp(2.25rem, 8vw, 3rem);
    }

    .auth-page form {
        justify-content: flex-start;
        align-items: center;
        max-height: none;
        min-height: 0;
        padding: 1.35rem 1.25rem 1.5rem;
    }

    .auth-page .container.sign-up-mode form.sign-in-form,
    .auth-page .container:not(.sign-up-mode) form.sign-up-form {
        position: absolute;
        width: 100%;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .auth-page .container.sign-up-mode form.sign-up-form,
    .auth-page .container:not(.sign-up-mode) form.sign-in-form {
        position: relative;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 520px) {
    .auth-page .panel-illustration {
        display: none;
    }

    .auth-page .panels-container {
        border-radius: 0 0 22px 22px;
    }

    .auth-page .panel {
        padding: 1.15rem 1rem 1rem;
        gap: 0.55rem;
    }

    .auth-page .panel h3 {
        font-size: 1.2rem;
        margin-bottom: 0.35rem;
    }

    .auth-page .panel p {
        font-size: 0.84rem;
        margin-bottom: 0.75rem;
        line-height: 1.45;
    }

    .auth-page .panel .content {
        max-width: 100%;
    }

    .auth-page .btn.transparent {
        min-height: 40px;
        min-width: 132px;
        font-size: 0.84rem;
    }

    .auth-page .title {
        font-size: 1.4rem;
    }

    .auth-page .auth-subtitle {
        font-size: 0.86rem;
        margin-bottom: 0.9rem;
    }

    .auth-page form {
        padding: 1.1rem 1rem 1.25rem;
    }

    .auth-page .input-field {
        min-height: 48px;
        margin: 0.35rem 0;
    }

    .auth-page .btn {
        min-height: 46px;
        margin-top: 0.45rem;
    }
}

body.auth-page--simple {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(68, 129, 235, 0.08), rgba(4, 190, 254, 0.06));
}

.auth-simple {
    width: 100%;
    max-width: 440px;
}

.auth-simple__card {
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 2rem 1.75rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.auth-simple__title {
    margin: 0.75rem 0 0.85rem;
    font-size: 1.45rem;
    color: var(--auth-text);
}

.auth-simple__text {
    margin: 0 0 0.75rem;
    color: var(--auth-text-muted);
    line-height: 1.5;
}

.auth-simple__form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1rem;
}

.auth-simple__btn {
    width: 100%;
    margin-top: 0.35rem;
}

.auth-simple__link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-simple__link:hover {
    text-decoration: underline;
}

.auth-resend-form {
    width: 100%;
    margin: 0.25rem 0 0.5rem;
}

.auth-resend-form__btn {
    width: 100%;
    font-size: 0.88rem;
}

@media (max-height: 700px) and (min-width: 1025px) and (min-aspect-ratio: 3/2) {
    .auth-page form {
        justify-content: flex-start;
        padding-top: 1.25rem;
        padding-bottom: 1.25rem;
    }

    .auth-page .panel {
        justify-content: center;
    }

    .auth-page .panel-illustration {
        width: min(100%, 180px);
    }

    .auth-page .panel-illustration__icon {
        font-size: 3.5rem;
    }
}
