/* ============================================================
   Rediseño Biloop — pantallas de autenticación (login / recuperar / cambiar).
   Fiel al handoff design_handoff_biloop_ui.

   Colores del portal (INI): el layout inyecta inline
     --company-color / --company-color-secondary
   y aquí derivamos el resto. Tema claro (por defecto) y oscuro
   (:root[data-theme="dark"]) con tokens derivados de --pri según
   las tablas del handoff (mix(pri,target,amt) == color-mix).
   ============================================================ */
:root {
    --pri: var(--company-color, #172f4b);
    --sec: var(--company-color-secondary, #01b1ff);
    --pri-ring: color-mix(in srgb, var(--pri) 8%, transparent);

    /* --- Tema claro (por defecto) --- */
    --auth-bg: #f6f8fa;
    --auth-card: #ffffff;
    --auth-card-border: #e6ebf1;
    --auth-field-bg: #f8fafc;
    --auth-field-border: #dbe3ec;
    --auth-label: #48607a;
    --auth-muted: #7288a3;
    --auth-text: #243b53;
    --auth-icon: #8296ad;
    --auth-version: #a3b1c2;
    --auth-danger: #b5382c;
    --auth-title: var(--pri);
    --auth-focus: var(--pri);
    --auth-btn-bg: var(--pri);
    --auth-btn-fg: #ffffff;
}

/* --- Tema oscuro: superficies/texto gris neutro (mismos valores que suite-shell), acentos con --pri/--sec --- */
:root[data-theme="dark"] {
    --pri-ring: color-mix(in srgb, var(--sec) 22%, transparent);
    --auth-bg: #1a1b1e;
    --auth-card: #232428;
    --auth-card-border: #404246;
    --auth-field-bg: #2c2e32;
    --auth-field-border: #404246;
    --auth-label: #b9bbbf;
    --auth-muted: #9b9da1;
    --auth-text: #eef3fa;
    --auth-icon: #9b9da1;
    --auth-version: #8c8e92;
    --auth-danger: #f08a7d;
    --auth-title: #eef3fa;
    --auth-focus: var(--sec);
    /* En oscuro, el navy de marca se pierde sobre la tarjeta oscura: lo aclaramos para que el botón resalte. */
    --auth-btn-bg: color-mix(in srgb, #e6ecf5 26%, var(--pri));
}

/* Oscuro de empresa: superficies/texto teñidos con --pri (el oscuro anterior) */
:root[data-theme="dark"][data-dark-tint="brand"] {
    --auth-bg: color-mix(in srgb, #080d15 86%, var(--pri));
    --auth-card: color-mix(in srgb, #0b1220 74%, var(--pri));
    --auth-card-border: color-mix(in srgb, #e6ecf5 16%, var(--pri));
    --auth-field-bg: color-mix(in srgb, #0b1220 60%, var(--pri));
    --auth-field-border: color-mix(in srgb, #e6ecf5 16%, var(--pri));
    --auth-label: color-mix(in srgb, #e6ecf5 72%, var(--pri));
    --auth-muted: color-mix(in srgb, #e6ecf5 50%, var(--pri));
    --auth-icon: color-mix(in srgb, #e6ecf5 50%, var(--pri));
    --auth-version: color-mix(in srgb, #e6ecf5 40%, var(--pri));
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body.auth-body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Figtree', 'Source Sans 3', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--auth-text);
    background: var(--auth-bg);
    display: grid;
    place-content: center;
    position: relative;
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s ease, color .3s ease;
}

.auth-wrap { width: 22rem; max-width: calc(100vw - 2rem); }

.auth-logo { display: flex; justify-content: center; margin-bottom: 1.75rem; }
.auth-logo img { width: 150px; max-width: 70%; height: auto; }

.auth-card {
    background: var(--auth-card);
    border: 1px solid var(--auth-card-border);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(16, 32, 64, .08);
    padding: 1.75rem 1.5rem;
    transition: background-color .3s ease, border-color .3s ease;
}

.auth-title { margin: 0 0 1.25rem; font-size: 19px; font-weight: 600; color: var(--auth-title); letter-spacing: -.01em; }
.auth-subtitle { margin: .25rem 0 1.5rem; font-size: 14px; color: var(--auth-muted); }

.auth-label { display: block; font-size: 12px; font-weight: 600; color: var(--auth-label); margin-bottom: .35rem; }

.auth-field {
    display: flex;
    align-items: center;
    gap: .6rem;
    height: 42px;
    padding: 0 .75rem;
    background: var(--auth-field-bg);
    border: 1px solid var(--auth-field-border);
    border-radius: 10px;
    margin-bottom: 1rem;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .3s ease;
}
.auth-field:focus-within {
    border: 1.5px solid var(--auth-focus);
    box-shadow: 0 0 0 3px var(--pri-ring);
}
.auth-field > i { flex: 0 0 auto; font-size: 13px; color: var(--auth-icon); }
.auth-field input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: 0;
    font-family: inherit;
    font-size: 14px;
    color: var(--auth-text);
}
.auth-field input::placeholder { color: var(--auth-muted); }
/* Autocompletado del navegador: Chrome fuerza un fondo claro que rompe el campo (sobre todo en oscuro).
   Lo tapamos con un box-shadow inset del color del campo y fijamos el color de texto. */
.auth-field input:-webkit-autofill,
.auth-field input:-webkit-autofill:hover,
.auth-field input:-webkit-autofill:focus,
.auth-field input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--auth-text);
    -webkit-box-shadow: 0 0 0 1000px var(--auth-field-bg) inset;
    box-shadow: 0 0 0 1000px var(--auth-field-bg) inset;
    caret-color: var(--auth-text);
    transition: background-color 9999s ease-in-out 0s;
}
.auth-field input[type=number]::-webkit-outer-spin-button,
.auth-field input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.auth-field .toggle-eye { margin-left: auto; cursor: pointer; color: var(--auth-icon); }
.auth-field .toggle-eye:hover { color: var(--auth-focus); }

.auth-caps { display: flex; align-items: center; gap: .4rem; font-size: 12px; color: var(--auth-danger); margin: -.5rem 0 1rem; }

.auth-btn {
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: var(--auth-btn-bg);
    color: var(--auth-btn-fg);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    transition: filter .15s ease, transform .05s ease;
}
.auth-btn:hover { filter: brightness(1.12); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled { opacity: .65; cursor: default; }
.auth-btn img { width: 18px; height: 18px; }

.auth-link { display: flex; justify-content: center; margin-top: 1.25rem; }
.auth-link a { font-size: 13px; color: var(--auth-label); text-decoration: none; cursor: pointer; }
.auth-link a:hover { text-decoration: underline; }

.auth-error { color: var(--auth-danger); font-size: .8rem; font-weight: 600; margin: -.5rem 0 .75rem; display: flex; flex-direction: column; gap: .15rem; }

.auth-divider { border: 0; border-top: 1px solid var(--auth-card-border); margin: 1.25rem 0; }

/* Captcha / modo demo */
.auth-captcha { display: flex; justify-content: center; margin-bottom: 1rem; }
.auth-captcha img { max-width: 60%; border-radius: 8px; }

/* Selector de idioma (globo + desplegable) */
.lang-picker { position: relative; }
.lang-menu {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 12rem;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--auth-card);
    border: 1px solid var(--auth-card-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(16, 32, 64, .16);
    padding: .375rem;
    display: none;
    flex-direction: column;
    gap: 2px;
}
.lang-menu.open { display: flex; }
.lang-option {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .6rem;
    border: 0;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: var(--auth-text);
    text-align: left;
    transition: background-color .15s ease;
}
.lang-option:hover { background: var(--auth-field-bg); }
.lang-option img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.lang-option span { flex: 1 1 auto; }
.lang-option .fa-check { color: var(--auth-focus); font-size: 12px; }
.lang-option.is-active { font-weight: 600; }
.lang-option.is-disabled { opacity: .45; cursor: not-allowed; filter: grayscale(80%); }

/* Enlaces a apps móviles: fondo de tarjeta para que se lean sobre el fondo de pantalla del portal */
.apps-layout { display: flex; justify-content: center; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.apps-layout .app-link {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: var(--auth-muted);
    border: 1px solid var(--auth-card-border);
    background: var(--auth-card);
    box-shadow: 0 2px 8px rgba(16, 24, 40, .18);
    font-size: 15px;
    text-decoration: none;
    transition: color .2s ease, border-color .2s ease, transform .1s ease;
}
.apps-layout .app-link:hover { color: var(--auth-focus); border-color: var(--auth-focus); transform: translateY(-1px); }

/* Texto de versión */
.auth-version { position: absolute; right: 1rem; bottom: 1rem; font-size: 12px; color: var(--auth-version); font-variant-numeric: tabular-nums; text-align: right; }
.auth-version .maint { color: var(--auth-danger); font-weight: 700; }

/* Controles superiores (idioma + tema), arriba a la derecha */
.top-controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 50;
    display: flex;
    gap: .5rem;
}
.ctrl-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 1px solid var(--auth-card-border);
    background: var(--auth-card);
    color: var(--auth-label);
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 32, 64, .1);
    transition: background-color .3s ease, color .2s ease, border-color .3s ease, transform .1s ease;
}
.ctrl-btn:hover { color: var(--auth-focus); border-color: var(--auth-focus); }
.ctrl-btn:active { transform: scale(.94); }
/* Bandera circular como en el menú; el anillo separa franjas blancas del fondo en claro y oscuro */
.lang-toggle-flag { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; display: block; box-shadow: 0 0 0 1px var(--auth-card-border); }
.ctrl-btn:hover .lang-toggle-flag { box-shadow: 0 0 0 1px var(--auth-focus); }
.theme-toggle .fa-sun { display: none; }
.theme-toggle .fa-moon { display: inline; }
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun { display: inline; }

/* Wallpaper opcional del portal */
body.has-wallpaper {
    background-image: var(--auth-wallpaper, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
body.has-wallpaper .auth-card { background: color-mix(in srgb, var(--auth-card) 88%, transparent); backdrop-filter: blur(6px); }

/* Spinner global (loadingSpinner/hideLoadingSpinner alternan #loop-globals a display:block).
   Portado de COMMON-styles.css para no depender del CSS legacy. */
.loop-backdrop { display: none; position: fixed; inset: 0; z-index: 9999; background: #0009; }
.loop-inside-spinner { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; }
.loop-spinner-title { font-weight: bold; background: #fff; font-size: 10px !important; }
/* Reset del título del spinner (sin AdminLTE/Bootstrap el <h1> salía enorme y se solapaba). */
.loop-inside-spinner #blur { align-items: center; gap: .25rem; }
.loop-inside-spinner .content-spinner h1 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 700; color: #fff; }
/* Con viewBox ya no se recorta; quitamos el scale(0.7) del componente para que no quede pequeño. */
.loop-inside-spinner #loop-spinner-svg { transform: scaleY(-1) !important; }

[v-cloak] { display: none !important; }

