/* Mismo lenguaje visual que el login de HelpDesk (src/pages/Login.jsx) --
   colores, layout y logos calcados a mano en CSS plano, sin Tailwind ni
   build step (login-bunzlsa es intencionalmente una sola pagina estatica). */

* {
  box-sizing: border-box;
}

:root {
  --bg: #f9fafb;
  --card-bg: #ffffff;
  --card-border: #f3f4f6;
  --text: #111827;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --input-bg: rgba(239, 246, 255, 0.6);
  --input-border: #e5e7eb;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --dark-btn: #111827;
  --dark-btn-hover: #1f2937;
  --error-bg: #fee2e2;
  --error-border: #f87171;
  --error-text: #b91c1c;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: background-color 0.3s;
}

.login-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  margin: 1rem;
  animation: fade-in 0.4s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.logos {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}

.logo-principal {
  height: 64px;
  width: auto;
  margin-bottom: 1rem;
}

.logos-secundarios {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.logos-secundarios img {
  height: 48px;
  width: auto;
}

.titulo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.titulo h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.subtitulo {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 1.25rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background-color 0.15s;
}

.btn-microsoft {
  background: var(--dark-btn);
  color: #fff;
}

.btn-microsoft:hover {
  background: var(--dark-btn-hover);
}

.ms-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn-local {
  background: var(--blue);
  color: #fff;
  margin-top: 0.5rem;
}

.btn-local:hover {
  background: var(--blue-hover);
}

.btn-local:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.separador {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-faint);
  margin: 1.5rem 0;
  font-size: 0.75rem;
}

.separador::before,
.separador::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--input-border);
}

.separador span {
  padding: 0 0.75rem;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0.9rem 0 0.35rem;
}

input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.95rem;
  transition: box-shadow 0.15s, border-color 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 30%, transparent);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 2.5rem;
}

.toggle-password {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
}

.toggle-password:hover {
  color: var(--blue);
}

.toggle-password svg {
  width: 20px;
  height: 20px;
}

/* El atributo HTML "hidden" no se aplica de forma confiable sobre <svg>
   en todos los navegadores (no está cubierto por la regla [hidden] de la
   hoja de estilo por defecto para ese elemento) -- se usa esta clase en
   su lugar, controlada desde JS. */
.icon-oculto {
  display: none;
}

.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 0.5rem;
  animation: shake 0.4s;
}

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

.ayuda {
  text-align: center;
  margin: 1.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* Pantallas de MFA (código / activación obligatoria) -- mismo truco que
   .icon-oculto: una clase explícita, no el atributo "hidden". */
.pantalla-oculta {
  display: none;
}

.mfa-icono {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

.mfa-icono svg {
  width: 24px;
  height: 24px;
}

.mfa-icono-azul {
  background: #eff6ff;
  color: var(--blue);
}

.mfa-icono-ambar {
  background: #fffbeb;
  color: #d97706;
}

.codigo-input {
  text-align: center;
  font-size: 1.5rem;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: 0.5em;
  padding-left: 1.25rem; /* compensa el letter-spacing para centrar visualmente */
}

.btn-volver {
  background: transparent;
  color: var(--text-muted);
  margin-top: 0.5rem;
  box-shadow: none;
}

.btn-volver:hover {
  color: var(--text);
}

#mfa-setup-cargando {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1.5rem 0;
}

.qr-wrap {
  text-align: center;
  margin-bottom: 1rem;
}

.qr-wrap img {
  width: 180px;
  height: 180px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0.5rem;
  background: #fff;
}

.qr-manual {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.secreto-manual {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-weight: 600;
  color: var(--text);
}
