/* ==========================================================================
   WJFlow — Telas de acesso (_AuthLayout)
   ========================================================================== */

body.auth-body { background: var(--bg); }

.auth-shell {
    display: grid;
    grid-template-columns: minmax(380px, 5fr) 7fr;
    min-height: 100vh;
}

/* ── Painel da marca (estático) ───────────────────────────────────────── */
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
    padding: 40px 48px;
    overflow: hidden;
    color: var(--sb-text);
    background:
        radial-gradient(ellipse 80% 60% at 0% 0%, rgba(91, 108, 255, .22) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 100% 100%, rgba(138, 116, 249, .14) 0%, transparent 60%),
        var(--sb-bg);
    border-right: 1px solid var(--sb-border);
}
.auth-brand::after {
    /* grade sutil */
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
    background-size: 40px 40px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
    mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
    pointer-events: none;
}
.auth-brand > * { position: relative; z-index: 1; }

.auth-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--sb-text-strong); font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.auth-logo:hover { color: #fff; }
.auth-logo .brand-mark { width: 32px; height: 32px; font-size: 14px; }

.auth-pitch { max-width: 420px; }
.auth-headline { margin: 0 0 12px; font-size: 30px; font-weight: 600; line-height: 1.2; letter-spacing: -.025em; color: #fff; }
.auth-lead { margin: 0; font-size: 15px; line-height: 1.6; color: var(--sb-text); }

.auth-features { list-style: none; margin: 32px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.auth-features li { display: flex; align-items: flex-start; gap: 12px; font-size: var(--fs-sm); line-height: 1.5; }
.auth-features strong { display: block; color: var(--sb-text-strong); font-weight: 500; }
.auth-features span { color: var(--sb-muted); }
.auth-feature-icon {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--sb-border);
    border-radius: var(--r-md);
    background: rgba(255, 255, 255, .03);
    color: #8E99FF;
    font-size: 13px;
}

.auth-brand-foot { font-size: var(--fs-xs); color: var(--sb-muted); }

/* ── Formulário ───────────────────────────────────────────────────────── */
.auth-main {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}
.auth-topright { position: absolute; top: 16px; right: 16px; }
.auth-main-inner { width: 100%; max-width: 400px; }
.auth-mobile-logo { display: none; margin-bottom: 28px; color: var(--text); }
.auth-mobile-logo:hover { color: var(--text); }

.auth-card {
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
}

.auth-card-icon {
    width: 44px; height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface-2);
    color: var(--brand-600);
    font-size: 16px;
    box-shadow: var(--shadow-xs);
}
.auth-card-icon.is-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-fg); }
.auth-card-icon.is-danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger-fg); }

.auth-title { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; color: var(--text); }
.auth-sub { margin: 0 0 24px; font-size: var(--fs-base); line-height: 1.55; color: var(--text-2); }
.auth-sub strong { color: var(--text); font-weight: 500; }

.auth-field { margin-bottom: 16px; }
.auth-label-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.auth-label { display: block; margin: 0 0 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.auth-label-row .auth-label { margin: 0; }
.auth-label-row a { font-size: var(--fs-sm); font-weight: 500; }

.auth-input-wrap { position: relative; }
.auth-input-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 13px;
    pointer-events: none;
    transition: color var(--dur) var(--ease);
}
.auth-input-wrap:focus-within .auth-input-icon { color: var(--brand-600); }

.auth-input {
    display: block;
    width: 100%;
    height: 40px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--input-bg);
    color: var(--text);
    font-family: inherit;
    font-size: var(--fs-base);
    box-shadow: var(--shadow-xs);
    outline: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.auth-input.has-eye { padding-right: 42px; }
.auth-input::placeholder { color: var(--text-3); }
.auth-input:hover { border-color: var(--text-3); }
.auth-input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--ring); }
.auth-input.input-validation-error { border-color: var(--danger-dot); }
.auth-input.input-validation-error:focus { box-shadow: 0 0 0 3px rgba(240, 68, 56, .25); }

.auth-eye {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
    width: 32px; height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-3);
    font-size: 13px;
    cursor: pointer;
    transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.auth-eye:hover { color: var(--text); background: var(--surface-2); }
.auth-eye:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

.auth-error { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--danger-fg); }
.auth-error:empty { display: none; }
.auth-hint { margin-top: 6px; font-size: var(--fs-xs); line-height: 1.5; color: var(--text-3); }

.auth-summary { margin-bottom: 16px; }
.auth-summary.validation-summary-valid { display: none; }
.auth-summary ul { margin: 0; padding: 10px 12px 10px 28px; border: 1px solid var(--danger-border); border-radius: var(--r-md); background: var(--danger-bg); color: var(--danger-fg); font-size: var(--fs-sm); }

.auth-inline-alert {
    display: none;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid var(--danger-border);
    border-radius: var(--r-md);
    background: var(--danger-bg);
    color: var(--danger-fg);
    font-size: var(--fs-sm);
}
.auth-inline-alert.show { display: flex; }
.auth-inline-alert i { margin-top: 3px; }

.auth-check { display: flex; align-items: center; gap: 8px; margin: 4px 0 20px; }
.auth-check input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand-600); cursor: pointer; }
.auth-check label { margin: 0; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; user-select: none; }

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--brand-600);
    border-radius: var(--r-md);
    background: var(--brand-600);
    color: #fff;
    font-family: inherit;
    font-size: var(--fs-base);
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .12);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.auth-btn i { font-size: 13px; }
.auth-btn:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
[data-theme="dark"] .auth-btn:hover { background: var(--brand-500); border-color: var(--brand-500); }
.auth-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.auth-btn:disabled { opacity: .7; cursor: not-allowed; }

.auth-btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-xs); }
.auth-btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
[data-theme="dark"] .auth-btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }

.auth-foot { margin-top: 20px; text-align: center; font-size: var(--fs-sm); color: var(--text-2); }
.auth-foot a { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.auth-foot a i { font-size: 11px; }

.auth-legal { margin-top: 24px; text-align: center; font-size: var(--fs-xs); color: var(--text-3); }

/* Força da senha */
.strength-bar { display: flex; gap: 4px; margin-top: 8px; }
.strength-seg { flex: 1; height: 4px; border-radius: var(--r-full); background: var(--surface-3); transition: background var(--dur) var(--ease); }
.strength-label { min-height: 16px; margin-top: 4px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }

.spinner-sm {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wj-spin .7s linear infinite;
}
@keyframes wj-spin { to { transform: rotate(360deg); } }
/* Indicador de carregamento é informação, não decoração: mantém mesmo com reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .spinner-sm { animation-duration: .9s !important; animation-iteration-count: infinite !important; }
    .auth-card.is-loading::before { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
}
.auth-btn[aria-busy="true"] { opacity: 1; cursor: progress; }

/* Barra de progresso no topo do card durante o envio */
.auth-card { position: relative; }
.auth-card.is-loading { overflow: hidden; }
.auth-card.is-loading::before {
    content: "";
    position: absolute; top: 0; left: 0;
    height: 2px; width: 40%;
    background: var(--brand-500);
    animation: wj-progress 1.2s var(--ease, ease) infinite;
}
@keyframes wj-progress { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.auth-card.is-loading .auth-input,
.auth-card.is-loading .auth-eye { pointer-events: none; opacity: .7; }

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.shake { animation: shakeX .4s ease; }

/* ── Responsivo ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-mobile-logo { display: inline-flex; }
    .auth-main { justify-content: flex-start; padding-top: 64px; }
}
@media (max-width: 480px) {
    .auth-card { padding: 24px 20px; }
}
