﻿/* =========================================================
   Login — Plataforma de Proveedores (Bootstrap 5)
   El color del entorno llega en la variable --env (body[style])
   ========================================================= */

:root {
    --env: #004266;
    --env-dark: var(--env);
    --env-light: #eef2f6;
    --ink: #1c2430;
    --muted: #6b7684;
    --line: #e4e8ee;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
    :root {
        --env-light: color-mix(in srgb, var(--env) 12%, #fff);
    }
    /* Desarrollo: rojo que termina en azul marino oscuro (aprobado por el usuario).
       Producción: azul #004266 a un azul apenas más oscuro, sin mezclar colores. */
    body.env-dev  { --env-dark: color-mix(in srgb, #004266 78%, #000); }
    body.env-prod { --env-dark: color-mix(in srgb, var(--env) 90%, #000); }
}

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--ink);
    background: #fff;
    -webkit-font-smoothing: antialiased;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@media (min-width: 992px) {
    .login-wrap { flex-direction: row; }
}

/* ---------- Panel de marca (oscuro, color del entorno) ---------- */
.panel-brand {
    position: relative;
    overflow: hidden;
    color: #fff;
    background: var(--env); /* respaldo para navegadores sin color-mix() */
    background: linear-gradient(160deg, var(--env) 0%, var(--env-dark) 100%);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media (min-width: 992px) {
    .panel-brand {
        flex: 0 0 52%;
        min-height: 100vh;
        padding: 48px 56px;
    }
}

/* Formas decorativas suaves */
.panel-brand::before,
.panel-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(255,255,255,0.06);
}
.panel-brand::before { width: 520px; height: 520px; right: -180px; top: -160px; }
.panel-brand::after  { width: 380px; height: 380px; left: -140px; bottom: -160px; background: rgba(0,0,0,0.12); }

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

.brand-logo { height: 34px; width: auto; }

.brand-title {
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 14px;
    font-size: clamp(1.9rem, 3.4vw, 3.1rem);
}

.brand-subtitle {
    font-size: 1.05rem;
    max-width: 34rem;
    opacity: 0.85;
    margin: 0;
}

.brand-features {
    list-style: none;
    padding: 0;
    margin: 28px 0 0;
    display: grid;
    gap: 12px;
    max-width: 30rem;
}
.brand-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    opacity: 0.92;
}
.brand-features i {
    font-size: 1.1rem;
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    flex: 0 0 38px;
}

.brand-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-top: 32px;
}

.clock-time { font-size: 2.6rem; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.clock-date { font-size: 0.95rem; opacity: 0.8; }
.clock-date::first-letter { text-transform: uppercase; }

.env-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.35);
    white-space: nowrap;
}
@media (max-width: 575.98px) {
    .env-badge { font-size: 0.68rem; padding: 5px 10px; }
}

/* Controles de entorno (solo existen en desarrollo) */
.env-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 0 0 auto; }
.clock-date { white-space: nowrap; }
@media (max-width: 575.98px) { .clock-date { white-space: normal; } }
.btn-preview {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.75rem; font-weight: 600;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.45);
    cursor: pointer;
    transition: background .15s;
}
.btn-preview:hover { background: rgba(255,255,255,0.14); color: #fff; }
/* En la vista simulada de producción la insignia se oculta y el botón cambia de texto */
body.preview-prod .env-badge { display: none; }
body.preview-prod .btn-preview .txt-dev { display: none; }
body:not(.preview-prod) .btn-preview .txt-prod { display: none; }
.env-badge .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
    animation: pulse 1.8s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.7); }
    70%  { box-shadow: 0 0 0 8px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

/* En móvil el panel de marca se compacta */
@media (max-width: 991.98px) {
    .brand-features, .clock-time { display: none; }
    .brand-title { font-size: 1.5rem; margin-bottom: 6px; }
    .brand-subtitle { font-size: 0.9rem; }
    .brand-foot { margin-top: 18px; }
}

/* ---------- Panel del formulario (blanco) ---------- */
.panel-form {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: #fff;
}

.form-card {
    width: 100%;
    max-width: 420px;
}

.form-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.form-card .lead-text { color: var(--muted); margin-bottom: 28px; }

.form-label { font-weight: 600; font-size: 0.875rem; }

.input-group-text {
    background: #f6f8fa;
    border-color: var(--line);
    color: var(--muted);
}
.form-control {
    border-color: var(--line);
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
}
.form-control::placeholder { text-transform: none; color: #a0a8b3; }
.form-control:focus,
.form-control:focus-visible,
.btn:focus,
.btn:focus-visible,
.btn-eye:focus {
    box-shadow: none !important;
    outline: none;
}
.form-control:focus { border-color: var(--env); }

/* Sin el fondo amarillo/azul que el navegador pone al autocompletar */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    -webkit-text-fill-color: var(--ink) !important;
    caret-color: var(--ink);
    transition: background-color 5000s ease-in-out 0s;
}
input:autofill {
    box-shadow: 0 0 0 1000px #fff inset !important;
    background-color: #fff !important;
    color: var(--ink) !important;
}
.input-group:focus-within .input-group-text {
    border-color: var(--env);
    color: var(--env);
}
.btn-eye {
    border-color: var(--line);
    color: var(--muted);
    background: #fff;
}
.btn-eye:hover { color: var(--env); background: #f6f8fa; }

.val-msg { color: #dc3545; font-size: 0.8rem; padding-top: 4px; }

/* Botón principal con el color del entorno */
.btn-env {
    --bs-btn-bg: var(--env);
    --bs-btn-border-color: var(--env);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--env-dark);
    --bs-btn-hover-border-color: var(--env-dark);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--env-dark);
    --bs-btn-active-border-color: var(--env-dark);
    --bs-btn-focus-shadow-rgb: 0, 0, 0;
    --bs-btn-disabled-bg: var(--env);
    --bs-btn-disabled-border-color: var(--env);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-opacity: 1;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.8rem 1rem;
    border-radius: 10px;
}
.btn-env .spinner-border { display: none; }
.btn-env.is-loading .spinner-border { display: inline-block; }
.btn-env.is-loading .btn-text { opacity: 0.7; }

.form-help {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 22px;
}

.form-foot {
    margin-top: 40px;
    font-size: 0.78rem;
    color: #98a2b3;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.mobile-logo { height: 26px; width: auto; }

/* Alertas de mensaje (sustituyen a SweetAlert en esta página) */
#alertBox .alert {
    border-radius: 10px;
    font-size: 0.9rem;
    animation: fadeDown .25s ease-out;
}
@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Botón Ingresar en envío (sin overlay, T-023): deshabilitado, texto legible y spinner visible */
.btn-env.is-loading { pointer-events: none; cursor: progress; }
