/* ============================================================
   LEONIX ERP — Split-Screen Login (2026 Redesign)
   ============================================================ */

/* Reset del fondo anterior para la pantalla de login */
#login-screen {
  background: none !important;
  display: flex !important;
  flex-direction: row !important;
  min-height: 100vh !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  position: fixed !important;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 999;
  perspective: none !important;
  align-items: stretch !important;
  padding: 0 !important;
  justify-content: flex-start !important;
}

/* Ocultar elementos del fondo antiguo */
#login-screen .background-orb,
#login-screen .orbital-ring,
#login-screen .cyber-grid,
#login-screen .cyber-particles {
  display: none !important;
}

#login-screen.hidden {
  display: none !important;
}

/* ============================================================
   PANEL IZQUIERDO — Azul
   ============================================================ */
.ls-left {
  width: 50%;
  background: linear-gradient(135deg, #3b5bfc 0%, #2248f0 40%, #1a3de0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Círculo decorativo de fondo */
.ls-left::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  bottom: -200px;
  left: -100px;
  pointer-events: none;
}
.ls-left::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  top: -100px;
  right: -80px;
  pointer-events: none;
}

.ls-logo-wrap {
  margin-bottom: 20px;
}
.ls-logo {
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.25));
}

.ls-brand {
  text-align: center;
  margin-bottom: 32px;
}
.ls-brand-name {
  font-family: 'Inter', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 2px;
  margin: 0 0 4px 0;
}
.ls-brand-sub {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 0;
}

.ls-tagline {
  text-align: center;
  max-width: 320px;
  margin-bottom: 40px;
}
.ls-tagline-title {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 10px 0;
  line-height: 1.4;
}
.ls-tagline-desc {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  line-height: 1.7;
  margin: 0;
}

.ls-features {
  display: flex;
  gap: 28px;
  justify-content: center;
}
.ls-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.ls-feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  backdrop-filter: blur(4px);
}
.ls-feature-label {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.3;
}

/* ============================================================
   PANEL DERECHO — Blanco
   ============================================================ */
.ls-right {
  width: 50%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  flex-shrink: 0;
  position: relative;
}

.ls-form-wrap {
  width: 100%;
  max-width: 360px;
}

.ls-welcome {
  text-align: center;
  margin-bottom: 28px;
}
.ls-welcome-title {
  font-family: 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 6px 0;
}
.ls-welcome-emoji {
  font-size: 22px;
  display: block;
  margin-bottom: 8px;
}
.ls-welcome-sub {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

/* Campos del formulario */
.ls-field {
  margin-bottom: 16px;
}
.ls-label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.ls-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.ls-input-icon {
  position: absolute;
  left: 14px;
  color: #9ca3af;
  font-size: 14px;
  pointer-events: none;
}
.ls-input {
  width: 100%;
  box-sizing: border-box;
  height: 46px;
  padding: 0 14px 0 40px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #111827;
  background: #f9fafb;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.ls-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.ls-input-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
  font-size: 14px;
  transition: color 0.2s;
}
.ls-input-toggle:hover { color: #2563eb; }

/* Row: remember + forgot */
.ls-form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.ls-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.ls-remember input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
}
.ls-remember-label {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #6b7280;
}
.ls-forgot {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}
.ls-forgot:hover { text-decoration: underline; }

/* Botón principal */
.ls-btn {
  width: 100%;
  height: 48px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  position: relative;
  overflow: hidden;
}
.ls-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}
.ls-btn:active {
  transform: translateY(0);
}
.ls-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}
.ls-btn-arrow {
  font-size: 16px;
  transition: transform 0.2s;
}
.ls-btn:hover .ls-btn-arrow {
  transform: translateX(4px);
}
.ls-btn .spinner {
  width: 20px;
  height: 20px;
}

/* Tenant display */
.ls-tenant-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 20px;
}
.ls-tenant-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ls-tenant-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-size: 14px;
}
.ls-tenant-text small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ls-tenant-text span {
  font-size: 14px;
  font-weight: 600;
  color: #1e40af;
}
.ls-tenant-change {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.ls-tenant-change:hover {
  background: #e0e7ff;
  color: #2563eb;
}

/* ============================================================
   ANIMACIÓN DE LOGIN EXITOSO — "Puertas que se abren"
   ============================================================ */
@keyframes slideOutLeft {
  0%   { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-105%); opacity: 0; }
}
@keyframes slideOutRight {
  0%   { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(105%); opacity: 0; }
}

#login-screen.login-success-anim {
  pointer-events: none !important;
  background: transparent !important;
}
#login-screen.login-success-anim .ls-left {
  animation: slideOutLeft 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
#login-screen.login-success-anim .ls-right {
  animation: slideOutRight 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ============================================================
   RESPONSIVE — 50/50 STRICT EQUAL PROPORTION SYSTEM
   ============================================================ */

/* TODAS LAS PANTALLAS EN HORIZONTAL (PC, Laptop, Tablet, Móvil Horizontal) */
@media (min-width: 769px), (orientation: landscape) {
  #login-screen {
    flex-direction: row !important;
    align-items: stretch !important;
  }

  .ls-left {
    width: 50% !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 2.5rem 2rem !important;
    display: flex !important;
  }

  .ls-right {
    width: 50% !important;
    flex: 0 0 50% !important;
    max-width: 50% !important;
    padding: 2.5rem 2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .ls-logo {
    width: 72px !important;
    height: 72px !important;
  }

  .ls-brand-name {
    font-size: 24px !important;
  }

  .ls-tagline {
    max-width: 320px !important;
    margin-bottom: 24px !important;
  }

  .ls-tagline-title {
    font-size: 15px !important;
    margin-bottom: 6px !important;
  }

  .ls-tagline-desc {
    font-size: 12px !important;
    line-height: 1.5 !important;
    display: block !important;
  }

  .ls-features {
    display: flex !important;
    gap: 16px !important;
  }

  .ls-feature-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 15px !important;
  }

  .ls-feature-label {
    font-size: 8.5px !important;
  }
}

/* MÓVIL (<= 768px): Header de marca compacto + Formulario fluido con scroll natural */
@media (max-width: 768px) {
  #login-screen {
    flex-direction: column !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    background: #f8fafc !important;
    z-index: 999999 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }

  .dark #login-screen {
    background: #0f172a !important;
  }

  /* Header de Marca Compacto y Elegante (~120px) */
  .ls-left {
    display: flex !important;
    width: 100% !important;
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    padding: 1.5rem 1.25rem 1.25rem 1.25rem !important;
    background: linear-gradient(135deg, #3b5bfc 0%, #2248f0 45%, #1a3de0 100%) !important;
    border-radius: 0 0 1.75rem 1.75rem !important;
    box-shadow: 0 10px 25px rgba(34, 72, 240, 0.22) !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .ls-logo-wrap {
    margin-bottom: 6px !important;
  }

  .ls-logo {
    width: 44px !important;
    height: 44px !important;
  }

  .ls-brand {
    margin-bottom: 0 !important;
  }

  .ls-brand-name {
    font-size: 1.2rem !important;
    letter-spacing: 1.5px !important;
    margin-bottom: 2px !important;
    color: #ffffff !important;
  }

  .ls-brand-sub {
    font-size: 8.5px !important;
    letter-spacing: 2px !important;
    opacity: 0.85 !important;
    color: rgba(255, 255, 255, 0.85) !important;
  }

  /* Ocultar párrafos de marketing y características en celulares para dar prioridad al formulario */
  .ls-tagline,
  .ls-features {
    display: none !important;
  }

  /* Formulario Blanco Fluido (Scroll Nativo, No Cortado) */
  .ls-right {
    width: 100% !important;
    flex: 1 0 auto !important;
    height: auto !important;
    max-height: none !important;
    padding: 1.5rem 1.25rem 3rem 1.25rem !important;
    background: transparent !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .ls-form-wrap {
    width: 100% !important;
    max-width: 380px !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
  }

  .ls-welcome {
    text-align: center !important;
    margin-bottom: 1.25rem !important;
  }

  .ls-welcome::before {
    display: none !important;
  }

  .ls-welcome-title {
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    letter-spacing: -0.02em !important;
  }

  .dark .ls-welcome-title {
    color: #f8fafc !important;
  }

  .ls-welcome-sub {
    font-size: 0.82rem !important;
    color: #64748b !important;
    margin-top: 0.25rem !important;
  }

  .dark .ls-welcome-sub {
    color: #94a3b8 !important;
  }

  .ls-field {
    margin-bottom: 1rem !important;
  }

  .ls-input {
    min-height: 48px !important;
    font-size: 16px !important; /* Previene auto-zoom en iOS Safari */
    border-radius: 0.85rem !important;
    box-sizing: border-box !important;
  }

  .ls-btn {
    min-height: 48px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    border-radius: 0.85rem !important;
    margin-top: 0.75rem !important;
    touch-action: manipulation;
    cursor: pointer !important;
  }

  .ls-remember, .ls-forgot {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 0.82rem !important;
  }
}

/* Ocultar botón del editor de diseño en pantallas no-escritorio */
@media (max-width: 1023px) {
  #beta-design-editor-btn,
  #beta-inspector-overlay,
  #beta-inspector-badge,
  #beta-editor-drawer {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* =====================================================================
   SELECTORES GLOBALES DE ALTA PRIORIDAD (HUB MULTI-TENANT & MULTI-SUCURSAL)
   Garantiza visibilidad impecable sobre #login-screen en Móviles (Vertical/Horizontal) y Desktop
   ===================================================================== */
#company-selector-backdrop,
#branch-selector-backdrop {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  zoom: 1 !important;
  z-index: 99999999 !important; /* Estricto: mayor que #login-screen (999999) en móviles */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: rgba(2, 6, 23, 0.78) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
  padding: 0.75rem !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
}

#company-selector-backdrop > div {
  margin: auto !important;
  max-width: 28rem !important; /* max-w-md = 448px */
  width: min(92vw, 448px) !important;
  max-height: 85vh !important;
  max-height: 85dvh !important;
  box-sizing: border-box !important;
}

#branch-selector-backdrop > div {
  margin: auto !important;
  max-width: 32rem !important; /* max-w-lg = 512px */
  width: min(92vw, 512px) !important;
  max-height: 85vh !important;
  max-height: 85dvh !important;
  box-sizing: border-box !important;
}

#company-selector-backdrop,
#branch-selector-backdrop {
  zoom: 1 !important;
}

@media (max-width: 480px) {
  #company-selector-backdrop > div,
  #branch-selector-backdrop > div {
    max-width: calc(100vw - 1.25rem) !important;
    width: calc(100vw - 1.25rem) !important;
    border-radius: 1.25rem !important;
    padding: 1rem !important;
    box-sizing: border-box !important;
  }
}

