:root {
  --primary-blue: #1e40af;
  --secondary-blue: #3b82f6;
  --accent-blue: #60a5fa;
  --light-blue: #dbeafe;
  --dark-blue: #1e3a8a;
  --white: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --success-green: #10b981;
  --error-red: #ef4444;
  --border-color: #e5e7eb;
  --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --border-radius: 12px;
  --border-radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

/* Partículas de fondo */
.background-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.particle {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: float-particles 15s infinite linear;
}

.particle:nth-child(1) {
  width: 4px;
  height: 4px;
  left: 10%;
  animation-delay: 0s;
}
.particle:nth-child(2) {
  width: 6px;
  height: 6px;
  left: 20%;
  animation-delay: 2s;
}
.particle:nth-child(3) {
  width: 3px;
  height: 3px;
  left: 30%;
  animation-delay: 4s;
}
.particle:nth-child(4) {
  width: 5px;
  height: 5px;
  left: 40%;
  animation-delay: 6s;
}
.particle:nth-child(5) {
  width: 4px;
  height: 4px;
  left: 50%;
  animation-delay: 8s;
}
.particle:nth-child(6) {
  width: 7px;
  height: 7px;
  left: 60%;
  animation-delay: 10s;
}
.particle:nth-child(7) {
  width: 3px;
  height: 3px;
  left: 70%;
  animation-delay: 12s;
}
.particle:nth-child(8) {
  width: 5px;
  height: 5px;
  left: 80%;
  animation-delay: 14s;
}
.particle:nth-child(9) {
  width: 4px;
  height: 4px;
  left: 90%;
  animation-delay: 16s;
}

@keyframes float-particles {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

/* Container principal */
.login-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 800px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  background: var(--white);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-heavy);
  min-height: 400px;
  max-height: 450px;
}

/* Panel izquierdo con SVG */
.welcome-panel {
  background: linear-gradient(
    135deg,
    var(--primary-blue) 0%,
    var(--secondary-blue) 100%
  );
  padding: 30px 25px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.svg-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.welcome-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.welcome-logo {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.welcome-logo i {
  font-size: 28px;
  color: var(--white);
}

.welcome-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.4;
  font-weight: 400;
}

/* Panel de login */
.login-panel {
  padding: 30px 25px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--white);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.mobile-logo {
  display: none;
  width: 50px;
  height: 50px;
  background: var(--primary-blue);
  border-radius: var(--border-radius);
  margin: 0 auto 16px;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-medium);
}

.mobile-logo i {
  font-size: 24px;
  color: var(--white);
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Formulario */
.login-form {
  width: 100%;
}

.form-group {
  margin-bottom: 20px;
  position: relative;
}

/* Floating Label System */
.floating-label {
  position: relative;
  width: 100%;
}

.form-control {
  width: 100%;
  height: 56px;
  padding: 20px 50px 8px 50px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background: #f8f9fa;
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--secondary-blue);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-control.has-toggle {
  padding-right: 50px;
}

/* Floating Label */
.floating-label label {
  position: absolute;
  left: 50px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-light);
  font-weight: 400;
  transition: var(--transition);
  pointer-events: none;
  background: transparent;
  z-index: 2;
}

/* Label flotante activa */
.form-control:focus + label,
.form-control:not(:placeholder-shown) + label,
.form-control.has-value + label {
  top: 12px;
  left: 50px;
  font-size: 11px;
  font-weight: 600;
  color: var(--secondary-blue);
  transform: translateY(0);
}

/* Placeholder oculto por defecto */
.form-control::placeholder {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Mostrar placeholder cuando está en focus */
.form-control:focus::placeholder {
  opacity: 1;
  color: var(--text-light);
}

.form-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-light);
  transition: var(--transition);
  pointer-events: none;
  z-index: 2;
}

.form-control:focus ~ .form-icon {
  color: var(--secondary-blue);
}

.password-toggle {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  z-index: 3;
}

.password-toggle:hover {
  color: var(--secondary-blue);
  background: rgba(59, 130, 246, 0.1);
}

.password-toggle:focus {
  outline: 2px solid var(--secondary-blue);
  outline-offset: 2px;
}

.password-toggle.active {
  color: var(--secondary-blue);
  background: rgba(59, 130, 246, 0.15);
}

/* Estados de error MEJORADOS */
.form-control.form-error {
  border-color: var(--error-red) !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
}

.form-control.form-error:focus {
  border-color: var(--error-red) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
}

.form-control.form-error + label {
  color: var(--error-red) !important;
}

/* Error message SIN DESPLAZAMIENTO */
.invalid-feedback {
  display: block;
  font-size: 12px;
  color: var(--error-red);
  margin-top: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px; /* Altura fija para evitar desplazamientos */
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

.invalid-feedback.show {
  opacity: 1;
  transform: translateY(0);
}

.invalid-feedback i {
  font-size: 12px;
  flex-shrink: 0;
}

/* Botón principal - SIN GRADIENTES */
.btn-login {
  width: 100%;
  height: 50px;
  background: var(--primary-blue);
  border: none;
  border-radius: var(--border-radius);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-medium);
  letter-spacing: 0.025em;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

/* Hover sin gradiente */
.btn-login:hover:not(:disabled) {
  background: var(--dark-blue);
  transform: translateY(-1px);
  box-shadow: 0 8px 25px -5px rgba(30, 64, 175, 0.3);
}

.btn-login:active:not(:disabled) {
  transform: translateY(0);
  background: var(--dark-blue);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Footer simplificado */
.login-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.footer-text {
  font-size: 12px;
  color: var(--text-light);
}

.footer-link {
  color: var(--secondary-blue);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--primary-blue);
}

/* Alertas generales (para errores de servidor) */
.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

.alert-icon {
  font-size: 14px;
  margin-top: 1px;
  flex-shrink: 0;
}

/* Loading spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--white);
  animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 900px) {
  .login-container {
    grid-template-columns: 1fr;
    max-width: 400px;
    min-height: 440px;
  }

  .welcome-panel {
    display: none;
  }

  .login-panel {
    padding: 32px 28px;
  }

  .mobile-logo {
    display: flex;
  }

  .login-header {
    margin-bottom: 28px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .login-container {
    max-width: 100%;
    border-radius: var(--border-radius);
    min-height: 420px;
  }

  .login-panel {
    padding: 28px 24px;
  }

  .login-title {
    font-size: 20px;
  }

  .form-control {
    height: 52px;
    padding: 18px 48px 8px 48px;
    font-size: 14px;
  }

  .form-control.has-toggle {
    padding-right: 48px;
  }

  .password-toggle {
    right: 12px;
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .btn-login {
    height: 48px;
    font-size: 14px;
  }
}

/* Animaciones de entrada */
@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

.welcome-panel {
  animation: slideInFromLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-panel {
  animation: slideInFromRight 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-container {
  animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
