/* Карточка формы */
.auth-form {
    width: 100%;
    max-width: 400px;
    padding: 1.6rem;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 12px 40px rgba(0,0,0,0.06);
    transform: translateY(6px);
    animation: formEnter 760ms cubic-bezier(0.2,0.8,0.2,1) both;
}

@keyframes formEnter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.995);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.form-header h2 {
    font-size: 2.3rem;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    font-weight: 600;
    text-align: center;
}

.form-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto 0.8rem;
    text-align: center;
}

.form-header::after {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: var(--border-light);
    margin: 1.8rem 0 1.8rem;
    border-radius: 1px;
    opacity: 0.95;
}

/* Поля ввода и иконки */
.auth-form .field input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
}

.input-with-icon {
    position: relative;
    display: block;
}

.password-wrapper {
    display: block;
}

.input-with-icon input {
    padding-right: 44px;
    height: 50px;
    box-sizing: border-box;
}

/* Скрыть нативную кнопку показа/очистки пароля в браузерах */
.auth-form input[type="password"]::-ms-clear,
.auth-form input[type="password"]::-ms-reveal {
    display: none;
    width: 0;
    height: 0;
}
.auth-form input[type="password"]::-webkit-textfield-decoration-container,
.auth-form input[type="password"]::-webkit-password-reveal-button,
.auth-form input[type="password"]::-webkit-textfield-decoration-button,
.auth-form input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none;
}

.input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    fill: var(--text-muted);
    opacity: 0.95;
    pointer-events: none;
}

.input-with-icon input:focus ~ .input-icon, .input-with-icon input.has-value ~ .input-icon {
    fill: var(--accent);
    color: var(--accent);
    opacity: 1;
}

.auth-form input, .auth-form select, .auth-form textarea {
    transition: box-shadow .18s ease, border-color .15s ease, transform .08s ease;
    border: 1px solid var(--border-light);
}
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 12px 36px rgba(96,165,250,0.16), 0 4px 12px rgba(147,197,253,0.08);
}
.auth-form input.has-value, .auth-form textarea.has-value {
    border-color: var(--accent);
    box-shadow: 0 12px 36px rgba(96,165,250,0.16), 0 4px 12px rgba(147,197,253,0.08);
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-actions-form {
    margin-top: 0.6rem;
}

.auth-submit {
    width: 100%;
    padding: 0.85rem;
    margin-top: 0.9rem;
}

.auth-form .btn {
    font-size: 0.95rem;
    font-weight: 550;
    text-transform: none;
}
.auth-form .btn .btn-text,
.auth-form .btn span {
    font-weight: inherit;
}

.welcome-login {
    text-align: center;
    margin-top: 0.85rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Состояния ошибки */
.invalid-field {
    border-color: var(--error);
}

.invalid-field::placeholder {
    color: var(--error);
}

.invalid-field:focus {
    box-shadow: 0 8px 24px rgba(255,180,162,0.12);
}

.auth-form input.invalid-field, .auth-form input.invalid-field:focus, .auth-form input.has-value.invalid-field {
    border-color: var(--error);
    box-shadow: 0 8px 28px rgba(255,107,107,0.16);
}

.input-with-icon input.invalid-field ~ .input-icon, .input-with-icon input.invalid-field:focus ~ .input-icon {
    fill: var(--error);
    color: var(--error);
    opacity: 1;
}

.social-signin {
    text-align: center;
    margin-bottom: 0.0rem;
}

.social-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.social-buttons {
    display: flex;
    gap: 0;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

.social-btn {
    padding: 0 1rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    background: transparent;
    border-left: none;
    position: relative;
}

.social-btn + .social-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 22px;
    background: var(--border);
    opacity: 0.95;
    border-radius: 1px;
}

.social-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
    opacity: 0.95;
}

.divider {
    text-align: center;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.6rem 0;
}

.divider span{
    color: var(--text-muted);
    font-size: 0.85rem;
    position: relative;
    top: -2px;
    display: inline-block;
}

.divider::before, .divider::after {
    content: '';
    height: 1px;
    background: var(--border-light);
    flex: 1;
    display: block;
}

.auth-form .welcome-login a {
    color: var(--accent);
    text-decoration: none;
    position: relative;
}

.auth-form .welcome-login a:hover {
    /* Нативное подчёркивание заменено управляемой линией ниже текста */
    text-decoration: none;
}

.auth-form .welcome-login a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: currentColor;
    bottom: -1px;
    transform: scaleX(0);
    opacity: 0.95;
    border-radius: 1px;
}
.auth-form .welcome-login a:hover::after {
    transform: scaleX(1);
}

.auth-form .field {
    display: block;
    margin-bottom: 0.9rem;
}
.auth-form .field:last-child {
    margin-bottom: 0;
}

/* Проверка и переключение видимости пароля */
.password-checklist ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.password-checklist li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.15;
}

.password-checklist .check-icon {
    width: 14px;
    height: 2px;
    border-radius: 2px;
    background: var(--border-light);
    border: none;
    flex: 0 0 14px;
}

.password-checklist li.met {
    color: var(--accent);
}

.password-checklist li.invalid {
    color: #ffb4a2;
}

.password-checklist li.invalid .check-icon {
    background: #ffb4a2;
}

.field.invalid-label input {
    border-color: #ffb4a2;
}

.field.invalid-label input::placeholder {
    color: #ffb4a2;
}

.password-checklist li.met .check-icon {
    background: var(--accent);
    box-shadow: 0 6px 18px var(--accent-glow);
}

.password-toggle {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    width: 36px;
    height: 20px;
    border-radius: 8px;
    z-index: 9999;
}
.password-toggle svg { width: 18px; height: 18px; display: block; fill: currentColor; }
.password-toggle.visible { color: var(--accent); }
.password-toggle.invalid { color: #ff6b6b; }
.password-toggle:not(.show) { opacity: 0.65; }

/* Автозаполнение полей браузером */
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-card) inset !important;
    box-shadow: 0 0 0px 1000px var(--bg-card) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    color: var(--text-primary) !important;
    caret-color: var(--accent) !important;
    transition: background-color 5000s ease-in-out 0s;
}

input:-webkit-autofill:focus,
textarea:-webkit-autofill:focus,
select:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-card) inset !important;
    box-shadow: 0 0 0px 1000px var(--bg-card) inset !important;
}

input:-moz-autofill,
textarea:-moz-autofill,
select:-moz-autofill {
    box-shadow: 0 0 0px 1000px var(--bg-card) inset !important;
    -moz-text-fill-color: var(--text-primary) !important;
}
