body {
  background: linear-gradient(135deg, #e3f2fd, #ffffff);
  font-family: Roboto, sans-serif;
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  width: 100%;
}

body::before {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(13, 110, 253, 0.1) 0%, transparent 70%);
  animation: pulse 15s ease-in-out infinite;
  top: -50%;
  left: -50%;
  z-index: 0;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.card {
  border-radius: 20px;
  animation: fadeIn 0.6s ease-in-out;
  position: relative;
  z-index: 1;
  border: none;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.login-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.logo-animation {
  object-fit: cover;
  animation: logoFloat 3s ease-in-out infinite;
  transition: transform 0.3s ease;
}

.logo-animation:hover {
  transform: scale(1.05);
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.fade-in-delay {
  animation: fadeIn 0.8s ease-in-out;
}

.fade-in-delay-2 {
  animation: fadeIn 1s ease-in-out;
}

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

.input-group-text {
  background-color: #f8f9fa;
  border-color: #dee2e6;
  transition: all 0.3s ease;
}

.input-group:focus-within .input-group-text {
  background-color: #e7f1ff;
  border-color: #0d6efd;
  color: #0d6efd;
}

input:focus, select:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  transition: all 0.3s ease;
}

.form-control, .form-select {
  transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
  transform: scale(1.02);
}

.btn-toggle-password {
  cursor: pointer;
  border: none;
  background-color: #f8f9fa;
  transition: all 0.3s ease;
}

.btn-toggle-password:hover {
  background-color: #e7f1ff;
  color: #0d6efd;
}

.btn-login {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  font-weight: 600;
  padding: 12px;
}

.btn-login::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-login:hover::before {
  width: 300px;
  height: 300px;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(13, 110, 253, 0.4);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login.loading {
  pointer-events: none;
  opacity: 0.8;
}

.validation-icon {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.validation-icon.valid {
  color: #198754;
}

.validation-icon.invalid {
  color: #dc3545;
}

.validation-message {
  display: block;
  min-height: 20px;
  margin-top: 5px;
  transition: all 0.3s ease;
  font-size: 0.875rem;
}

.validation-message.valid {
  color: #198754;
}

.validation-message.invalid {
  color: #dc3545;
  animation: shake 0.5s ease-in-out;
}

.error-message {
  min-height: 50px;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-10px);
}

.error-message.show {
  opacity: 1;
  transform: translateY(0);
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c2c7;
  animation: shake 0.5s ease-in-out, slideIn 0.3s ease-out;
}

.error-message.success {
  background-color: #d1e7dd;
  color: #0f5132;
  border: 1px solid #badbcc;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

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

.form-check-input:checked {
  background-color: #0d6efd;
  border-color: #0d6efd;
  animation: checkmark 0.3s ease-in-out;
}

@keyframes checkmark {
  0% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.version-text {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 10px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.version-text:hover {
  opacity: 1;
}

/* Animación para el spinner de carga */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

/* Efecto de pulso en los inputs cuando hay error */
.form-control.error, .form-select.error {
  border-color: #dc3545;
  animation: inputError 0.5s ease-in-out;
}

@keyframes inputError {
  0%, 100% { border-color: #dc3545; }
  50% { border-color: #ff6b6b; }
}

/* Transición suave para el select de usuarios */
.form-select {
  cursor: pointer;
}

.form-select option {
  padding: 10px;
}


/* Optimización de animaciones para mejor rendimiento */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  will-change: transform, opacity;
}

.logo-animation {
  will-change: transform;
}

.card {
  will-change: transform;
}

/* === Responsive Design === */

/* Móvil pequeño (hasta 375px) */
@media (max-width: 375px) {
  body {
    padding: 8px;
  }
  
  .card {
    margin: 0;
    max-width: 100%;
    padding: 18px 12px !important;
    border-radius: 15px;
  }
  
  .logo-animation {
    height: 70px;
  }
  
  h4 {
    font-size: 1.15rem;
    margin-bottom: 1rem !important;
  }
  
  .form-label {
    font-size: 0.875rem;
  }
  
  .form-control, .form-select {
    font-size: 16px; /* Evita zoom en iOS */
    padding: 0.5rem 0.75rem;
  }
  
  .input-group-text {
    padding: 0.5rem 0.75rem;
  }
  
  .btn-login {
    padding: 12px;
    font-size: 0.95rem;
  }
  
  .form-check-label {
    font-size: 0.875rem;
  }
  
  .version-text {
    font-size: 0.7rem;
  }
}

/* Móvil (376px a 576px) */
@media (min-width: 376px) and (max-width: 576px) {
  body {
    padding: 10px;
  }
  
  .card {
    margin: 0;
    max-width: 100%;
    padding: 20px 15px !important;
  }
  
  .logo-animation {
    height: 80px;
  }
  
  h4 {
    font-size: 1.25rem;
  }
  
  .form-control, .form-select {
    font-size: 16px; /* Evita zoom en iOS */
  }
  
  .btn-login {
    padding: 14px;
    font-size: 1rem;
  }
}

/* Tablet pequeña (577px a 768px) */
@media (min-width: 577px) and (max-width: 768px) {
  body {
    padding: 15px;
  }
  
  .card {
    max-width: 420px;
    padding: 25px 20px !important;
  }
  
  .logo-animation {
    height: 100px;
  }
  
  h4 {
    font-size: 1.5rem;
  }
}

/* Tablet (769px a 992px) */
@media (min-width: 769px) and (max-width: 992px) {
  .card {
    max-width: 450px;
    padding: 30px 25px !important;
  }
  
  .logo-animation {
    height: 110px;
  }
  
  h4 {
    font-size: 1.75rem;
  }
}

/* Desktop pequeño (993px a 1200px) */
@media (min-width: 993px) and (max-width: 1200px) {
  .card {
    max-width: 400px;
  }
  
  .login-card:hover {
    transform: translateY(-5px);
  }
}

/* Desktop grande (1201px en adelante) */
@media (min-width: 1201px) {
  .card {
    max-width: 420px;
    padding: 35px 30px !important;
  }
  
  .logo-animation {
    height: 120px;
  }
  
  h4 {
    font-size: 2rem;
  }
  
  .login-card:hover {
    transform: translateY(-5px);
  }
}

/* Reducir animaciones en dispositivos que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  body::before {
    animation: none;
  }
  
  .logo-animation {
    animation: none;
  }
}

/* Mejoras de rendimiento */
.form-control, .form-select, .btn {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Optimización para pantallas táctiles */
@media (hover: none) and (pointer: coarse) {
  .btn-login:hover {
    transform: none;
    box-shadow: none;
  }
  
  .login-card:hover {
    transform: none;
  }
  
  .btn-toggle-password {
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
  }
  
  .form-check-input {
    width: 1.5rem;
    height: 1.5rem;
  }
}

/* Ajustes para orientación horizontal en móviles */
@media (max-width: 768px) and (orientation: landscape) {
  body {
    padding: 5px;
  }
  
  .card {
    padding: 15px 20px !important;
    max-width: 90%;
  }
  
  .logo-animation {
    height: 60px;
  }
  
  h4 {
    font-size: 1.15rem;
    margin-bottom: 0.75rem !important;
  }
  
  .mb-3 {
    margin-bottom: 0.75rem !important;
  }
  
  .mb-4 {
    margin-bottom: 1rem !important;
  }
  
  .text-center.mb-4 {
    margin-bottom: 1rem !important;
    padding: 0.5rem 0 !important;
  }
}

/* Asegurar que los inputs sean accesibles en todas las resoluciones */
.form-control:focus, .form-select:focus {
  transform: scale(1.01);
}

/* Mejorar espaciado en dispositivos pequeños */
@media (max-width: 576px) {
  .input-group {
    margin-bottom: 0.5rem;
  }
  
  .validation-message {
    font-size: 0.8rem;
  }
  
  .error-message {
    padding: 10px;
    font-size: 0.875rem;
  }
}

/* Mejorar contraste y legibilidad en pantallas pequeñas */
@media (max-width: 375px) {
  .form-label {
    margin-bottom: 0.4rem;
  }
  
  .form-check {
    margin-bottom: 0.75rem !important;
  }
}