/* Login Page Styles - RutiService */
/* Split-screen design with corporate blue theme */
/* Variables corporativas disponibles desde base/variables.css */

* {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

body {
  overflow: hidden;
}

.login-container {
  height: 100vh;
  background: linear-gradient(135deg, var(--corporate-blue) 0%, var(--corporate-blue-dark) 50%, var(--corporate-indigo) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  position: relative;
  overflow: hidden;
}

/* Animated gradient blobs for background atmosphere */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: float 20s ease-in-out infinite;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.8) 0%, rgba(79, 70, 229, 0.2) 100%);
  top: -10%;
  right: -5%;
  animation-delay: 0s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.6) 0%, rgba(37, 99, 235, 0.1) 100%);
  bottom: -15%;
  right: 10%;
  animation-delay: -7s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(24, 51, 145, 0.5) 0%, rgba(24, 51, 145, 0.1) 100%);
  top: 30%;
  right: 20%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 30px) scale(0.9);
  }
}

/* Main card container - ancho ajustado, altura aumentada */
.login-card {
  background: var(--soft-white);
  border-radius: 28px;
  box-shadow: 0 50px 100px rgba(0, 0, 0, 0.3), 0 20px 40px rgba(0, 0, 0, 0.2);
  max-width: 1141px;
  width: 100%;
  max-height: 95vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 0;
  overflow: hidden;
  position: relative;
  z-index: 10;
  animation: cardEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Form section (left side) */
.form-section {
  padding: 5rem 2.5rem 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: slideInLeft 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  background: var(--soft-white);
  margin: 0;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Visual section (right side) */
.visual-section {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideInRight 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
  border-top-right-radius: 28px;
  border-bottom-right-radius: 28px;
  margin: 0;
  padding: 0;
  background: #f3f4f6;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Visual decorative elements */
.visual-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
}

.visual-blob-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.6) 0%, rgba(79, 70, 229, 0) 70%);
  top: -15%;
  right: -10%;
  animation: floatVisual 15s ease-in-out infinite;
}

.visual-blob-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(24, 51, 145, 0.8) 0%, rgba(24, 51, 145, 0) 70%);
  bottom: -20%;
  left: -5%;
  animation: floatVisual 18s ease-in-out infinite reverse;
}

@keyframes floatVisual {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  50% {
    transform: translate(20px, -30px) rotate(5deg);
  }
}

/* Welcome section */
.welcome-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-container {
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: iconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

.logo-container img {
  height: 60px;
  width: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.08));
}

@keyframes iconBounce {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  50% {
    transform: scale(1.1) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.welcome-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.375rem;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  font-size: 0.8125rem;
  color: #6b7280;
  font-weight: 400;
}

/* Form inputs */
.input-group {
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.input-group:nth-child(1) { animation-delay: 0.5s; }
.input-group:nth-child(2) { animation-delay: 0.6s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #9ca3af;
  pointer-events: none;
  transition: color 0.2s ease;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 11px;
  font-size: 0.875rem;
  color: #111827;
  background: #fafafa;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 400;
}

.form-input::placeholder {
  color: #d1d5db;
}

.form-input:focus {
  outline: none;
  border-color: var(--corporate-blue);
  background: white;
  box-shadow: 0 0 0 4px rgba(24, 51, 145, 0.1);
}

.form-input:focus ~ .input-icon {
  color: var(--corporate-blue);
}

/* Remember me checkbox */
.remember-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s both;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-checkbox {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 2px solid #d1d5db;
  cursor: pointer;
  transition: all 0.2s ease;
  accent-color: var(--corporate-blue);
}

.form-checkbox:checked {
  background-color: var(--corporate-blue);
  border-color: var(--corporate-blue);
}

.checkbox-label {
  font-size: 0.8125rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
}

/* Submit button */
.submit-button {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--corporate-blue) 0%, var(--corporate-indigo) 100%);
  color: white;
  border: none;
  border-radius: 11px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 20px rgba(24, 51, 145, 0.3);
  animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s both;
  position: relative;
  overflow: hidden;
}

.submit-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.submit-button:hover::before {
  left: 100%;
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px rgba(24, 51, 145, 0.4);
}

.submit-button:active {
  transform: translateY(0);
}

/* Footer */
.form-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
  animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.9s both;
}


/* ============================================================
   TRACKING MODE — animación de swap izquierda/derecha
   ============================================================ */

/* El card usa grid — en tracking-mode invertimos el orden de las columnas */
.login-card.tracking-mode {
  grid-template-columns: 1fr 1fr;
}

/* En modo tracking: la imagen (visual-section) pasa a la izquierda */
.login-card.tracking-mode .visual-section {
  order: -1;
  border-radius: 28px 0 0 28px;
  animation: slideFromRight 0.45s cubic-bezier(0.34, 1.2, 0.64, 1) both;
  /* Fondo gris muy claro — coincide con tr-wrap */
  background: #f8f9fb;
  /* Permite que el resultado llene el panel */
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow-y: auto;
}

/* La imagen en modo tracking pierde los border-radius del lado derecho */
.login-card.tracking-mode .visual-section .login-image {
  border-radius: 28px 0 0 28px !important;
}

/* El form-section en modo tracking tiene border-radius del lado derecho */
.login-card.tracking-mode .form-section {
  border-radius: 0 28px 28px 0;
  animation: slideFromLeft 0.45s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

@keyframes slideFromRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideFromLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   TRACKING RESULT PANEL — dentro del turbo-frame
   ============================================================ */
turbo-frame#tracking_result {
  display: block;
  width: 100%;
}

.login-card.tracking-mode turbo-frame#tracking_result {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Card en página standalone de tracking — misma altura que el login */
.login-card.tracking-standalone {
  height: 75vh;
}

/* ============================================================
   Responsive — Mobile  (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* body: mantiene overflow:hidden — el scroll es INTERNO al card */
  body {
    overflow: hidden;
  }

  /* Contenedor: ocupa 100dvh (respeta barra URL dinámica de Chrome/Safari mobile) */
  .login-container {
    height: 100dvh;
    padding: 1.25rem 1rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  /* Card: modal flotante centrado */
  .login-card {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 420px;
    max-height: calc(100dvh - 2.5rem);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  /* Toggle: centrado */
  .mode-toggle {
    left: 50%;
    transform: translateX(-50%);
    top: 1rem;
  }

  /* Form section */
  .form-section {
    padding: 4rem 1.5rem 2rem;
    border-radius: 20px;
    min-height: 0 !important;
  }

  /* Visual section: oculta en login mode */
  .visual-section {
    display: none;
  }

  /* Blobs: off en mobile */
  .blob {
    display: none;
  }

  /* tracking-standalone: height auto en mobile para que el card crezca con el contenido */
  .login-card.tracking-standalone {
    height: auto;
  }

  /* Tipografía */
  .welcome-title {
    font-size: 1.5rem;
  }

  /* ── TRACKING MODE en mobile ── */

  .login-card.tracking-mode {
    grid-template-columns: 1fr;
  }

  /* Form section arriba */
  .login-card.tracking-mode .form-section {
    order: 1;
    border-radius: 20px 20px 0 0;
    animation: none;
    justify-content: flex-start;
    padding-top: 2rem;
  }

  /* Visual section debajo — panel del resultado de tracking */
  .login-card.tracking-mode .visual-section {
    display: flex;
    order: 2;
    min-height: 200px;
    border-radius: 0 0 20px 20px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    animation: none;
  }

  /* Sin imagen hero en mobile */
  .login-card.tracking-mode .visual-section .login-image {
    display: none;
  }

  /* Turbo-frame llena el panel de resultado */
  .login-card.tracking-mode turbo-frame#tracking_result {
    width: 100%;
    min-height: 180px;
    background: #f9fafb;
  }

  /* Empty state / not found: altura ajustada para mobile */
  .login-card.tracking-mode .tracking-empty-state,
  .login-card.tracking-mode .tracking-not-found {
    height: auto;
    min-height: 180px;
  }

  /* Timeline: crece con el contenido */
  .tracking-timeline {
    max-height: none;
    overflow-y: visible;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .login-card {
    max-width: 1014px;
  }
}

/* ============================================================
   Decorative circles in visual section
   ============================================================ */
.visual-pattern {
  position: relative;
  z-index: 5;
  text-align: center;
  color: white;
  opacity: 0.2;
}

.visual-pattern svg {
  animation: rotate 30s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
