/* ===== AUTH BACKGROUND & SHELL ===== */

.auth-container {
    min-height: 100vh;          /* fallback */
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vh, 28px) 12px;
    background: radial-gradient(circle at top left, #e0f2fe 0, #bfdbfe 30%, #e9d5ff 70%, #f5f3ff 100%);
    background-attachment: fixed;
}

.auth-shell {
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(8px, 1.6vh, 14px);
}

/* ===== ОБЩАЯ КАРТОЧКА АВТОРИЗАЦИИ (GLASS) ===== */

.auth-form {
    width: 100%;
    max-width: 360px;
    position: relative;
    background: radial-gradient(circle at 0% 0%, rgba(129, 140, 248, 0.14), transparent 55%),
                radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.14), transparent 55%),
                linear-gradient(135deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.82));
    padding: clamp(18px, 2.4vh, 26px) clamp(18px, 4vw, 26px);
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22),
                0 0 0 1px rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    text-align: left;
    color: #0f172a;
    overflow: hidden;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-form::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.55);
    mix-blend-mode: screen;
    pointer-events: none;
}

.auth-form h3 {
    margin-bottom: 20px;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    color: #0f172a;
}

.auth-form .error-message,
.auth-error-text {
    color: #b91c1c;
    margin-top: 6px;
    font-size: 0.9rem;
}

.auth-info-text {
    color: #15803d;
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 6px 0 14px;
    text-align: center;
}

.auth-choose {
    margin: 6px 0 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(63, 74, 141, .06);
    border: 1px solid rgba(63, 74, 141, .18);
}

.auth-choose__hint { font-size: 0.88rem; color: #4b5563; }
.auth-choose__label { margin-top: 8px; font-size: 0.85rem; color: #6b7280; }
.auth-choose__radio { display: flex; gap: 18px; margin-top: 8px; }

/* ===== ХЕДЕР ЛОГИН-СТРАНИЦ ===== */

.auth-form-brand {
    text-align: center;
    margin-bottom: 18px;
}

.auth-form-brand-main {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: #111827;
}

.auth-form-brand-sub {
    margin-top: 6px;
    font-size: 1.02rem;
    font-weight: 600;
    color: #4b5563;
}

/* ===== ИНПУТЫ / ПАРОЛЬ ===== */

.input-group {
    margin-bottom: 16px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1f2937;
}

/* Поля ввода в логин-форме */
.auth-form .input-group input,
.auth-form .input-group .form-control {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-size: 0.98rem;
    border: 1px solid rgba(148, 163, 184, .55);
    border-radius: 12px;
    background: rgba(255, 255, 255, .85);
    color: #0f172a;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
    font-family: inherit;
}

.auth-form .input-group input::placeholder {
    color: #94a3b8;
}

.auth-form .input-group input:hover {
    border-color: rgba(99, 102, 241, .5);
    background: #fff;
}

.auth-form .input-group input:focus {
    border-color: #3F4A8D;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 91, 199, .18);
}

/* Поле с ошибкой валидации */
.auth-form .input-group input.invalid,
.auth-form .input-group input.modified.invalid {
    border-color: #b91c1c;
    box-shadow: 0 0 0 4px rgba(185, 28, 28, .14);
}

.form-control {
    width: 100%;
}

.input-group-password {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
}

.input-group-password > label {
    grid-row: 1;
    grid-column: 1;
}

.input-group-password > input,
.input-group-password > .form-control {
    grid-row: 2;
    grid-column: 1;
    padding-right: 44px !important;
}

.input-group-password > .auth-error-text {
    grid-row: 3;
    grid-column: 1;
}

.input-group-password .password-toggle {
    grid-row: 2;
    grid-column: 1;
    justify-self: end;
    align-self: center;
    margin-right: 6px;
    position: relative !important;
    top: auto !important;
    right: auto !important;
    border: none !important;
    background: none !important;
    padding: 6px !important;
    border-radius: 8px;
    cursor: pointer;
    color: #4b5563 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    z-index: 2;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    min-height: 32px;
    line-height: 1 !important;
    transition: background .15s ease, color .15s ease;
}

.input-group-password .password-toggle > svg {
    width: 20px;
    height: 20px;
    display: block;
}

.input-group-password .password-toggle:hover {
    background: rgba(148, 163, 184, .18);
    color: #1f2937 !important;
}

.password-icon {
    width: 22px;
    height: 22px;
}

@media (max-width: 600px) {
    .auth-form .input-group input {
        padding: 10px 12px;
        font-size: 0.92rem;
    }
}

/* ===== КНОПКИ НА ЛОГИН-СТРАНИЦАХ ===== */

.auth-form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.auth-form-actions .rz-button {
    width: 100%;
    justify-content: center;
    border-radius: 14px;
    min-height: 44px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: none !important;
    transition: background-color .18s ease, color .18s ease,
                border-color .18s ease, transform .12s ease;
}

.auth-form-actions .rz-button:hover {
    transform: translateY(-1px);
}

/* Primary "Войти" — solid бренд */
.auth-form-actions .rz-button.rz-primary {
    background: var(--rlv-primary) !important;
    color: #fff !important;
    border: 1px solid var(--rlv-primary) !important;
}

.auth-form-actions .rz-button.rz-primary:hover {
    background: var(--rlv-primary-600) !important;
    border-color: var(--rlv-primary-600) !important;
}

/* Secondary "Регистрация" — outline бренд */
.auth-form-actions .rz-button.rz-secondary {
    background: transparent !important;
    border: 1px solid var(--rlv-primary) !important;
    color: var(--rlv-primary) !important;
}

.auth-form-actions .rz-button.rz-secondary:hover {
    background: rgba(63, 74, 141, .08) !important;
}

/* Light "Я клиент / Я терапевт" — нейтральный ghost */
.auth-form-actions .rz-button.rz-light {
    background: transparent !important;
    border: 1px solid rgba(148, 163, 184, .45) !important;
    color: #475569 !important;
}

.auth-form-actions .rz-button.rz-light:hover {
    background: rgba(148, 163, 184, .10) !important;
    color: #1f2937 !important;
}

/* ===== Нижние ссылки: text-only, общий стиль ===== */
.auth-form-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, .25);
}

.auth-form-link {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--rlv-primary) !important;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    padding: 4px 8px !important;
    min-height: auto !important;
    border-radius: 8px !important;
    text-decoration: none;
    transition: background-color .12s ease, color .12s ease;
}

.auth-form-link:hover {
    background: rgba(63, 74, 141, .08) !important;
    color: var(--rlv-primary-600) !important;
    text-decoration: underline;
}

.auth-form-link-sep {
    color: #cbd5e1;
    user-select: none;
}

/* ===== WHOAMI / ВЫБОР РОЛИ ===== */

.whoami-shell {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.whoami-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.whoami-hero::after {
    content: "";
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 260px;
    height: 80px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.45) 0, rgba(129, 140, 248, 0) 65%);
    pointer-events: none;
    z-index: -1;
}

.whoami-logo {
    height: clamp(120px, 22vh, 240px);
    max-width: 100%;
    object-fit: contain;
}

.whoami-card {
    text-align: center;
    padding-top: 24px;
}

.whoami-card-brand {
    position: relative;
    margin-bottom: 18px;
    z-index: 1;
}

.whoami-brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .32em;
    text-transform: uppercase;
    background: linear-gradient(90deg, #111827, #4f46e5);
    -webkit-background-clip: text;
    color: transparent;
}

.whoami-brand-sub {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 4px;
}

.whoami-card-brand::before {
    content: "";
    position: absolute;
    inset: -14px 20px 4px;
    border-radius: 999px;
    background: radial-gradient(circle at 50% 0,
                rgba(129, 140, 248, 0.18),
                transparent 72%);
    opacity: 0.9;
    z-index: -1;
}

.auth-selection-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 16px 0 12px;
    color: #111827;
}

.whoami-ethics-link {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 12.5px;
    color: #8a8fa3;
    text-decoration: none;
    letter-spacing: .02em;
    transition: color .15s ease;
}

.whoami-ethics-link:hover {
    color: var(--rlv-primary, #3F4A8D);
    text-decoration: underline;
}

.auth-selection-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.auth-selection-buttons .rz-button {
    width: 100%;
    border-radius: 999px;
    min-height: 44px;
    font-weight: 600;
    font-size: 0.95rem;
}

.auth-selection-buttons .rz-button:first-child {
    background: linear-gradient(90deg, #3b4bb8, #3949a0);
    color: #ffffff;
    border: none;
    box-shadow: 0 10px 25px rgba(37, 56, 148, 0.35);
}

.auth-selection-buttons .rz-button:first-child:hover {
    background: linear-gradient(90deg, #343fa4, #323b8f);
}

.auth-selection-buttons .rz-button + .rz-button {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.65);
    color: #111827;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.auth-selection-buttons .rz-button + .rz-button:hover {
    background: rgba(248, 250, 252, 0.98);
}

.auth-selection-about {
    margin-top: 14px;
    border-radius: 999px !important;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(14, 165, 233, 0.7);
    color: #0369a1;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.16);
}

/* ===== MOBILE ===== */

@media (max-width: 600px) {
    .auth-container {
        padding: 16px 10px;
    }

    .auth-shell {
        max-width: 100%;
        gap: 10px;
    }

    .auth-form {
        padding: 18px 18px 18px;
        border-radius: 22px;
        box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    }

    .auth-selection-title {
        font-size: 1.1rem;
        margin: 12px 0 10px;
    }
}

@media (max-height: 720px) {
    .whoami-logo { height: clamp(80px, 14vh, 140px); }
    .auth-form-brand { margin-bottom: 10px; }
    .auth-shell { gap: 6px; }
    .auth-form { padding: 16px 22px 16px; }
    .auth-form .input-group { margin-bottom: 10px; }
    .auth-form-actions { gap: 8px; margin-top: 10px; }
    .auth-form-actions .rz-button { min-height: 38px; }
}

@media (max-height: 600px) and (orientation: landscape) {
    .auth-container {
        align-items: flex-start;
        padding-top: 10px;
    }

    .whoami-logo { height: 64px; }
    .auth-form { padding-top: 14px; }
}

@media (max-width: 400px) {
    .auth-container {
        padding: 12px 8px;
    }

    .auth-form {
        padding-inline: 14px;
    }
}
