/* dotascore/static/css/forms.css - СТИЛИ ФОРМ АВТОРИЗАЦИИ/РЕГИСТРАЦИИ */

/* clip, в отличие от hidden, не ломает липкую шапку */
html, body {
    overflow-x: hidden;
    overflow-x: clip;
    max-width: 100%;
}

/* На страницах форм общий контейнер страницы прозрачный: карточка сама себе оправа */
.leaderboard:has(.auth-card) {
    max-width: none;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    overflow: visible;
}

.auth-page {
    width: 100%;
}

/* ========================================================= */
/* КАРТОЧКА: ДВОЙНАЯ РАМКА */
/* ========================================================= */
.auth-card {
    --r: 28px;
    --pad: 6px;
    max-width: 440px;
    margin: 24px auto 0;
    padding: var(--pad);
    border-radius: var(--r);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--hair);
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8);
    transition: border-color 0.6s var(--ease), background 0.6s var(--ease), box-shadow 0.6s var(--ease);
}

.auth-card-core {
    padding: 34px 30px 30px;
    border-radius: calc(var(--r) - var(--pad));
    background: var(--core);
    box-shadow: var(--inner-light);
}

/* ОШИБКА: красная рамка и лёгкая встряска */
.auth-card.has-error {
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.07);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.18), 0 30px 70px -30px rgba(248, 113, 113, 0.55);
    animation: auth-shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.auth-card.has-error .auth-card-core {
    box-shadow: inset 0 1px 1px rgba(248, 113, 113, 0.3);
}

/* УСПЕХ: зелёная рамка */
.auth-card.is-success {
    border-color: rgba(52, 211, 153, 0.6);
    background: rgba(52, 211, 153, 0.07);
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.18), 0 30px 70px -30px rgba(52, 211, 153, 0.5);
}

.auth-card.is-success .auth-card-core {
    box-shadow: inset 0 1px 1px rgba(52, 211, 153, 0.3);
}

.auth-card.is-success .auth-title {
    text-shadow: 0 0 24px rgba(52, 211, 153, 0.45);
}

@keyframes auth-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

/* ========================================================= */
/* ЗАГОЛОВОК И ОПОВЕЩЕНИЯ */
/* ========================================================= */
.auth-title {
    margin: 0 0 24px;
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.15em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 24px rgba(0, 210, 255, 0.4);
}

.auth-alert {
    margin: 0 0 18px;
    padding: 12px 16px;
    list-style: none;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 14px;
    background: rgba(248, 113, 113, 0.12);
    color: #fecaca;
    font-size: 0.88em;
    line-height: 1.5;
    text-align: center;
}

.auth-alert ul {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.auth-hint {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 0.9em;
    line-height: 1.55;
    text-align: center;
}

/* ========================================================= */
/* ПОЛЯ ВВОДА */
/* ========================================================= */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.82em;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.form-field-group input[type="text"],
.form-field-group input[type="email"],
.form-field-group input[type="password"] {
    width: 100%;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
    border: 1px solid var(--hair);
    border-radius: 14px;
    font: inherit;
    transition: border-color 0.5s var(--ease), box-shadow 0.5s var(--ease), background 0.5s var(--ease);
}

.form-field-group input[type="text"]:focus,
.form-field-group input[type="email"]:focus,
.form-field-group input[type="password"]:focus {
    border-color: rgba(0, 210, 255, 0.6);
    background: rgba(255, 255, 255, 0.06);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 210, 255, 0.14);
}

/* Поле с ошибкой (проверка на клиенте) */
.form-field-group input[type].is-invalid,
.form-field-group input[type].is-invalid:focus {
    border-color: rgba(248, 113, 113, 0.7);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.14);
}

/* Автозаполнение браузера: тёмный фон и светлый текст вместо белой заливки */
.form-field-group input:-webkit-autofill,
.form-field-group input:-webkit-autofill:hover,
.form-field-group input:-webkit-autofill:active,
.form-field-group input:autofill {
    -webkit-text-fill-color: #fff !important;
    caret-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px #11151d inset !important;
    box-shadow: 0 0 0 1000px #11151d inset !important;
    transition: background-color 600000s 0s, color 600000s 0s;
}

.form-field-group input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff !important;
    caret-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px #11151d inset, 0 0 0 3px rgba(0, 210, 255, 0.14) !important;
    box-shadow: 0 0 0 1000px #11151d inset, 0 0 0 3px rgba(0, 210, 255, 0.14) !important;
    transition: background-color 600000s 0s, color 600000s 0s;
}

.form-field-group ul {
    list-style: none;
}

.field-errors {
    margin: 6px 0 0;
    padding: 0;
    color: #f87171;
    font-size: 0.8em;
}

/* ========================================================= */
/* ПОКАЗАТЬ ПАРОЛЬ */
/* ========================================================= */
.password-container {
    position: relative;
    width: 100%;
}

.password-toggle-icon {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    transition: color 0.4s var(--ease), background 0.4s var(--ease);
}

.password-toggle-icon:hover {
    color: var(--cyan);
    background: rgba(255, 255, 255, 0.06);
}

.password-toggle-icon svg {
    display: block;
    width: 24px;
    height: 24px;
}

.password-container input[type="password"],
.password-container input[type="text"] {
    padding-right: 50px;
}

/* ========================================================= */
/* КНОПКА И ССЫЛКИ */
/* ========================================================= */
.form-submit-button {
    position: relative;
    width: 100%;
    margin-top: 8px;
    padding: 11px 18px;
    overflow: hidden;
    background: rgba(0, 210, 255, 0.08);
    color: var(--cyan);
    border: 1px solid rgba(0, 210, 255, 0.5);
    border-radius: 999px;
    font: inherit;
    font-size: 0.88em;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-align: center;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12), 0 0 24px -10px rgba(0, 210, 255, 0.5);
    transition: transform 0.6s var(--ease), background 0.6s var(--ease), border-color 0.6s var(--ease), box-shadow 0.6s var(--ease), color 0.6s var(--ease);
}

/* Блик, пробегающий по кнопке */
.form-submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    transform: translateX(-130%) skewX(-18deg);
    transition: transform 0.9s var(--ease);
    pointer-events: none;
}

.form-submit-button:hover {
    transform: translateY(-1px);
    background: rgba(0, 210, 255, 0.16);
    border-color: var(--cyan);
    color: #7fe6ff;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.18), 0 0 30px -8px rgba(0, 210, 255, 0.7);
}

.form-submit-button:hover::before {
    transform: translateX(330%) skewX(-18deg);
}

.form-submit-button:active {
    transform: scale(0.98);
}

.form-submit-button:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

.auth-footer {
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 0.9em;
    text-align: center;
}

.auth-footer + .auth-footer {
    margin-top: 8px;
}

.auth-link,
.auth-link-muted {
    text-decoration: none;
    transition: color 0.4s var(--ease);
}

.auth-link {
    color: var(--cyan);
    font-weight: 600;
}

.auth-link:hover { color: #7fe6ff; }

.auth-link-muted {
    color: var(--muted);
}

.auth-link-muted:hover { color: var(--ink); }

/* ========================================================= */
/* МОБИЛЬНЫЕ */
/* ========================================================= */
@media (max-width: 600px) {
    .auth-card {
        --r: 22px;
        --pad: 5px;
        margin-top: 12px;
    }

    .auth-card-core {
        padding: 26px 18px 22px;
    }

    .auth-title {
        margin-bottom: 20px;
        font-size: 1em;
    }

    .form-field-group {
        width: 100%;
        overflow: visible;
    }

    .form-field-group input[type="text"],
    .form-field-group input[type="email"],
    .form-field-group input[type="password"] {
        padding: 12px 14px;
        font-size: 0.95em;
    }

    .password-container input[type="password"],
    .password-container input[type="text"] {
        padding-right: 50px;
    }

    .form-submit-button {
        padding: 10px 16px;
        font-size: 0.85em;
    }

    .form-field-group .frc-captcha {
        max-width: 80%;
        width: 100% !important;
        overflow: visible !important;
        display: block;
        margin: 15px 0;
    }

    .form-field-group .frc-captcha > * {
        width: 100% !important;
        max-width: 80% !important;
        min-width: 0 !important;
    }

    .auth-form {
        overflow: visible;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card.has-error { animation: none; }
    .form-submit-button::before { display: none; }
}