/**
 * Titan/LPM — Telas de Autenticação (unificadas)
 * Login, Cadastro, Esqueci a Senha, Redefinir Senha.
 * Dark minimalista estilo Apple/Gemini, consistente com o design system do app
 * (--primary-color #fbfcf9, dark #1f1f1f, raios 12-20px). Sem partículas.
 */

/* =================== LAYOUT BASE =================== */
.auth-container,
.forgot-password-container,
.reset-password-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    /* Fundo dark sutil com um leve brilho central — sem partículas */
    background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.04) 0%, transparent 55%),
        var(--bg-dark, #1f1f1f);
    overflow-y: auto;
}

.auth-card,
.forgot-password-card,
.reset-password-card {
    width: 100%;
    max-width: 400px;
    background: #202020;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    padding: 36px 32px;
    animation: authFadeIn 0.4s ease-out;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(12px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* =================== HEADER (logo + títulos) =================== */
.auth-header,
.forgot-password-header,
.reset-password-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #fff);
}

.auth-header h1,
.auth-header h2,
.forgot-password-header h1,
.reset-password-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
}

.auth-subtitle,
.forgot-password-header p,
.reset-password-header p {
    font-size: 14px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    margin: 0;
    line-height: 1.45;
}

/* =================== FORM =================== */
.auth-form,
.forgot-password-form,
.reset-password-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    position: relative;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    padding-left: 2px;
}

/* Campos de texto/senha/email — mesmo padrão dos inputs do app */
.form-input,
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.forgot-password-form input,
.reset-password-form input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary, #fff);
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.form-input::placeholder,
.auth-form input::placeholder,
.forgot-password-form input::placeholder,
.reset-password-form input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.form-input:focus,
.auth-form input:focus,
.forgot-password-form input:focus,
.reset-password-form input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

/* =================== CAMPO DE SENHA + TOGGLE =================== */
.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field input {
    width: 100%;
    padding-right: 46px;   /* espaço pro olho */
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    opacity: 1;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: rgba(255, 255, 255, 0.9);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* =================== OPÇÕES (lembrar / esqueci) =================== */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -2px 0 2px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.remember-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

.remember-checkbox.checked {
    background: var(--primary-color, #fbfcf9);
    border-color: var(--primary-color, #fbfcf9);
}

.remember-checkbox.checked::after {
    content: "";
    width: 4px;
    height: 8px;
    border: solid #1a1a1a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-0.5px, -1px);
}

.remember-me span,
.auth-options label {
    font-size: 13px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.forgot-link,
.auth-options a {
    font-size: 13px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    text-decoration: none;
    transition: color 0.15s ease;
}

.forgot-link:hover,
.auth-options a:hover {
    color: var(--text-primary, #fff);
}

/* =================== BOTÃO PRINCIPAL =================== */
.auth-btn,
.submit-btn,
.forgot-password-form button[type="submit"],
.reset-password-form button[type="submit"] {
    width: 100%;
    background: var(--primary-color, #fbfcf9);
    color: #1a1a1a;
    border: none;
    border-radius: 12px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 4px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.auth-btn:hover,
.submit-btn:hover,
.forgot-password-form button[type="submit"]:hover,
.reset-password-form button[type="submit"]:hover {
    opacity: 0.9;
}

.auth-btn:active,
.submit-btn:active {
    transform: translateY(1px);
}

.auth-btn:disabled,
.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Spinner de loading dentro do botão */
.auth-btn .spinner,
.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(26, 26, 26, 0.3);
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
    display: none;
}

.auth-btn.loading .spinner,
.auth-btn.loading .btn-spinner {
    display: inline-block;
}

.auth-btn.loading .btn-text {
    display: none;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* =================== FOOTER (link trocar de tela) =================== */
.auth-footer,
.back-link {
    text-align: center;
    margin-top: 22px;
    font-size: 14px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

.auth-footer a,
.back-link a {
    color: var(--text-primary, #fff);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.15s ease;
}

.auth-footer a:hover,
.back-link a:hover {
    opacity: 0.8;
}

/* =================== ALERTAS / FLASH MESSAGES =================== */
.alert,
.flash-message {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-error,
.flash-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-success,
.flash-success {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.2);
}

.alert-info,
.flash-info {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary, rgba(255, 255, 255, 0.8));
    border-color: rgba(255, 255, 255, 0.1);
}

/* =================== VALIDAÇÃO EM TEMPO REAL =================== */
.validation-message {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    margin-top: 2px;
    min-height: 16px;
}

.validation-message.error { color: #f87171; }
.validation-message.success { color: #34d399; }
.validation-message svg { width: 13px; height: 13px; flex-shrink: 0; }

/* =================== FORÇA DA SENHA (reset) =================== */
.password-strength {
    margin-top: 4px;
}

.strength-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width 0.3s ease, background 0.3s ease;
}

.strength-weak   { background: #ef4444; }
.strength-medium { background: #f59e0b; }
.strength-strong { background: #34d399; }

.strength-text {
    font-size: 12px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    margin-top: 6px;
}

.password-requirements {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.requirement {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}

.requirement.met {
    color: #34d399;
}

#passwordMatch {
    font-size: 12px;
    margin-top: 4px;
}

/* =================== MOBILE =================== */
@media (max-width: 480px) {
    .auth-card,
    .forgot-password-card,
    .reset-password-card {
        padding: 28px 22px;
        border-radius: 18px;
    }

    .auth-header h1,
    .forgot-password-header h1,
    .reset-password-header h1 {
        font-size: 20px;
    }

    .form-input,
    .auth-form input,
    .forgot-password-form input,
    .reset-password-form input {
        font-size: 16px;   /* evita zoom no iOS */
    }
}
