/* ==========================================================================
   AUTOCORE — LOGIN "SHOWROOM NOCTURNO"
   Asfalto nocturno + carriles en perspectiva + placa de patente como firma.
   Conserva todas las clases/ids que usa login.js y el PHP multi-tenant.
   ========================================================================== */

/* ── Acento base (el PHP puede sobrescribirlo con el color del tenant) ── */
:root {
    --accent: #ffb627;
    --accent-glow: rgba(255, 182, 39, 0.18);
    --surface: #141a26;
    --asfalto: #0b0e14;
    --text-primary: #f5f7fa;
    --text-secondary: #9aa7b8;
    --text-muted: #6b7689;
    --cromo: rgba(255, 255, 255, 0.1);
}

/* ── Tema claro: reutiliza la misma clave que el dashboard (autocore-theme) ── */
body.light-theme {
    --asfalto: #eef1f6;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --cromo: rgba(0, 0, 0, 0.08);
    --accent: #b45309;
    --accent-glow: rgba(180, 83, 9, 0.15);
}

body {
    background-color: var(--asfalto);
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    overflow: hidden;
    position: relative;
}

/* ── Fondo: asfalto con carriles que se pierden en el horizonte ── */
body::before {
    content: '';
    position: fixed;
    left: -20%;
    bottom: -12%;
    width: 140%;
    height: 75vh;
    transform: perspective(700px) rotateX(58deg);
    transform-origin: center bottom;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 54px,
        rgba(255, 182, 39, 0.09) 54px,
        rgba(255, 182, 39, 0.09) 58px,
        transparent 58px,
        transparent 110px
    );
    pointer-events: none;
    z-index: 0;
}

/* Halo ámbar superior, como la luz de un anuncio de lote de autos */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(620px 360px at 50% 12%, rgba(255, 182, 39, 0.10), transparent 70%),
        radial-gradient(1000px 700px at 50% 120%, rgba(20, 26, 38, 0.9), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── Tarjeta: plástico mate con línea de acento superior ── */
.login-card {
    position: relative;
    z-index: 1;
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--cromo);
    width: 100%;
    max-width: 420px;
    padding: 2.6rem 2.4rem 2.2rem;
    box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* ── Firma: placa de patente metálica ── */
.logo-box {
    position: relative;
    width: 96px;
    height: 60px;
    background: linear-gradient(180deg, #232c3d 0%, #141a26 55%, #10141d 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: var(--accent);
    margin: 0 auto 1.4rem auto;
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.55),
        0 0 0 4px rgba(11, 14, 20, 1),
        0 0 24px var(--accent-glow);
}
.logo-box::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: 3px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 2px;
}
.logo-box img {
    max-width: 44px;
    max-height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}
.plate-screw {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #9aa7b8, #3b4657 60%, #1c232f);
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.9);
    z-index: 2;
}
.plate-screw--tl { top: 5px; left: 5px; }
.plate-screw--br { bottom: 5px; right: 5px; }

/* ── Título: Oswald condensada con espaciado de tablero ── */
.title {
    font-family: 'Oswald', 'Arial Narrow', sans-serif;
    font-weight: 600;
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}
.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    margin-bottom: 2.1rem;
}

/* ── Alertas recalibradas al fondo oscuro ── */
.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: var(--text-primary);
}

/* ── Campos: etiquetas mono + input mate ── */
.custom-input-group { position: relative; margin-bottom: 1.6rem; }

.custom-label {
    position: absolute;
    top: -10px; left: 15px;
    background-color: var(--surface);
    padding: 0 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    z-index: 10;
}

.custom-input {
    background-color: var(--asfalto) !important;
    border: 1px solid var(--cromo);
    color: var(--text-primary) !important;
    padding: 0.8rem 1rem 0.8rem 2.6rem;
    border-radius: 8px;
    width: 100%;
    font-family: 'Space Grotesk', sans-serif;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.custom-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    outline: none;
}
.custom-input::placeholder { color: #4b5565; }

.icon-left { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--text-muted); z-index: 5; }
.icon-right { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); color: var(--text-muted); cursor: pointer; z-index: 5; transition: color 0.3s; }
.icon-right:hover { color: var(--text-primary); }

/* ── Botón: ámbar de señalización con texto oscuro ── */
.btn-login {
    background: linear-gradient(135deg, #ffb627 0%, #f59e0b 100%);
    color: #1c1203;
    border: none;
    padding: 0.8rem;
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    width: 100%;
    margin-top: 0.8rem;
    box-shadow: 0 8px 22px -8px rgba(255, 182, 39, 0.55);
    transition: all 0.25s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.btn-login:hover {
    background: linear-gradient(135deg, #ffc24a 0%, #ffb627 100%);
    box-shadow: 0 10px 28px -8px rgba(255, 182, 39, 0.7);
    transform: translateY(-1px);
    color: #1c1203;
}
.btn-login:active { transform: translateY(0); }

/* ── Pie: registro de odómetro ── */
.lote-footer {
    margin-top: 2rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--cromo);
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.lote-footer .sep { color: var(--accent); margin: 0 0.5rem; }

/* ── Enlace de recuperación de contraseña (US-FAL-01) ── */
.login-link-back {
    display: block;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    text-decoration: none;
    transition: color 0.3s;
}
.login-link-back:hover {
    color: var(--accent, #ffb627);
}

/* ── Alertas de éxito en login/forgot/reset ── */
.login-alert-error {
    font-size: 0.88rem;
    padding: 0.6rem 0.8rem;
}
.login-alert-error .bi { margin-right: 0.4rem; }

/* ── Overrides para tema claro ── */
body.light-theme { background-color: var(--asfalto); }
body.light-theme::before {
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 54px,
        rgba(180, 83, 9, 0.07) 54px,
        rgba(180, 83, 9, 0.07) 58px,
        transparent 58px,
        transparent 110px
    );
}
body.light-theme::after {
    background:
        radial-gradient(620px 360px at 50% 12%, rgba(180, 83, 9, 0.08), transparent 70%),
        radial-gradient(1000px 700px at 50% 120%, rgba(238, 241, 246, 0.9), transparent 70%);
}
body.light-theme .login-card {
    background: var(--surface);
    border-color: var(--cromo);
    box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
body.light-theme .logo-box {
    background: linear-gradient(180deg, #f8fafc 0%, #eef1f6 55%, #e2e8f0 100%);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08), 0 0 0 4px rgba(255, 255, 255, 1), 0 0 24px var(--accent-glow);
}
body.light-theme .logo-box::after { opacity: 0.9; }
body.light-theme .custom-label { background-color: var(--surface); }
body.light-theme .custom-input {
    background-color: #f8fafc !important;
    border-color: rgba(0, 0, 0, 0.1);
}
body.light-theme .custom-input::placeholder { color: #94a3b8; }
body.light-theme .lote-footer { border-top-color: var(--cromo); }
body.light-theme .alert-danger {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: #7f1d1d;
}
body.light-theme .alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: #065f46;
}

/* ── Toggle de tema en pantallas de autenticación ── */
.login-theme-toggle {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--cromo);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.login-theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.login-theme-toggle .bi { font-size: 1.05rem; line-height: 1; }
.login-theme-toggle .icon-sun,
.login-theme-toggle .icon-moon { display: none; }
body:not(.light-theme) .login-theme-toggle .icon-moon { display: inline-block; }
body.light-theme .login-theme-toggle .icon-sun { display: inline-block; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.001ms !important;
    }
}
