/*
 * Estilos de las pantallas de autenticación (login, recuperar y restablecer contraseña).
 * CSS plano: el bundle de Tailwind del proyecto está precompilado y no hay pipeline de build.
 * Convención de clases: .auth-*  ·  se carga desde layouts/partials/extracss_auth.blade.php
 */

:root {
    /* Fondo */
    --auth-bg: #1f2937;
    --auth-bg-deep: #0f141b;
    --auth-bg-soft: #243040;
    --auth-glow: rgba(0, 148, 171, .22);
    --auth-grid-line: rgba(255, 255, 255, .045);

    /* Superficies claras */
    --auth-surface: #ffffff;
    --auth-field: #f9fafb;
    --auth-border: #e5e7eb;
    /* 3.13:1 sobre la tarjeta: mínimo de WCAG 1.4.11 para el límite de un control */
    --auth-border-strong: #8b929e;

    /* Texto */
    --auth-text: #111827;
    --auth-muted: #6b7280;
    --auth-on-dark: #f3f4f6;
    --auth-on-dark-muted: #9ca3af;

    /* Acciones */
    --auth-btn: #374151;
    --auth-btn-hover: #1f2937;
    --auth-btn-active: #111827;
    --auth-accent: #0094ab;
    --auth-danger: #b42318;
    --auth-danger-soft: #fef3f2;
    --auth-info-soft: #f0f9ff;
    --auth-info-border: #b9e6fe;

    --auth-radius: 16px;
    --auth-ring: 0 0 0 3px rgba(107, 114, 128, .3);
}

.auth-shell *,
.auth-shell *::before,
.auth-shell *::after {
    box-sizing: border-box;
}

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

/* El loader de Pace.js no aporta nada en estas pantallas y estorba sobre el fondo */
.auth-body .pace {
    display: none;
}

.auth-shell {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    min-height: 100vh;
    min-height: 100dvh;
    background-color: var(--auth-bg-deep);
    color: var(--auth-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ================================
   Panel de marca
   ================================ */

/* Los items de un grid no encogen por debajo de su min-content sin esto */
.auth-shell > * {
    min-width: 0;
}

.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 3.5rem;
    overflow: hidden;
    color: var(--auth-on-dark);
    background-color: var(--auth-bg);
    background-image:
        radial-gradient(58rem 42rem at 18% 8%, var(--auth-glow), transparent 62%),
        radial-gradient(46rem 34rem at 88% 94%, rgba(255, 255, 255, .06), transparent 60%),
        linear-gradient(160deg, var(--auth-bg-soft) 0%, var(--auth-bg) 46%, #161d27 100%);
}

/* Rejilla sutil sobre el degradado, sin imágenes */
.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(to right, var(--auth-grid-line) 0 1px, transparent 1px 88px),
        repeating-linear-gradient(to bottom, var(--auth-grid-line) 0 1px, transparent 1px 88px);
    -webkit-mask-image: radial-gradient(70% 70% at 30% 25%, #000 0%, transparent 78%);
    mask-image: radial-gradient(70% 70% at 30% 25%, #000 0%, transparent 78%);
    pointer-events: none;
}

.auth-brand > * {
    position: relative;
    z-index: 1;
}

.auth-brand__mark {
    display: inline-flex;
    align-items: center;
    gap: .875rem;
    text-decoration: none;
    color: inherit;
    align-self: flex-start;
}

.auth-brand__mark:hover,
.auth-brand__mark:focus {
    color: inherit;
    text-decoration: none;
}

.auth-brand__logo {
    width: 3rem;
    height: 3rem;
    object-fit: contain;
}

.auth-brand__name {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.auth-brand__claim {
    margin: 0;
    max-width: 22ch;
    font-size: clamp(1.9rem, 2.6vw, 2.75rem);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.025em;
    text-wrap: balance;
}

.auth-brand__claim em {
    font-style: normal;
    color: #4fd1e5;
}

.auth-brand__footer {
    margin: 0;
    font-size: .8125rem;
    color: var(--auth-on-dark-muted);
}

/* ================================
   Panel del formulario
   ================================ */

.auth-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1.5rem 3rem;
    background-color: var(--auth-bg-deep);
    overflow-y: auto;
}

.auth-panel__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .75rem 1.25rem;
    width: 100%;
    min-height: 3rem;
}

.auth-panel__body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: min(27rem, 100%);
    margin: auto 0;
    padding: 2rem 0;
}

.auth-panel__top-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.auth-panel__link {
    color: var(--auth-on-dark);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
}

.auth-panel__link:hover,
.auth-panel__link:focus {
    color: #ffffff;
    text-decoration: underline;
}

/* Cabecera compacta de marca, solo visible en una columna */
.auth-panel__brand {
    display: none;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: var(--auth-on-dark);
}

.auth-panel__brand img {
    width: 2.25rem;
    height: 2.25rem;
    object-fit: contain;
}

/* ================================
   Tarjeta
   ================================ */

.auth-card {
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--auth-radius);
    background-color: var(--auth-surface);
    box-shadow:
        0 1px 2px rgba(2, 6, 23, .12),
        0 12px 24px -8px rgba(2, 6, 23, .35),
        0 32px 64px -24px rgba(2, 6, 23, .45);
}

.auth-card__header {
    margin-bottom: 1.5rem;
}

.auth-title {
    margin: 0 0 .25rem;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.02em;
    color: var(--auth-text);
}

.auth-subtitle {
    margin: 0;
    font-size: .9375rem;
    line-height: 1.5;
    color: var(--auth-muted);
}

/* ================================
   Campos
   ================================ */

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

.auth-field__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .4375rem;
}

.auth-field__label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: #374151;
}

.auth-control {
    position: relative;
}

.auth-input {
    display: block;
    width: 100%;
    height: 3rem;
    padding-inline: .875rem;
    border: 1px solid var(--auth-border-strong);
    border-radius: 10px;
    background-color: var(--auth-field);
    color: var(--auth-text);
    font-size: .9375rem;
    font-weight: 500;
    line-height: 1.5;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.auth-input::placeholder {
    color: #6b7280;
    font-weight: 400;
}

.auth-input:hover {
    border-color: #6b7280;
}

.auth-input:focus {
    outline: none;
    background-color: var(--auth-surface);
    border-color: #6b7280;
    box-shadow: var(--auth-ring);
}

.auth-input--with-affix {
    padding-inline-end: 3rem;
}

.auth-input[aria-invalid="true"] {
    border-color: var(--auth-danger);
    background-color: var(--auth-danger-soft);
}

.auth-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .18);
}

.auth-affix {
    position: absolute;
    inset-block: 0;
    inset-inline-end: .25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}

.auth-affix:hover {
    color: var(--auth-text);
    background-color: rgba(17, 24, 39, .06);
}

.auth-affix svg {
    width: 1.25rem;
    height: 1.25rem;
}

.auth-error {
    display: block;
    margin-top: .4375rem;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--auth-danger);
}

.auth-hint {
    display: none;
    margin-top: .4375rem;
    font-size: .8125rem;
    color: #92400e;
}

.auth-hint.is-visible {
    display: block;
}

/* ================================
   Checkbox
   ================================ */

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: .875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
}

.auth-check input[type="checkbox"] {
    width: 1.0625rem;
    height: 1.0625rem;
    margin: 0;
    accent-color: var(--auth-btn);
    cursor: pointer;
}

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* ================================
   Botón
   ================================ */

.auth-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    min-height: 3rem;
    margin-top: .25rem;
    padding: .75rem 1rem;
    border: 1px solid var(--auth-btn);
    border-radius: 10px;
    background-color: var(--auth-btn);
    color: #ffffff;
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}

.auth-btn:hover,
.auth-btn:focus {
    background-color: var(--auth-btn-hover);
    border-color: var(--auth-btn-hover);
    color: #ffffff;
    text-decoration: none;
}

.auth-btn:active {
    background-color: var(--auth-btn-active);
    border-color: var(--auth-btn-active);
    transform: translateY(1px);
}

.auth-btn:disabled,
.auth-btn.is-loading {
    cursor: default;
    opacity: .75;
}

.auth-btn.is-loading::before {
    content: "";
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin .6s linear infinite;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================
   Enlaces, avisos y pie
   ================================ */

.auth-link {
    color: #4b5563;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
}

.auth-link:hover,
.auth-link:focus {
    color: var(--auth-text);
    text-decoration: underline;
}

.auth-card__footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--auth-border);
    text-align: center;
    font-size: .875rem;
    color: var(--auth-muted);
}

.auth-alert {
    margin-bottom: 1.25rem;
    padding: .75rem 1rem;
    border: 1px solid var(--auth-info-border);
    border-radius: 10px;
    background-color: var(--auth-info-soft);
    color: #0b4a6f;
    font-size: .875rem;
    line-height: 1.5;
}

.auth-alert--danger {
    border-color: #fecdca;
    background-color: var(--auth-danger-soft);
    color: #912018;
}

/* ================================
   Selector de idioma (partial language_btn)
   ================================ */

.auth-lang summary {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .4375rem .875rem;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    color: var(--auth-on-dark);
    font-size: .875rem;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.auth-lang summary::-webkit-details-marker {
    display: none;
}

.auth-lang summary:hover {
    background-color: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .38);
}

.auth-lang details {
    position: relative;
}

/* El desplegable se alinea al borde del panel; si no, se sale de la pantalla */
.auth-lang ul {
    position: absolute;
    inset-inline-end: 0;
    inset-inline-start: auto;
    max-width: calc(100vw - 2rem);
    max-height: 18rem;
    overflow-y: auto;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px -8px rgba(2, 6, 23, .45);
}

.auth-lang ul a {
    cursor: pointer;
    font-size: .875rem;
}

/* ================================
   Bloque de demos (solo con APP_ENV=demo)
   ================================ */

.auth-demo {
    width: 100%;
    max-width: 27rem;
    margin: 0 auto 1.5rem;
}

/* ================================
   Foco visible y accesibilidad
   ================================ */

.auth-shell a:focus-visible,
.auth-shell button:focus-visible,
.auth-shell summary:focus-visible,
.auth-shell input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {

    .auth-shell *,
    .auth-shell *::before,
    .auth-shell *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ================================
   Responsive
   ================================ */

@media (max-width: 991px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        background-color: var(--auth-bg);
        background-image:
            radial-gradient(40rem 30rem at 50% -10%, var(--auth-glow), transparent 60%),
            linear-gradient(180deg, var(--auth-bg-soft) 0%, var(--auth-bg-deep) 70%);
    }

    .auth-panel__top {
        justify-content: space-between;
    }

    .auth-panel__brand {
        display: inline-flex;
    }
}

@media (max-width: 575px) {
    .auth-panel {
        padding-inline: 1rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .auth-title {
        font-size: 1.375rem;
    }
}
