/**
 * SIGSOL Login — Apple-Inspired Fluid Design (Full-Window Viewport)
 * Principios: WWDC Fluid Interfaces, SF Typography, Materials & Depth, Zero-Latency Feedback.
 * Cumple CSP estricto (sin fuentes externas ni CDNs no autorizados).
 */

:root {
  --apple-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Pro", system-ui, -apple-system-subheadline, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --apple-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Brand Palette DIESA */
  --brand-50: #eef2fb;
  --brand-100: #dbe3f6;
  --brand-200: #b9c8ec;
  --brand-300: #8fa7de;
  --brand-400: #6585cf;
  --brand-500: #4166c4;
  --brand-600: #2f4ea3;
  --brand-700: #253e83;
  --brand-800: #1c2f68;
  --brand-900: #152350;
  --brand-950: #0a1128;

  /* Neutral Apple Slates */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Apple System Accent */
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-blue-focus: rgba(0, 113, 227, 0.22);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

.page-login.modern-login {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--apple-font);
  color: var(--slate-900);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page-login.modern-login *,
.page-login.modern-login *::before,
.page-login.modern-login *::after {
  box-sizing: border-box;
}

/* —— Contenedor Full-Window (100% de la ventana sin márgenes ni cuadro flotante) —— */
.login-page {
  flex: 1;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  margin: 0;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

/* —— Shell Principal a Pantalla Completa —— */
.login-card-modern {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: #ffffff;
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  will-change: opacity;
}

@media (min-width: 1024px) {
  .login-card-modern {
    flex-direction: row;
    min-height: 100vh;
    min-height: 100dvh;
  }
}

/* —— Panel Héroe Izquierdo (58% desktop, atmósfera Pro Apple) —— */
.login-hero {
  display: none;
  position: relative;
  overflow: hidden;
  background: #080d1a;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 1024px) {
  .login-hero {
    display: flex;
    width: 58%;
    min-height: 100vh;
    min-height: 100dvh;
    border-right: 1px solid rgba(226, 232, 240, 0.12);
  }
}

.login-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.96) contrast(1.04);
  transform: scale(1.02);
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.login-hero:hover .login-hero-img {
  transform: scale(1);
}

.login-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(8, 13, 26, 0.1) 35%,
      rgba(8, 13, 26, 0.45) 65%,
      rgba(8, 13, 26, 0.92) 100%);
  pointer-events: none;
}

.login-hero-overlay-side {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      rgba(8, 13, 26, 0.45) 100%);
  pointer-events: none;
}

.login-hero-top {
  position: relative;
  z-index: 2;
  padding: 2.5rem 3rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

@media (min-width: 1200px) {
  .login-hero-top {
    padding: 3rem 3.5rem;
  }
}

.login-hero-version {
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.85);
  font-weight: 500;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.login-hero-bottom {
  position: relative;
  z-index: 2;
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 1200px) {
  .login-hero-bottom {
    padding: 3.5rem;
  }
}

.login-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #93c5fd;
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: -0.01em;
}

.login-hero-kicker svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.login-hero-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: #ffffff;
  line-height: 1.18;
}

@media (min-width: 1200px) {
  .login-hero-title {
    font-size: 2.35rem;
  }
}

.login-hero-lead {
  margin: 0;
  color: rgba(241, 245, 249, 0.85);
  font-size: 0.9375rem;
  max-width: 32rem;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

/* —— Panel de Autenticación Derecho (42% desktop, centrado) —— */
.login-auth {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  position: relative;
  overflow-y: auto;
}

@media (min-width: 640px) {
  .login-auth {
    padding: 3.5rem 3rem 2.5rem;
  }
}

@media (min-width: 1024px) {
  .login-auth {
    width: 42%;
    padding: 4rem 3.5rem 2.5rem;
  }
}

.login-auth-inner {
  width: 100%;
  max-width: 25.5rem;
  margin: auto 0;
  display: flex;
  flex-direction: column;
}

/* —— Brand Header (Icono Squircle a la izquierda del Título) —— */
.login-brand-header {
  display: flex;
  align-items: flex-start;
  gap: 1.125rem;
  margin-bottom: 2rem;
}

.login-brand-mark {
  width: 3.25rem;
  height: 3.25rem;
  flex-shrink: 0;
  border-radius: 0.9375rem;
  background: linear-gradient(145deg, #1e336e 0%, #111e47 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0.5px rgba(255, 255, 255, 0.4),
    0 6px 16px -2px rgba(17, 30, 71, 0.28);
  color: #ffffff;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 0.125rem;
}

.login-brand-mark:hover {
  transform: scale(1.02);
}

.login-brand-mark svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-suite-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--brand-200);
}

/* —— Títulos y Subtítulos con Óptica Apple —— */
.login-titles {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.login-titles h1 {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--slate-900);
  line-height: 1.15;
}

@media (min-width: 640px) {
  .login-titles h1 {
    font-size: 2rem;
  }
}

.login-titles .login-product-sub {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand-700);
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.login-titles .login-product-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--slate-500);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* —— Formulario e Inputs —— */
.login-card-form {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.login-field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--slate-700);
  margin-bottom: 0.4375rem;
}

.login-input-wrap {
  position: relative;
  width: 100%;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
}

.login-input-icon {
  pointer-events: none;
  position: absolute;
  left: 0.9375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-400);
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.login-input-icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.login-input {
  display: block;
  width: 100%;
  height: 2.875rem;
  border-radius: 0.75rem;
  border: 1px solid var(--slate-300);
  padding: 0 1rem 0 2.75rem;
  color: var(--slate-900);
  font-size: 0.9375rem;
  font-family: inherit;
  background-color: rgba(248, 250, 252, 0.75);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02) inset;
  transition:
    border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-input--toggle {
  padding-right: 3rem;
}

.login-input::placeholder {
  color: var(--slate-400);
  font-weight: 400;
}

.login-input:hover {
  background-color: #ffffff;
  border-color: var(--slate-400);
}

.login-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 3.5px var(--apple-blue-focus);
}

.login-input-wrap:focus-within .login-input-icon {
  color: var(--apple-blue);
}

/* Botón Revelar Contraseña — Centrado 100% robusto sin depender de translateY */
.login-toggle-pass {
  position: absolute;
  right: 0.625rem;
  top: 0;
  bottom: 0;
  width: 2.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-400);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  margin: 0;
  z-index: 2;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.login-toggle-pass:hover {
  color: var(--slate-700);
}

.login-toggle-pass:active {
  color: var(--slate-900);
  opacity: 0.6;
}

.login-toggle-pass svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.login-toggle-pass .is-hidden {
  display: none !important;
}

/* —— Recordar Sesión —— */
.login-remember {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.125rem;
}

.login-remember label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: default;
}

.login-remember input {
  width: 0.9375rem;
  height: 0.9375rem;
  border-radius: 0.25rem;
  border: 1px solid var(--slate-300);
  accent-color: var(--brand-700);
}

.login-remember span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--slate-500);
  letter-spacing: -0.01em;
}

/* —— Estados y Mensajes de Error (Apple Haptic Shake) —— */
.login-error.is-hidden,
.login-step.is-hidden {
  display: none !important;
}

.login-error {
  margin: 0 0 1.25rem 0;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background-color: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.login-error:not(.is-hidden) {
  animation: apple-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes apple-shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-5px);
  }

  40%,
  80% {
    transform: translateX(5px);
  }
}

/* —— Botón de Acción Principal (Kill Latency, Active State) —— */
#btn-login-modern,
#btn-2fa-modern {
  position: relative;
  width: 100%;
  height: 2.875rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.5rem;
  border: 1px solid rgba(21, 35, 80, 0.85);
  border-radius: 0.75rem;
  background: linear-gradient(180deg, #1d2f63 0%, #14224c 100%);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 4px 12px -2px rgba(20, 34, 76, 0.3);
  transition:
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.18s ease,
    box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

#btn-login-modern:hover,
#btn-2fa-modern:hover {
  background: linear-gradient(180deg, #233875 0%, #182859 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 18px -4px rgba(20, 34, 76, 0.35);
  transform: translateY(-1px);
}

#btn-login-modern:active,
#btn-2fa-modern:active {
  transform: scale(0.975);
  transition: transform 80ms cubic-bezier(0.2, 0, 0, 1);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.25),
    0 2px 4px rgba(20, 34, 76, 0.2);
}

#btn-login-modern:focus-visible,
#btn-2fa-modern:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3.5px var(--apple-blue-focus),
    0 4px 12px rgba(20, 34, 76, 0.3);
}

#btn-login-modern svg {
  width: 1.125rem;
  height: 1.125rem;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#btn-login-modern:hover svg {
  transform: translateX(3px);
}

/* Spinner de Carga Estilo iOS */
#btn-login-modern .ds-spinner,
#btn-2fa-modern .ds-spinner {
  display: none;
}

#btn-login-modern.is-loading .btn-text,
#btn-login-modern.is-loading svg,
#btn-2fa-modern.is-loading .btn-text {
  visibility: hidden;
  opacity: 0;
}

#btn-login-modern.is-loading .ds-spinner,
#btn-2fa-modern.is-loading .ds-spinner {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.125rem;
  height: 1.125rem;
  margin: -0.5625rem 0 0 -0.5625rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: apple-spinner 0.65s linear infinite;
}

@keyframes apple-spinner {
  to {
    transform: rotate(360deg);
  }
}

/* —— Flujo 2FA (Verificación en dos pasos) —— */
.login-2fa-step {
  display: flex;
  flex-direction: column;
}

.login-2fa-title {
  margin: 0 0 0.375rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--slate-900);
}

.login-2fa-message {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--slate-600);
  letter-spacing: -0.01em;
}

#login-2fa-code {
  font-family: var(--apple-mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  padding: 0.75rem 1rem;
  height: 3.25rem;
}

.login-2fa-hint {
  margin: 0.5rem 0 1.25rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--slate-500);
  letter-spacing: -0.01em;
}

.login-2fa-back {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.625rem;
  border: 0;
  background: transparent;
  color: var(--apple-blue);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.login-2fa-back:hover {
  background-color: var(--brand-50);
  color: var(--brand-800);
}

.login-2fa-back:active {
  transform: scale(0.98);
}

/* —— Footer de Seguridad —— */
.login-auth-foot {
  width: 100%;
  max-width: 25.5rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--slate-100);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
}

.login-auth-foot-row {
  display: flex;
  align-items: center;
  gap: 0.4375rem;
  color: var(--slate-400);
  font-size: 0.75rem;
}

.login-auth-foot-row svg {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--brand-600);
}

.login-auth-foot-row span {
  font-weight: 500;
  color: var(--slate-500);
  letter-spacing: -0.01em;
}

/* —— Accesibilidad: Reduced Motion y Alto Contraste —— */
@media (prefers-reduced-motion: reduce) {

  .login-card-modern,
  .login-hero-img,
  #btn-login-modern,
  #btn-2fa-modern,
  .login-error:not(.is-hidden) {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

@media (prefers-contrast: more) {
  .login-input {
    border: 2px solid #000000;
  }

  #btn-login-modern,
  #btn-2fa-modern {
    background: #000000;
    border: 2px solid #000000;
  }
}