/* =================================================================================
 * PÁGINAS DE CUENTA: login, registro (4 pasos), recuperar/restablecer contraseña,
 * verificación de correo y cierre de sesión.
 * Usa los tokens de /css/global/tokens.css: toma el color de la línea (Grande de Leim).
 * ================================================================================= */

.auth-page {
    position: relative;
    min-height: calc(100vh - 160px);
    min-height: calc(100dvh - 160px);
    display: flex;
    align-items: center;
    padding: clamp(1.5rem, 4vw, 3.5rem) 0;
    background:
        radial-gradient(circle at 12% 18%, var(--brand-tint-strong) 0, transparent 38%),
        radial-gradient(circle at 88% 82%, var(--brand-tint) 0, transparent 42%),
        linear-gradient(180deg, #f7f9fc 0%, var(--brand-tint) 100%);
}

/* --- Tarjeta --- */
.auth-card {
    width: 100%;
    max-width: 460px;
    margin-inline: auto;
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: 20px;
    box-shadow: 0 24px 60px -24px rgba(var(--brand-primary-rgb), .35), var(--shadow-sm);
    overflow: hidden;
}

.auth-card--wide { max-width: 820px; }

.auth-card__body {
    padding: clamp(1.5rem, 4vw, 2.75rem);
}

/* Tarjeta dividida: panel de marca a la izquierda (solo escritorio) y formulario a la derecha. */
.auth-card--split { max-width: 980px; }

@media (min-width: 992px) {
    .auth-card--split {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

.auth-aside {
    display: none;
    position: relative;
    color: var(--brand-on-primary);
    padding: 2.75rem;
    background:
        linear-gradient(160deg, rgba(var(--brand-primary-rgb), .92) 0%, rgba(var(--brand-primary-rgb), .72) 100%),
        url('/img/home/background.jpg') center / cover no-repeat;
}

@media (min-width: 992px) {
    .auth-aside {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        gap: 1rem;
    }
}

.auth-aside__title {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: var(--brand-on-primary);
}

.auth-aside__text {
    margin: 0;
    color: rgba(255, 255, 255, .85);
}

.auth-aside__list {
    list-style: none;
    padding: 0;
    margin: .5rem 0 0;
    display: grid;
    gap: .6rem;
}

.auth-aside__list li {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    color: rgba(255, 255, 255, .92);
}

.auth-aside__list i {
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .16);
    font-size: .85rem;
}

/* --- Encabezado de la tarjeta --- */
.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-logo {
    width: 120px;
    height: auto;
    margin-bottom: 1.25rem;
}

.auth-eyebrow {
    display: inline-block;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--brand-primary);
    background: var(--brand-tint);
    border-radius: var(--radius-pill);
    padding: .3rem .8rem;
    margin-bottom: .75rem;
}

.auth-title {
    font-size: clamp(1.4rem, 2.4vw, 1.75rem);
    font-weight: 700;
    color: var(--brand-text);
    margin: 0 0 .4rem;
    line-height: var(--lh-tight);
}

.auth-subtitle {
    color: var(--brand-muted);
    margin: 0;
    font-size: var(--fs-sm);
}

/* --- Campos --- */
/* Bootstrap redondea las esquinas de los grupos con esta variable (respeta has-validation). */
.auth-form { --bs-border-radius: 12px; }

.auth-form .form-label {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--brand-text);
    margin-bottom: .35rem;
}

.auth-form .form-control,
.auth-form .form-select {
    min-height: 48px;
    border-color: var(--brand-border);
    background-color: #fbfcfe;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.auth-form textarea.form-control { min-height: 88px; }

.auth-form .form-control:focus,
.auth-form .form-select:focus {
    background-color: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--brand-focus);
}

.auth-form .form-control::placeholder { color: #9aa3b2; }

.auth-field { margin-bottom: 1.1rem; }

/* Campo con ícono a la izquierda y, opcionalmente, botón para ver la contraseña a la derecha. */
.auth-input > .input-group-text {
    min-width: 48px;
    justify-content: center;
    background: var(--brand-tint);
    color: var(--brand-primary);
    border-color: var(--brand-border);
}

.btn-password {
    --bs-btn-border-radius: 12px; /* base.css redondea los botones como píldora */
    min-width: 48px;
    border: 1px solid var(--brand-border);
    background: #fbfcfe;
    color: var(--brand-muted);
}

.btn-password:hover,
.btn-password[aria-pressed="true"] {
    color: var(--brand-primary);
    background: var(--brand-tint);
}

.btn-password:focus-visible {
    outline: 3px solid var(--brand-focus);
    outline-offset: 2px;
    z-index: 5;
}

.auth-input:focus-within > .input-group-text,
.auth-input:focus-within > .btn-password {
    border-color: var(--brand-primary);
}

.auth-hint {
    font-size: var(--fs-xs);
    color: var(--brand-muted);
    margin-top: .4rem;
}

/* --- Acciones --- */
.auth-submit {
    width: 100%;
    min-height: 50px;
    font-weight: 600;
    letter-spacing: .01em;
    margin-top: .5rem;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem 1.25rem;
    margin-top: 1.25rem;
    font-size: var(--fs-sm);
}

.auth-links a {
    color: var(--brand-muted);
    text-decoration: none;
}

.auth-links a:hover,
.auth-links a:focus-visible {
    color: var(--brand-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-alt {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--brand-border);
    text-align: center;
    font-size: var(--fs-sm);
    color: var(--brand-muted);
}

.auth-alt a {
    font-weight: 600;
    color: var(--brand-primary);
}

.auth-recaptcha {
    display: flex;
    justify-content: center;
    margin: 1.25rem 0 .25rem;
    min-height: 78px;
}

/* --- Indicador de pasos del registro --- */
.auth-steps {
    list-style: none;
    display: flex;
    padding: 0;
    margin: 0 0 2rem;
    counter-reset: paso;
}

.auth-step {
    position: relative;
    flex: 1;
    text-align: center;
    font-size: var(--fs-xs);
    color: var(--brand-muted);
}

/* Línea que une los pasos. */
.auth-step:not(:first-child)::after {
    content: '';
    position: absolute;
    top: 17px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--brand-border);
    z-index: 0;
}

.auth-step.is-done:not(:first-child)::after,
.auth-step.is-current:not(:first-child)::after {
    background: var(--brand-primary);
}

.auth-step__dot {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--brand-border);
    background: var(--brand-surface);
    font-weight: 700;
    font-size: .95rem;
    color: var(--brand-muted);
    margin-bottom: .4rem;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

.auth-step.is-done .auth-step__dot {
    background: var(--brand-tint-strong);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.auth-step.is-current .auth-step__dot {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: var(--brand-on-primary);
    box-shadow: 0 0 0 5px var(--brand-focus);
}

.auth-step.is-current { color: var(--brand-text); font-weight: 600; }

.auth-step__label { display: block; }

@media (max-width: 420px) {
    .auth-step__label { font-size: .68rem; }
}

/* --- Secciones del formulario de dirección --- */
.auth-fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 1.5rem;
}

.auth-fieldset legend {
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding-bottom: .5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--brand-border);
    width: 100%;
    float: none;
}

/* intl-tel-input ocupa todo el ancho de la columna. */
.auth-form .iti { width: 100%; }

/* --- Comprobante profesional --- */
.auth-info {
    display: flex;
    gap: .9rem;
    align-items: flex-start;
    background: var(--brand-tint);
    border-radius: 14px;
    padding: 1rem 1.15rem;
    margin-bottom: 1.5rem;
    font-size: var(--fs-sm);
    color: var(--brand-text);
}

.auth-info > i {
    font-size: 1.4rem;
    color: var(--brand-primary);
    line-height: 1;
}

.auth-info p { margin: 0 0 .35rem; }
.auth-info p:last-child { margin-bottom: 0; }

.auth-file .form-control {
    border-style: dashed;
    border-width: 2px;
    padding: .85rem;
    min-height: 56px;
}

.auth-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .6rem;
    margin-bottom: .5rem;
}

.auth-choice {
    margin: 0;
    padding: 0;
}

.auth-choice .form-check-input { position: absolute; opacity: 0; pointer-events: none; }

.auth-choice .form-check-label {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    min-height: 52px;
    padding: .7rem .9rem;
    border: 1.5px solid var(--brand-border);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: var(--fs-sm);
    color: var(--brand-text);
    background: #fbfcfe;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-choice .form-check-label::before {
    content: '';
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--brand-border);
    background: #fff;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-choice .form-check-label:hover { border-color: var(--brand-primary); }

.auth-choice .form-check-input:checked + .form-check-label {
    border-color: var(--brand-primary);
    background: var(--brand-tint);
    color: var(--brand-primary);
}

.auth-choice .form-check-input:checked + .form-check-label::before {
    border-color: var(--brand-primary);
    box-shadow: inset 0 0 0 4px #fff;
    background: var(--brand-primary);
}

.auth-choice .form-check-input:focus-visible + .form-check-label {
    box-shadow: 0 0 0 4px var(--brand-focus);
}

.was-validated .auth-choice .form-check-input:invalid + .form-check-label {
    border-color: var(--bs-form-invalid-border-color, #dc3545);
}

.auth-choices-feedback {
    display: none;
    font-size: .875em;
    color: var(--bs-form-invalid-color, #dc3545);
    margin-bottom: .75rem;
}

.was-validated .auth-choices:has(.form-check-input:invalid) + .auth-choices-feedback { display: block; }

.auth-skip {
    color: var(--brand-muted);
    font-size: var(--fs-sm);
}

/* --- Resumen del paso 4 --- */
.auth-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 0 0 1.5rem;
    border: 1px solid var(--brand-border);
    border-radius: 14px;
    overflow: hidden;
}

.auth-summary__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .15rem;
    padding: .85rem 1.1rem;
}

.auth-summary__row:nth-child(odd) { background: #fbfcfe; }
.auth-summary__row + .auth-summary__row { border-top: 1px solid var(--brand-border); }

@media (min-width: 576px) {
    .auth-summary__row { grid-template-columns: 200px minmax(0, 1fr); gap: 1rem; }
}

.auth-summary dt {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--brand-muted);
}

.auth-summary dd {
    margin: 0;
    color: var(--brand-text);
    overflow-wrap: anywhere;
}

.auth-summary dd p { margin: 0; }

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .75rem;
}

.auth-actions > * { flex: 1 1 180px; }
.auth-actions .btn { width: 100%; min-height: 50px; font-weight: 600; }

/* --- Estado (verificación completa, contraseña restablecida, cerrar sesión) --- */
.auth-status-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1rem;
    background: var(--brand-tint);
    color: var(--brand-primary);
}

.auth-status-icon--ok { background: #e7f6ee; color: #198754; }
.auth-status-icon--warn { background: #fff4e5; color: #b45309; }
.auth-status-icon--error { background: #fdecee; color: #b42318; }

.auth-code {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--brand-muted);
    background: #f3f5f9;
    border-radius: 8px;
    padding: .25rem .6rem;
    margin-top: .75rem;
}

@media (prefers-reduced-motion: reduce) {
    .auth-step__dot,
    .auth-choice .form-check-label,
    .auth-form .form-control,
    .auth-form .form-select { transition: none; }
}

/* Botón principal alineado a la derecha en formularios anchos (ancho completo en móvil). */
.auth-form-footer {
    display: flex;
    justify-content: flex-end;
}

@media (min-width: 768px) {
    .auth-form-footer .auth-submit { max-width: 320px; }
}
