/* ===================================
   KDS WebApp - Animaciones Elegantes
   Sutiles y Profesionales
   =================================== */

/* ===== KEYFRAMES ===== */

/* Fade In desde abajo */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In desde arriba */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In simple */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade In con escala */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide In desde izquierda */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In desde derecha */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pulso suave */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Bounce suave */
@keyframes softBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Shimmer para loading */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Glow pulse */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 5px rgba(26, 95, 122, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(26, 95, 122, 0.5);
  }
}

/* Rotación suave */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Float suave */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ===== CLASES DE ANIMACIÓN ===== */

/* Animaciones de entrada */
.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease-out forwards;
}

.animate-fade-in-scale {
  animation: fadeInScale 0.5s ease-out forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out forwards;
}

/* Animaciones continuas */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
  animation: softBounce 2s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-rotate {
  animation: rotate 1s linear infinite;
}

.animate-glow {
  animation: glowPulse 2s ease-in-out infinite;
}

/* Skeleton loader con shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-200, #e5e7eb) 25%,
    var(--gray-100, #f3f4f6) 50%,
    var(--gray-200, #e5e7eb) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--border-radius-sm, 8px);
}

/* ===== DELAYS PARA STAGGERED ANIMATIONS ===== */

.delay-100 { animation-delay: 0.1s; opacity: 0; }
.delay-200 { animation-delay: 0.2s; opacity: 0; }
.delay-300 { animation-delay: 0.3s; opacity: 0; }
.delay-400 { animation-delay: 0.4s; opacity: 0; }
.delay-500 { animation-delay: 0.5s; opacity: 0; }
.delay-600 { animation-delay: 0.6s; opacity: 0; }
.delay-700 { animation-delay: 0.7s; opacity: 0; }
.delay-800 { animation-delay: 0.8s; opacity: 0; }

/* ===== TRANSICIONES SUAVES ===== */

.transition-all {
  transition: all 0.3s ease;
}

.transition-fast {
  transition: all 0.15s ease;
}

.transition-slow {
  transition: all 0.5s ease;
}

/* ===== HOVER EFFECTS ===== */

/* Elevación suave al hover */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

/* Escala suave al hover */
.hover-scale {
  transition: transform 0.3s ease;
}

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

/* Glow al hover */
.hover-glow {
  transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(26, 95, 122, 0.3);
}

/* Brillo al hover */
.hover-brightness {
  transition: filter 0.3s ease;
}

.hover-brightness:hover {
  filter: brightness(1.05);
}

/* ===== COMPONENTES ESPECÍFICOS ===== */

/* Cards con animación de entrada */
.card-animated {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

/* Botones con efecto ripple */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

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

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
}

/* Input focus glow */
.input-glow:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.2);
  border-color: var(--primary, #1a5f7a);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Badge con pulse */
.badge-pulse {
  position: relative;
}

.badge-pulse::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  animation: glowPulse 2s ease-in-out infinite;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200, #e5e7eb);
  border-top-color: var(--primary, #1a5f7a);
  border-radius: 50%;
  animation: rotate 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* Progress bar animado */
.progress-animated {
  position: relative;
  overflow: hidden;
}

.progress-animated::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ===== ESTADOS DE LOADING ===== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.loading-content {
  text-align: center;
  animation: fadeInUp 0.5s ease-out;
}

/* ===== NOTIFICACIONES ===== */

.notification-enter {
  animation: slideInRight 0.4s ease-out forwards;
}

.notification-exit {
  animation: slideInRight 0.3s ease-in reverse forwards;
}

/* ===== MODALES ===== */

.modal-backdrop {
  animation: fadeIn 0.3s ease-out forwards;
}

.modal-content-animated {
  animation: fadeInScale 0.3s ease-out forwards;
}

/* ===== QR CODE ESPECÍFICO ===== */

.qr-pulse {
  animation: glowPulse 2s ease-in-out infinite;
  border-radius: var(--border-radius, 12px);
}

.qr-scanning {
  position: relative;
}

.qr-scanning::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary, #1a5f7a),
    transparent
  );
  animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
  0%, 100% {
    top: 0;
    opacity: 0;
  }
  50% {
    top: calc(100% - 3px);
    opacity: 1;
  }
}

/* ===== STATUS INDICATORS ===== */

.status-dot-pulse {
  position: relative;
}

.status-dot-pulse::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
  animation: pulse 2s ease-in-out infinite;
  z-index: -1;
}

/* ===== REDUCE MOTION ===== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
