/* ============================================================================
   NANOSPHERE — login de agente (/scp/login.php)
   ----------------------------------------------------------------------------
   Se enlaza con un <link> propio en include/staff/login.header.php, justo
   despues de scp/css/login.css.

   Esta pagina es un caso aparte: NO carga theme.css ni scp.css, asi que los
   tokens y la primitiva de campo hay que repetirlos aqui. Es la tercera copia
   del bloque :root (ver la nota en tokens.css).

   Lo que se elimina del original:
     - #brickwall / #background / #blur: la foto scp/images/login-headquarters.jpg
       servida por logo.php?backdrop, duplicada y desenfocada a 7px
     - #loginBox:after: una capa blanca al 60% que da el efecto "cristal claro"
     - el foco naranja de login.css:1-5
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal; font-weight: 200 800; font-stretch: 100%; font-display: swap;
  src: url("../fonts/bricolage-latin.woff2") format("woff2");
  unicode-range: u+00??, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+0304, u+0308, u+0329, u+2000-206f, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal; font-weight: 400 700; font-stretch: 100%; font-display: swap;
  src: url("../fonts/instrument-latin.woff2") format("woff2");
  unicode-range: u+00??, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+0304, u+0308, u+0329, u+2000-206f, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-latin.woff2") format("woff2");
  unicode-range: u+00??, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+0304, u+0308, u+0329, u+2000-206f, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd;
}

:root {
  color-scheme: dark;
  --bg: #06070b;
  --surface: #101320;
  --surface-2: #171b2b;
  --fg: #eceff7;
  --fg-muted: #99a1ba;
  --fg-subtle: #7b85a6;
  --brand: #5b7cff;
  --brand-strong: #7b95ff;
  --accent: #35e0dc;
  --accent-2: #b26bff;
  --danger: #ff6b6b;
  --border: rgb(236 239 247 / 0.08);
  --border-strong: rgb(236 239 247 / 0.16);
  --ring: rgb(91 124 255 / 0.55);
  --glass: rgb(236 239 247 / 0.035);
  --glass-border: rgb(236 239 247 / 0.1);
  --glass-shadow:
    inset 0 1px 0 rgb(236 239 247 / 0.05),
    0 24px 60px -24px rgb(0 0 0 / 0.85);
  --grad-spectrum: linear-gradient(100deg, #35e0dc 0%, #5b7cff 46%, #b26bff 100%);
  --halo-brand: radial-gradient(closest-side, rgb(91 124 255 / 0.35), transparent 70%);
  --glow-sm: 0 0 0 1px rgb(91 124 255 / 0.25), 0 8px 24px -10px rgb(91 124 255 / 0.55);
  --glow-md: 0 0 0 1px rgb(91 124 255 / 0.3), 0 18px 48px -18px rgb(91 124 255 / 0.7);
  --text-label: 0.6875rem;
  --radius-card: 1.25rem;
  --radius-md: 0.75rem;
  --radius-pill: 999px;
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

/* --- Fuera la foto de fondo y sus dos capas ------------------------------- */
#brickwall,
#blur,
#background,
#background-compat { display: none !important; }

body,
body#loginBody {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  min-height: 100%;
}
body, input { font-family: var(--font-sans); color: var(--fg); }

/* Halo de marca, mismo recurso que en el login de cliente */
body#loginBody::before {
  content: "";
  position: fixed;
  z-index: 0;
  top: -20vh;
  left: 50%;
  width: 70rem;
  height: 70rem;
  transform: translateX(-50%);
  background-image: var(--halo-brand);
  opacity: 0.5;
  pointer-events: none;
}

/* --- La tarjeta ----------------------------------------------------------- */
#loginBox {
  position: relative;
  overflow: hidden;
  z-index: 1;
  width: min(26rem, calc(100vw - 2.5rem));
  left: 50%;
  top: 12vh;
  margin-left: 0;
  transform: translateX(-50%);
  padding: 2.25rem 2rem 2rem;
  text-align: center;
  box-sizing: border-box;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  mix-blend-mode: normal;
  isolation: auto;
}

/* La capa blanca al 60% de login.css:111-123 */
#loginBox::after { display: none !important; }

/* Hairline de espectro en el borde superior */
#loginBox::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background-image: var(--grad-spectrum);
}

#logo a { display: block; text-decoration: none; height: auto; margin-bottom: 1.5rem; }
#logo a img { max-height: 40px; max-width: 240px; height: auto; width: auto; }
.valign-helper { display: none; }

h1 { margin: 0; font-family: var(--font-display); color: var(--fg); }

/* OJO: login.tpl.php usa <h3> para DOS cosas distintas — el mensaje de error
   (#login-message, linea 19) y el enlace "Forgot My Password" (linea 49, con
   style="display:inline"). Pintar todos los h3 de rojo dejaba el enlace de
   recuperacion en color de error. Solo el mensaje va en --danger. */
#login-message {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--danger);
}
#login-message:empty { margin: 0; }

h3 {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--fg-muted);
}
h3 a, #reset-link { color: var(--fg-muted); }
h3 a:hover, #reset-link:hover { color: var(--brand-strong); }

div.banner {
  color: var(--fg-muted);
  line-height: 1.45;
  font-size: 0.875rem;
}
div.banner:not(:empty) { margin-bottom: 1.25rem; }

hr { margin: 1.25rem 0; border: none; height: 0; border-bottom: 1px solid var(--border); }

/* --- Campos ---------------------------------------------------------------
   Se repite la primitiva del tema: esta hoja esta sola, no hereda de theme.css. */
form { width: 100%; margin: 0 auto; }
fieldset { border: none; margin: 0 0 1rem; padding: 0; }

fieldset input,
input[type="text"],
input[type="password"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 0.18s var(--ease-out-expo),
    box-shadow 0.18s var(--ease-out-expo);
}
input::placeholder { color: var(--fg-subtle); opacity: 1; font-style: normal; }

/* login.css:1-5 pone un foco naranja con la misma especificidad y carga antes;
   se remata con !important para no depender del orden. */
input:focus {
  border: 1px solid var(--brand) !important;
  box-shadow: 0 0 0 3px rgb(91 124 255 / 0.18) !important;
  outline: none;
}

/* --- Botones --------------------------------------------------------------
   El <fieldset> del formulario lleva el enlace de recuperacion y el boton en
   la misma linea (el boton con .pull-right). Se convierte en una fila flex:
   asi el float sobra y no hay que forzar anchos. */
#login fieldset {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
}
#login fieldset input[type="text"],
#login fieldset input[type="password"] { flex: 1 1 100%; margin-bottom: 0; }
#login fieldset .pull-right,
#login fieldset button.pull-right { float: none; margin-left: auto; }

input[type="submit"],
button[type="submit"],
.primary.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4375rem;
  width: auto;
  height: auto;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  box-shadow: var(--glow-sm);
  padding: 0.75rem 1.25rem;
  color: #fff;
  background-color: var(--brand);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition:
    background-color 0.18s var(--ease-out-expo),
    box-shadow 0.18s var(--ease-out-expo);
}
input[type="submit"]:hover,
button[type="submit"]:hover,
input[type="submit"]:active {
  color: #fff;
  background-color: var(--brand-strong);
  box-shadow: var(--glow-md);
}

input[type="reset"],
input[type="button"],
.action-button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
  line-height: 1;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  box-shadow: none;
  padding: 0.625rem 1rem;
  color: var(--fg);
  background-color: transparent;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  text-decoration: none;
}
.button:hover,
input[type="reset"]:hover,
input[type="button"]:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
  background-color: rgb(91 124 255 / 0.08);
  text-decoration: none;
}

a { color: var(--fg-muted); text-decoration: none; }
a:hover { color: var(--brand-strong); text-decoration: none; }

/* --- Autenticacion externa ------------------------------------------------ */
.external-auth { display: inline-block; margin-bottom: 0.25rem; }
.external-auth + .external-auth { margin-top: 0.25rem; }
a.external-sign-in { text-decoration: none; }
.external-auth-box {
  vertical-align: middle;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
}
.external-auth-box:hover { border-color: var(--brand); }
.external-auth-icon {
  display: inline-block;
  color: var(--fg-muted);
  width: 30px;
  padding: 0.5rem 0.625rem;
  border-right: 1px solid var(--border);
}
.external-auth-name {
  color: var(--fg);
  width: auto;
  min-width: 100px;
  padding: 0.5rem 0.875rem;
  line-height: 1.5;
  font-size: 0.875rem;
}

/* --- Pie ------------------------------------------------------------------
   El enlace a osTicket SE MANTIENE: es condicion de licencia de la edicion
   gratuita. Solo se le quita el recuadro oscuro con sombra. */
#poweredBy {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  padding: 0.375rem 0.75rem;
  text-align: center;
  position: fixed;
  bottom: 0.75rem;
  right: 0.75rem;
  box-shadow: none;
  text-shadow: none;
  border-radius: var(--radius-pill);
  background-color: transparent;
}
#poweredBy a { color: inherit; }
#poweredBy .osticket-logo {
  width: 55px;
  filter: grayscale(1) opacity(0.45);
}

/* En el original es absolute con bottom:-40px colgando de #loginBox. Se pasa a
   flujo normal: se ve igual bajo la tarjeta y deja de solaparse con #poweredBy
   cuando este se vuelve estatico en pantallas pequeñas. */
#company {
  position: static;
  left: auto;
  width: auto;
  margin: 1.25rem 0 0;
  transform: none;
  bottom: auto;
  font-size: 0.8125rem;
  color: var(--fg-subtle);
  text-align: center;
}
#company .content {
  border-radius: var(--radius-pill);
  background-color: transparent;
  box-shadow: none;
  text-shadow: none;
  display: inline-block;
  padding: 0 0.9375rem;
  color: var(--fg-subtle);
}

.hidden { display: none; }

/* El "Verifying" del login por AJAX: es un #loading.dialog dentro de la
   tarjeta (login.tpl.php:21-24). Sin esto sale sin estilo cuando aparece. */
#loading.dialog {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  color: var(--fg-muted);
}
#loading.dialog h1 {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--fg);
}

/* Separador entre el formulario y la autenticacion externa */
.or hr { margin: 1.5rem 0 1rem; }

@media (max-width: 480px) {
  #loginBox { top: 6vh; padding: 1.75rem 1.25rem 1.5rem; }
  #poweredBy { position: static; display: block; margin-top: 2rem; }
}
