/* ===== ANIMACIONES Y EFECTOS ===== */

/* Animaciones de entrada */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Clases de animación */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

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

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

.animate-scale-in {
  animation: scaleIn 0.4s ease-out;
}

.animate-bounce-in {
  animation: bounceIn 0.8s ease-out;
}

/* Animaciones escalonadas para grids */
.animate-stagger > * {
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.3s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.4s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.5s; }
.animate-stagger > *:nth-child(6) { animation-delay: 0.6s; }
.animate-stagger > *:nth-child(7) { animation-delay: 0.7s; }
.animate-stagger > *:nth-child(8) { animation-delay: 0.8s; }
.animate-stagger > *:nth-child(9) { animation-delay: 0.9s; }

/* Efectos de hover mejorados */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.hover-glow {
  position: relative;
  overflow: hidden;
}

.hover-glow::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent);
  transform: rotate(45deg);
  transition: all 0.6s;
  opacity: 0;
}

.hover-glow:hover::before {
  left: 100%;
  opacity: 1;
}

/* Efectos de ripple para botones */
.ripple {
  position: relative;
  overflow: hidden;
}

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

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

/* Animaciones de loading */
.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    color: rgba(0,0,0,0);
    text-shadow:
      .25em 0 0 rgba(0,0,0,0),
      .5em 0 0 rgba(0,0,0,0);
  }
  40% {
    color: var(--text-primary);
    text-shadow:
      .25em 0 0 rgba(0,0,0,0),
      .5em 0 0 rgba(0,0,0,0);
  }
  60% {
    text-shadow:
      .25em 0 0 var(--text-primary),
      .5em 0 0 rgba(0,0,0,0);
  }
  80%, 100% {
    text-shadow:
      .25em 0 0 var(--text-primary),
      .5em 0 0 var(--text-primary);
  }
}

/* Spinner mejorado */
.spinner-ring {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-secondary);
  border-radius: 50%;
  border-top-color: var(--color-movistar);
  animation: spin 1s ease-in-out infinite;
}

.spinner-dual {
  width: 40px;
  height: 40px;
  position: relative;
}

.spinner-dual::before,
.spinner-dual::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--color-movistar);
}

.spinner-dual::before {
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.spinner-dual::after {
  width: 30px;
  height: 30px;
  top: 5px;
  left: 5px;
  border-top-color: var(--color-vodafone);
  animation: spin 0.7s linear infinite reverse;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Animaciones de progreso */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-movistar), var(--color-vodafone));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.progress-indeterminate {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg, 
    transparent, 
    var(--color-movistar), 
    transparent);
  animation: progress-slide 2s infinite;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Efectos de transición entre vistas */
.view-transition-enter-active,
.view-transition-leave-active {
  transition: all 0.3s ease;
}

.view-transition-enter-from {
  opacity: 0;
  transform: translateX(30px);
}

.view-transition-leave-to {
  opacity: 0;
  transform: translateX(-30px);
}

/* Animaciones de contador */
.counter {
  font-variant-numeric: tabular-nums;
}

.counter-animate {
  animation: counter-pulse 0.6s ease-out;
}

@keyframes counter-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
    color: var(--color-movistar);
  }
  100% {
    transform: scale(1);
  }
}

/* Efectos de partículas */
.particle-explosion {
  position: relative;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--color-movistar);
  border-radius: 50%;
  pointer-events: none;
  animation: particle-explode 1s ease-out forwards;
}

@keyframes particle-explode {
  0% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
  100% {
    opacity: 0;
    transform: scale(0) translate(var(--x, 0), var(--y, 0));
  }
}

/* Animaciones de error/éxito */
.shake {
  animation: shake 0.5s ease-in-out;
}

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

.bounce {
  animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Efectos de texto */
.text-gradient {
  background: linear-gradient(135deg, var(--color-movistar), var(--color-vodafone));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-shimmer {
  background: linear-gradient(90deg,
    var(--text-primary) 0%,
    var(--color-movistar) 50%,
    var(--text-primary) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Efectos de morphing para iconos */
.icon-morph {
  transition: all 0.3s ease;
}

.icon-morph:hover {
  transform: rotate(180deg) scale(1.1);
}

/* Animaciones de accordion/collapse */
.collapse-enter-active,
.collapse-leave-active {
  transition: all 0.3s ease;
  overflow: hidden;
}

.collapse-enter-from,
.collapse-leave-to {
  height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

/* Efectos de glassmorphism animado */
.glass-dynamic {
  backdrop-filter: blur(0px);
  transition: backdrop-filter 0.5s ease;
}

.glass-dynamic:hover {
  backdrop-filter: blur(20px);
}

/* Indicadores de carga skeleton mejorados */
.skeleton-wave {
  position: relative;
  overflow: hidden;
}

.skeleton-wave::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent);
  animation: skeleton-wave 1.6s ease-in-out infinite;
}

@keyframes skeleton-wave {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Animaciones de notificaciones */
.notification-slide-in {
  animation: notificationSlideIn 0.4s ease-out;
}

.notification-slide-out {
  animation: notificationSlideOut 0.4s ease-in;
}

@keyframes notificationSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes notificationSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Estados de animación para accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .animate-fade-in,
  .animate-slide-in-left,
  .animate-slide-in-right,
  .animate-scale-in,
  .animate-bounce-in,
  .hover-lift,
  .ripple,
  .shake,
  .bounce {
    animation: none !important;
    transition: none !important;
  }
  
  .animate-stagger > * {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* Utilidades de timing */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-500 { animation-delay: 0.5s; }
.delay-700 { animation-delay: 0.7s; }
.delay-1000 { animation-delay: 1s; }

.duration-150 { animation-duration: 0.15s; }
.duration-300 { animation-duration: 0.3s; }
.duration-500 { animation-duration: 0.5s; }
.duration-700 { animation-duration: 0.7s; }
.duration-1000 { animation-duration: 1s; }