/* STICS: diseño del login de agentes de osTicket (mismo estilo que la pantalla de entrada del tablero).
   Se carga DESPUÉS de login.css (parche stics-login en include/staff/login.header.php). Solo cambia el aspecto:
   el formulario, la contraseña, el 2FA y el token CSRF los sigue manejando osTicket sin cambios. */
:root {
  --st-marino: #062c4a; --st-azul: #0b4f82; --st-claro: #eaf4fb; --st-foco: #7fb3dd;
  --st-tinta: #1d2733; --st-tenue: #586773; --st-fondo: #f5f7fa; --st-linea: #e3eaf1; --st-alerta: #a8461a;
}
html { overflow-y: auto; }
body#loginBody {
  min-height: 100vh; margin: 0; padding: 24px 16px 72px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--st-fondo); color: var(--st-tinta); line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body#loginBody input, body#loginBody button { font-family: inherit; color: var(--st-tinta); }
#loginBody #brickwall, #loginBody #blur, #loginBody #background { display: none; }

/* ---- tarjeta ---- */
#loginBody #loginBox {
  position: relative; left: auto; top: auto; margin: 0; width: min(100%, 27rem);
  padding: 36px 36px 28px; background: #fff; border-radius: 22px; text-align: center;
  box-shadow: 0 10px 28px rgba(6,44,74,.14), 0 2px 4px rgba(6,44,74,.06); isolation: auto;
}
#loginBody #loginBox:after { display: none; }
#loginBody #logo a { height: auto; display: block; margin: 0 auto 20px; }
#loginBody #logo a .valign-helper { display: none; }
#loginBody #logo a img { display: block; margin: 0 auto; width: 150px; max-width: 100%; max-height: none; height: auto; }
#loginBody .stics-titulo { margin: 0 0 8px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; color: var(--st-marino); }
#loginBody .stics-sub { margin: 0 0 20px; font-size: 15px; color: var(--st-tenue); }

/* ---- mensajes (error, aviso de osTicket) ---- */
#loginBody h3 { margin: 0 0 14px; font-size: 13px; font-weight: 600; color: var(--st-alerta); }
#loginBody h3:empty { display: none; }
#loginBody #login-message:not(:empty), #loginBody #loginBox > h3:not(:empty) {
  padding: 10px 12px; border-radius: 10px; background: #fbf0ea; text-align: left; line-height: 1.4;
}
#loginBody div.banner { color: var(--st-tenue); font-size: 13px; }
/* Recuperar contraseña: su mensaje es una instrucción, no un error */
#loginBody #loginBox > h3:not(#login-message):not(:empty) { background: var(--st-claro); color: var(--st-marino); font-weight: 500; }

/* ---- formulario ---- */
#loginBody form { width: 100%; margin: 0; text-align: left; }
#loginBody fieldset { margin: 0; padding: 0 !important; border: 0; display: flex; flex-direction: column; gap: 12px; }
#loginBody fieldset input, #loginBody .form-simple input[type=text], #loginBody .form-simple input[type=password] {
  display: block; width: 100%; margin: 0; height: 46px; padding: 0 14px; font-size: 16px;
  background: #fff; border: 1px solid #cdd7e1; border-radius: 12px; box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#loginBody fieldset input:focus, #loginBody .form-simple input:focus {
  border-color: var(--st-azul); box-shadow: 0 0 0 3px rgba(127,179,221,.55); outline: none;
}
#loginBody ::placeholder { color: #8a97a3; font-style: normal; }
#loginBody button[type=submit], #loginBody input[type=submit], #loginBody .button.submit {
  order: 1; float: none; display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 48px; margin: 4px 0 0; padding: 0 18px; border: 0; border-radius: 12px;
  background: var(--st-azul); color: #fff; font-size: 16px; font-weight: 600; line-height: 1;
  box-shadow: none; cursor: pointer; transition: background .15s ease, transform .1s ease-out;
}
#loginBody button[type=submit]:hover, #loginBody input[type=submit]:hover { background: var(--st-marino); color: #fff; box-shadow: none; }
#loginBody button[type=submit]:active, #loginBody input[type=submit]:active { transform: scale(.985); }
#loginBody button[type=submit]:focus-visible, #loginBody input[type=submit]:focus-visible, #loginBody a:focus-visible {
  outline: 3px solid var(--st-foco); outline-offset: 2px;
}
#loginBody button[disabled] { opacity: .7; cursor: progress; }
#loginBody fieldset h3 { order: 2; display: block !important; margin: 4px 0 0; text-align: center; font-size: 14px; font-weight: 400; }
#loginBody fieldset h3 .hidden { display: none; }
#loginBody a { color: var(--st-azul); text-decoration: none; }
#loginBody a:hover { color: var(--st-marino); text-decoration: underline; }

/* ---- código 2FA (formulario dinámico de osTicket) ---- */
#loginBody .form-simple { display: grid; gap: 6px; margin-bottom: 4px; }
#loginBody .form-simple .field-label { font-size: 14px; font-weight: 600; color: var(--st-tinta); }
#loginBody .form-simple em { font-size: 13px; font-style: normal; }
#loginBody .form-simple .error { color: var(--st-alerta); font-size: 13px; }
#loginBody .form-simple input { text-align: center; letter-spacing: .3em; font-variant-numeric: tabular-nums; }

/* ---- «Verificando» de osTicket (aparece mientras envía) ---- */
#loginBody #loading {
  position: absolute; inset: 0; z-index: 5; border-radius: 22px; background: rgba(255,255,255,.94);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
#loginBody #loading[style*="block"] { display: flex !important; }
#loginBody #loading h1 { margin: 0; font-size: 20px; font-weight: 700; color: var(--st-marino); }
#loginBody #loading h1 i { display: block; margin: 0 auto 12px; font-size: 30px; color: var(--st-azul); }

/* ---- garantías y pie ---- */
#loginBody .stics-garantias { list-style: none; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--st-linea);
  display: grid; gap: 10px; text-align: left; font-size: 13px; color: var(--st-tenue); }
#loginBody .stics-garantias li { display: flex; align-items: center; gap: 10px; }
#loginBody .stics-garantias svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: var(--st-azul);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#loginBody #company { position: static; width: auto; margin: 18px 0 0; left: auto; bottom: auto; font-size: 12px; }
#loginBody #company .content { background: none; box-shadow: none; text-shadow: none; padding: 0; color: var(--st-tenue); }
#loginBody #poweredBy { position: fixed; right: 14px; bottom: 12px; padding: 0; background: none; box-shadow: none; text-shadow: none;
  color: #9aa6b2; font-size: 11px; }
#loginBody #poweredBy .osticket-logo { width: 46px; filter: grayscale(1) opacity(.55); vertical-align: middle; }
/* Salida del paso 2FA: se ve como enlace (no como el botón principal) */
#loginBody form.stics-cancelar { margin: 14px 0 0; text-align: center; }
#loginBody form.stics-cancelar button[type=submit] { display: inline; width: auto; height: auto; margin: 0; padding: 4px 6px;
  background: none; color: var(--st-azul); font-size: 14px; font-weight: 400; border-radius: 6px; cursor: pointer; }
#loginBody form.stics-cancelar button[type=submit]:hover { background: none; color: var(--st-marino); text-decoration: underline; }
#loginBody .or hr { margin: 18px 0; border: 0; border-top: 1px solid var(--st-linea); }

@media (max-width: 480px) {
  body#loginBody { justify-content: flex-start; padding-top: 32px; }
  #loginBody #loginBox { padding: 28px 22px 22px; }
  #loginBody .stics-titulo { font-size: 23px; }
  #loginBody #poweredBy { position: static; margin-top: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #loginBody * { transition: none !important; animation: none !important; }
}
