/* Identidad Bellnova sobre el portal de login de Authelia (ADR 0007 del caso de origen).
 *
 * Esta hoja se inyecta con nginx (sub_filter) antes de </head>: Authelia no permite tema propio,
 * solo logo, favicon y textos. Reglas para que no se rompa con una actualización del portal:
 *   - Seleccionar por ID ESTABLE (#sign-in-button, #UserSvg, #reset-password-button, #remember-checkbox,
 *     #form-login) o por ESTRUCTURA (cada pantalla es <div id="...-stage"> y su primer hijo es la
 *     tarjeta). NUNCA por clases generadas (de MUI, jssN, authelia-xxxx) ni por utilidades de Tailwind
 *     (mx-auto, max-w-[444px]...): Authelia 4.39 reescribió la interfaz sin MUI y una hoja basada en
 *     esas clases dejó el login sin marca (lección de la plataforma de origen, 2026-10-21).
 *   - La CSP del portal es `default-src 'self'`: fuentes, logo y fondo tienen que ser archivos del
 *     mismo origen (/brand/...), nada de Google Fonts ni de data: URIs.
 *   - Probar cambios en vivo sin desplegar: la CSP bloquea <style> en línea, pero deja
 *     `new CSSStyleSheet()` + `document.adoptedStyleSheets`.
 *   - La CI del repo (trabajo `pila`) comprueba que el proxy inyecta esta hoja y la sirve sin caché.
 * Probado con Authelia 4.39. Tokens: kit de marca Bellnova (identidad_grafica_bellnova).
 */

@font-face { font-family: 'Poppins'; font-weight: 300; font-style: normal; font-display: swap; src: url(./fonts/poppins-300.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 400; font-style: normal; font-display: swap; src: url(./fonts/poppins-400.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-style: normal; font-display: swap; src: url(./fonts/poppins-500.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-style: normal; font-display: swap; src: url(./fonts/poppins-600.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-style: normal; font-display: swap; src: url(./fonts/poppins-700.woff2) format('woff2'); }

:root {
  --b-nova: #0C2B4A;
  --b-catalyst: #20BBB5;
  --b-leaf: #49E2D3;
  --b-lumina: #94ECE4;
  --b-line: #E1EAEF;
  --b-muted: #5C7080;
  --b-link: #0B7F7A;          /* Catalyst oscurecido: 5:1 sobre blanco (Catalyst puro da 2,3:1) */
  --b-error: #C94A3D;
}

/* ---- Fondo: Nova con resplandor Catalyst y el isotipo como marca de agua (4-5%) ---- */
html, body { min-height: 100vh; }
body {
  margin: 0;
  background-color: var(--b-nova) !important;
  background-image:
    radial-gradient(60rem 40rem at 88% -8%, rgba(32, 187, 181, .28), transparent 60%),
    radial-gradient(48rem 36rem at -8% 108%, rgba(73, 226, 211, .14), transparent 60%),
    linear-gradient(160deg, #0C2B4A 0%, #0A2440 55%, #071B30 100%) !important;
  background-repeat: no-repeat !important;
  background-position: 0 0, 0 0, 0 0 !important;
  background-size: auto, auto, auto !important;
  background-attachment: fixed !important;
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
/* Marca de agua: isotipo al 5% (regla del kit: 3,5-6%, nunca mas). */
body::before {
  content: '';
  position: fixed; z-index: 0; pointer-events: none;
  left: 6vw; bottom: -6vh; width: min(34vw, 420px); aspect-ratio: 166 / 193;
  background: url(./isotipo.svg) center / contain no-repeat;
  opacity: .05;
}
#root { position: relative; z-index: 1; }

/* ---- Logo: el ícono de usuario se sustituye por el imagotipo de color (id estable) ---- */
#UserSvg {
  display: block;
  width: 240px !important;
  height: 58px;
  margin: 0 auto 4px !important;
  background: url(./imagotipo_color_horizontal.svg) center / contain no-repeat;
}
#UserSvg > * { display: none; }

/* ---- Botón principal: Catalyst -> Leaf con texto Nova (blanco sobre Catalyst no da contraste) ---- */
#sign-in-button {
  background: linear-gradient(90deg, var(--b-catalyst), var(--b-leaf)) !important;
  color: var(--b-nova) !important;
  border: 0 !important;
  border-radius: 12px !important;
  min-height: 48px;
  font-family: inherit;
  font-weight: 600 !important;
  font-size: .9rem !important;
  letter-spacing: .06em;
  box-shadow: 0 6px 18px rgba(32, 187, 181, .32) !important;
  transition: box-shadow .15s ease, transform .15s ease, filter .15s ease;
}
#sign-in-button:hover { filter: brightness(.96); box-shadow: 0 8px 24px rgba(32, 187, 181, .45) !important; }
#sign-in-button:active { transform: translateY(1px); }
#sign-in-button:focus-visible { outline: 3px solid var(--b-nova); outline-offset: 2px; }
#sign-in-button:disabled { opacity: .55; }

/* ---- Enlace de contraseña ---- */
#reset-password-button { color: var(--b-link) !important; font-weight: 500 !important; text-transform: none !important; }
#reset-password-button:hover { background: rgba(32, 187, 181, .10) !important; }

/* ---- Tarjeta, título, campos y pie: por estructura ([id$="-stage"]) ---- */
[id$="-stage"] > div {
  position: relative;
  overflow: hidden;                       /* recorta la barra superior al radio de la tarjeta */
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(12, 43, 74, .08) !important;
  padding: 46px 40px 30px !important;
  box-shadow: 0 24px 60px rgba(3, 14, 28, .45), 0 2px 0 rgba(255, 255, 255, .06) inset;
  box-sizing: border-box;
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
[id$="-stage"] > div::before {            /* barra de acento: un borde superior se afinaba en las esquinas redondeadas */
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, var(--b-catalyst), var(--b-leaf));
}
[id$="-stage"] h5 {
  color: var(--b-nova) !important;
  font-weight: 600 !important;
  font-size: 1.3rem !important;
  letter-spacing: -.01em;
  margin-top: 16px;
  margin-bottom: 6px;
}
[id$="-stage"] h5::before {
  content: 'El Moroco · Dashboard de Dirección';
  display: block;
  margin-bottom: 10px;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--b-link);
}
/* Campos. OJO: el campo Usuario NO trae `type="text"` (solo la contrasena trae `type`), por eso se estilizan todos los inputs que no son casillas:
 * con `input[type="text"]` el usuario quedaba con otro marco que la contrasena (esquinas casi rectas, borde azul de Authelia). */
[id$="-stage"] input:not([type="checkbox"]) {
  height: 56px;
  border-radius: 12px !important;
  border: 1px solid #D5DEE6 !important;
  background-color: #F8FAFC !important;
  color: var(--b-nova);
  font-size: .98rem;
  font-family: inherit;
  padding-top: 22px;
  padding-bottom: 6px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
[id$="-stage"] input:not([type="checkbox"]):hover { border-color: #9FB5C4 !important; }
[id$="-stage"] input:not([type="checkbox"]):focus {
  border-color: var(--b-catalyst) !important;
  box-shadow: 0 0 0 4px rgba(32, 187, 181, .16) !important;
  background-color: #fff !important;
  outline: none;
}
/* El autocompletado del navegador rellena el campo sin que Authelia lo sepa, y la etiqueta quedaba encima de los puntos: se flota por CSS. */
[id$="-stage"] input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #FAFCFD inset !important;
  -webkit-text-fill-color: var(--b-nova) !important;
  transition: none !important;           /* si la sombra aparece de a poco, se ve un destello azul del autocompletado */
}
/* Etiqueta flotante cuando el navegador autocompleta. Authelia solo la flota cuando React se entera del valor (al hacer clic), y su estado de reposo es
 * `top-1/2 -translate-y-1/2 text-base`: centrada con `translate: 0 -50%`. Tailwind 4 usa la propiedad `translate`, NO `transform`: la regla anterior (solo `top` y
 * `font-size`) dejaba la etiqueta 12 px MAS ARRIBA de lo debido, montada sobre el borde del campo, hasta el primer clic. Aqui se replica EXACTAMENTE el estado
 * flotante oficial (`top-1 text-xs`: 4 px del borde, 12 px, interlineado de 16 px, sin traslado) y sin transicion, para que nazca en su sitio y no se mueva. */
[id$="-stage"] input:-webkit-autofill ~ label {
  top: .25rem;
  font-size: .75rem;
  line-height: 1rem;
  translate: none;
  transform: none;
  transition: none !important;
}
[id$="-stage"] label { font-family: inherit; color: var(--b-muted); }
/* Recordarme y el enlace de contrasena: mismo ritmo vertical que los campos (Authelia les resta margen y quedaban pegados). */
#remember-checkbox { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #B7C6D2 !important; background-color: #fff; }
#remember-checkbox[data-state="checked"] { background-color: var(--b-catalyst); border-color: var(--b-catalyst) !important; }
#remember-checkbox ~ label { font-size: .9rem; font-weight: 500; color: var(--b-muted); }
#reset-password-button { font-size: .9rem; padding-top: 10px; padding-bottom: 10px; }
#form-login div:has(> div > #remember-checkbox) { margin-top: 0; margin-bottom: 0; }
#form-login div:has(> #reset-password-button) { margin-top: -4px; margin-bottom: 0; }
[id$="-stage"] a[href*="authelia.com"] { color: #8FA3B5; }
@media (max-width: 520px) {
  [id$="-stage"] > div { padding: 34px 22px 24px !important; border-radius: 14px; }
}

@media (max-width: 520px) {
  #UserSvg { width: 200px !important; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
