/* ============================================================================== */
/* ANIMACIONES Y EFECTOS AVANZADOS */
/* ============================================================================== */

/* ============================================================================== */
/* ANIMACIONES DE SCROLL */
/* ============================================================================== */
.animate-on-scroll {
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.animated {
  opacity: 1;
}

/* Animaciones de entrada */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  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 zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes zoomOut {
  from {
    opacity: 0;
    transform: scale(1.2);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-180deg);
  }
  to {
    opacity: 1;
    transform: rotate(0);
  }
}

@keyframes flipInX {
  from {
    opacity: 0;
    transform: perspective(400px) rotateX(90deg);
  }
  to {
    opacity: 1;
    transform: perspective(400px) rotateX(0);
  }
}

@keyframes flipInY {
  from {
    opacity: 0;
    transform: perspective(400px) rotateY(90deg);
  }
  to {
    opacity: 1;
    transform: perspective(400px) rotateY(0);
  }
}

/* Aplicar animaciones */
.animate-on-scroll[data-animation="fadeIn"].animated {
  animation: fadeIn 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="fadeInUp"].animated {
  animation: fadeInUp 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="fadeInDown"].animated {
  animation: fadeInDown 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="fadeInLeft"].animated {
  animation: fadeInLeft 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="fadeInRight"].animated {
  animation: fadeInRight 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="slideInUp"].animated {
  animation: slideInUp 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="slideInDown"].animated {
  animation: slideInDown 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="slideInLeft"].animated {
  animation: slideInLeft 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="slideInRight"].animated {
  animation: slideInRight 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="zoomIn"].animated {
  animation: zoomIn 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="zoomOut"].animated {
  animation: zoomOut 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="rotateIn"].animated {
  animation: rotateIn 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="flipInX"].animated {
  animation: flipInX 0.8s ease-out forwards;
}

.animate-on-scroll[data-animation="flipInY"].animated {
  animation: flipInY 0.8s ease-out forwards;
}

/* Delays para animaciones escalonadas */
.animate-on-scroll[data-delay="100"].animated {
  animation-delay: 0.1s;
}

.animate-on-scroll[data-delay="200"].animated {
  animation-delay: 0.2s;
}

.animate-on-scroll[data-delay="300"].animated {
  animation-delay: 0.3s;
}

.animate-on-scroll[data-delay="400"].animated {
  animation-delay: 0.4s;
}

.animate-on-scroll[data-delay="500"].animated {
  animation-delay: 0.5s;
}

.animate-on-scroll[data-delay="600"].animated {
  animation-delay: 0.6s;
}

/* ============================================================================== */
/* ANIMACIONES DE TARJETAS (INSPIRADAS EN LA REFERENCIA) */
/* ============================================================================== */

/* Efecto de tarjeta con elevación y transformación */
.card-hover-effect {
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.card-hover-effect:hover {
  transform: translateY(-15px) rotateX(5deg);
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.15),
    0 15px 35px rgba(139, 92, 246, 0.1);
}

/* Efecto de brillo en hover */
.shine-effect {
  position: relative;
  overflow: hidden;
}

.shine-effect::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transition: left 0.6s ease;
  z-index: 1;
}

.shine-effect:hover::before {
  left: 100%;
}

/* Efecto de ondulación */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::after {
  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;
}

.ripple-effect:active::after {
  width: 300px;
  height: 300px;
}

/* Efecto de inclinación */
.tilt-effect {
  transition: transform 0.3s ease;
  transform-style: preserve-3d;
}

.tilt-effect:hover {
  transform: perspective(1000px) rotateX(10deg) rotateY(-10deg) rotateZ(2deg);
}

/* Efecto de escala suave */
.scale-effect {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scale-effect:hover {
  transform: scale(1.05);
}

/* Efecto de deslizamiento de contenido */
.slide-content-effect .slide-content {
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.4s ease;
}

.slide-content-effect:hover .slide-content {
  transform: translateY(0);
  opacity: 1;
}

/* ============================================================================== */
/* ANIMACIONES DE TEXTO */
/* ============================================================================== */

/* Efecto de escritura */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--primary-color);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--primary-color); }
}

/* Efecto de revelación de texto */
.text-reveal {
  position: relative;
  overflow: hidden;
}

.text-reveal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-color);
  transform: translateX(-100%);
  animation: reveal 1.5s ease-out forwards;
}

@keyframes reveal {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

/* Efecto de gradiente animado */
.gradient-text-animated {
  background: linear-gradient(
    -45deg,
    var(--primary-color),
    var(--secondary-color),
    var(--primary-color),
    var(--accent-color)
  );
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================================================== */
/* ANIMACIONES DE BOTONES */
/* ============================================================================== */

/* Efecto de pulsación */
.btn-pulse {
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
  }
}

/* Efecto de rebote */
.btn-bounce {
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -10px, 0);
  }
  70% {
    transform: translate3d(0, -5px, 0);
  }
  90% {
    transform: translate3d(0, -2px, 0);
  }
}

/* Efecto de ondas */
.btn-waves {
  position: relative;
  overflow: hidden;
}

.btn-waves::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-waves:hover::before {
  width: 300px;
  height: 300px;
}

/* Efecto de deslizamiento lateral */
.btn-slide {
  position: relative;
  overflow: hidden;
}

.btn-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transition: left 0.4s ease;
}

.btn-slide:hover::before {
  left: 100%;
}

/* ============================================================================== */
/* ANIMACIONES DE CARGA */
/* ============================================================================== */

/* Spinner circular */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(139, 92, 246, 0.1);
  border-left: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Dots de carga */
.loading-dots {
  display: inline-block;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Barra de progreso */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar::before {
  content: '';
  display: block;
  height: 100%;
  background: var(--gradient-primary);
  width: 0%;
  animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ============================================================================== */
/* ANIMACIONES DE CONTADOR */
/* ============================================================================== */

/* Animación de números */
.counter-animation {
  animation: count-up 2s ease-out forwards;
}

@keyframes count-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Efecto de flip para números */
.flip-number {
  display: inline-block;
  animation: flip 0.6s ease-in-out;
}

@keyframes flip {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(0); }
}

/* ============================================================================== */
/* ANIMACIONES DE PARTÍCULAS */
/* ============================================================================== */

/* Partículas flotantes */
.floating-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary-color);
  border-radius: 50%;
  opacity: 0.7;
  animation: float 6s infinite ease-in-out;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; }

@keyframes float {
  0%, 100% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10%, 90% {
    opacity: 0.7;
  }
  50% {
    transform: translateY(-10vh) rotate(180deg);
    opacity: 1;
  }
}

/* ============================================================================== */
/* ANIMACIONES DE PARALLAX */
/* ============================================================================== */

/* Efecto parallax suave */
.parallax-element {
  transition: transform 0.1s linear;
}

.parallax-slow {
  transform: translateY(var(--parallax-slow, 0));
}

.parallax-medium {
  transform: translateY(var(--parallax-medium, 0));
}

.parallax-fast {
  transform: translateY(var(--parallax-fast, 0));
}

/* ============================================================================== */
/* ANIMACIONES DE HOVER AVANZADAS */
/* ============================================================================== */

/* Efecto de resplandor */
.glow-effect {
  transition: all 0.3s ease;
}

.glow-effect:hover {
  box-shadow: 
    0 0 20px rgba(139, 92, 246, 0.5),
    0 0 40px rgba(139, 92, 246, 0.3),
    0 0 60px rgba(139, 92, 246, 0.1);
  transform: scale(1.02);
}

/* Efecto de desenfoque */
.blur-effect {
  transition: filter 0.3s ease;
}

.blur-effect:hover {
  filter: blur(2px);
}

.blur-effect:hover .blur-content {
  filter: blur(0px);
}

/* Efecto de inversión de colores */
.invert-effect {
  transition: filter 0.3s ease;
}

.invert-effect:hover {
  filter: invert(1);
}

/* ============================================================================== */
/* ANIMACIONES DE ENTRADA DE PÁGINA */
/* ============================================================================== */

/* Fade in inicial */
.page-fade-in {
  animation: page-fade 1s ease-out forwards;
}

@keyframes page-fade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide down inicial */
.page-slide-down {
  animation: page-slide 1s ease-out forwards;
}

@keyframes page-slide {
  from {
    opacity: 0;
    transform: translateY(-100vh);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================== */
/* ANIMACIONES RESPONSIVAS */
/* ============================================================================== */

/* Reducir animaciones en dispositivos con motion reducido */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Optimizaciones para móviles */
@media (max-width: 768px) {
  .card-hover-effect:hover {
    transform: translateY(-5px);
  }
  
  .tilt-effect:hover {
    transform: perspective(1000px) rotateX(2deg) rotateY(-2deg);
  }
  
  .scale-effect:hover {
    transform: scale(1.02);
  }
  
  /* Desactivar algunas animaciones pesadas en móvil */
  .floating-particles {
    display: none;
  }
  
  .parallax-element {
    transform: none !important;
  }
}

/* ============================================================================== */
/* ANIMACIÓN FLOTANTE PARA APP PREVIEW */
/* ============================================================================== */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* ============================================================================== */
/* ANIMACIÓN CARRUSEL INFINITO DE PREMIOS - MEJORADA */
/* ============================================================================== */
@keyframes carousel-scroll-smooth {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Versión original más rápida para compatibilidad */
@keyframes carousel-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Pausa la animación al hacer hover en el carrusel */
.prizes-carousel__track:hover {
  animation-play-state: paused;
}

/* Efecto de resplandor en las tarjetas del carrusel */
@keyframes prize-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
  }
}

/* Animación de resplandor pulsante para la vista previa de la app */
@keyframes pulse-glow {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.3;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.5;
  }
}
