/* ===================================
   ANIMATIONS.CSS - CORRECCIÓN COMPLETA
   Todas las animaciones optimizadas y sin conflictos
   =================================== */

/* Variables para animaciones */
:root {
  --animation-duration-fast: 0.3s;
  --animation-duration-normal: 0.6s;
  --animation-duration-slow: 1s;
  --animation-easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --animation-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* RESET DE ANIMACIONES PROBLEMÁTICAS */
* {
  animation-play-state: running !important;
  animation-fill-mode: both !important;
}

/* PREVENIR ANIMACIONES CONGELADAS */
.animate-on-scroll,
.service-card,
.benefit-item,
.contact-info-card,
.hero-placeholder-image,
.trading-placeholder-image {
  animation-play-state: running !important;
  animation-iteration-count: 1 !important;
  animation-fill-mode: both !important;
}

/* ===================================
   FADE ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
    visibility: hidden;
  }
  to {
    opacity: 1;
    visibility: visible;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    visibility: visible;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
    visibility: hidden;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
    visibility: hidden;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
    visibility: hidden;
  }
  to {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
    visibility: hidden;
  }
  to {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
  }
}

/* ===================================
   SLIDE ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===================================
   SCALE ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes scaleOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.8);
    opacity: 0;
  }
}

@keyframes zoomIn {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes zoomOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    opacity: 1;
  }
  to {
    transform: scale(0.3);
    opacity: 0;
  }
}

/* ===================================
   ROTATION ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes rotateIn {
  from {
    transform: rotate(-200deg);
    opacity: 0;
  }
  to {
    transform: rotate(0deg);
    opacity: 1;
  }
}

@keyframes rotateOut {
  from {
    transform: rotate(0deg);
    opacity: 1;
  }
  to {
    transform: rotate(200deg);
    opacity: 0;
  }
}

/* ===================================
   BOUNCE ANIMATIONS - OPTIMIZADAS
   =================================== */

@keyframes bounce {
  0%,
  20%,
  53%,
  80%,
  100% {
    transform: translate3d(0, 0, 0);
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }
  40%,
  43% {
    transform: translate3d(0, -30px, 0);
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
  }
  70% {
    transform: translate3d(0, -15px, 0);
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
  }
  90% {
    transform: translate3d(0, -4px, 0);
  }
}

@keyframes bounceIn {
  from,
  20%,
  40%,
  60%,
  80%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }
  0% {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 0.3);
  }
  20% {
    transform: scale3d(1.1, 1.1, 1.1);
  }
  40% {
    transform: scale3d(0.9, 0.9, 0.9);
  }
  60% {
    opacity: 1;
    transform: scale3d(1.03, 1.03, 1.03);
  }
  80% {
    transform: scale3d(0.97, 0.97, 0.97);
  }
  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

/* ===================================
   PULSE ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes pulse {
  0% {
    transform: scale3d(1, 1, 1);
  }
  50% {
    transform: scale3d(1.05, 1.05, 1.05);
  }
  100% {
    transform: scale3d(1, 1, 1);
  }
}

@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 212, 255, 0);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
    transform: scale(1);
  }
}

/* ===================================
   FLOATING ANIMATIONS - OPTIMIZADAS
   =================================== */

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes floatReverse {
  0%,
  100% {
    transform: translateY(-20px);
  }
  50% {
    transform: translateY(0px);
  }
}

@keyframes floatIcon {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.6;
  }
  50% {
    transform: translateY(-15px) rotate(180deg);
    opacity: 1;
  }
}

@keyframes floatShape {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.1;
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 0.3;
  }
}

@keyframes floatParticle {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.3;
  }
  50% {
    transform: translateY(-30px) rotate(180deg);
    opacity: 0.6;
  }
}

/* ===================================
   GLOW ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes glow {
  0% {
    text-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
  }
  50% {
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.8),
      0 0 30px rgba(0, 212, 255, 0.6);
  }
  100% {
    text-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
  }
}

@keyframes neonGlow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(0, 212, 255, 0.5), 0 0 10px rgba(0, 212, 255, 0.3),
      0 0 15px rgba(0, 212, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.8), 0 0 20px rgba(0, 212, 255, 0.6),
      0 0 30px rgba(0, 212, 255, 0.4);
  }
}

/* ===================================
   TYPING ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

/* ===================================
   LOADING ANIMATIONS - OPTIMIZADAS
   =================================== */

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes spinReverse {
  0% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes loadingDots {
  0%,
  80%,
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===================================
   RIPPLE ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes rippleExpand {
  0% {
    transform: scale(0);
    opacity: 0.8;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ===================================
   BACKGROUND ANIMATIONS - OPTIMIZADAS
   =================================== */

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes holographicShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ===================================
   PARTICLE ANIMATIONS - OPTIMIZADAS
   =================================== */

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) translateX(100px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes particleFade {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

/* ===================================
   HOVER ANIMATIONS - CORREGIDAS
   =================================== */

@keyframes hoverLift {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-10px);
  }
}

@keyframes hoverScale {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.05);
  }
}

@keyframes hoverGlow {
  0% {
    box-shadow: 0 0 0 rgba(0, 212, 255, 0);
  }
  100% {
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
  }
}

/* ===================================
   CLASES DE ANIMACIÓN - APLICACIÓN
   =================================== */

/* Fade Animations */
.fade-in {
  animation: fadeIn var(--animation-duration-normal) var(--animation-easing)
    forwards;
}

.fade-out {
  animation: fadeOut var(--animation-duration-normal) var(--animation-easing)
    forwards;
}

.fade-in-up {
  animation: fadeInUp var(--animation-duration-normal) var(--animation-easing)
    forwards;
}

.fade-in-down {
  animation: fadeInDown var(--animation-duration-normal) var(--animation-easing)
    forwards;
}

.fade-in-left {
  animation: fadeInLeft var(--animation-duration-normal) var(--animation-easing)
    forwards;
}

.fade-in-right {
  animation: fadeInRight var(--animation-duration-normal)
    var(--animation-easing) forwards;
}

/* Scale Animations */
.scale-in {
  animation: scaleIn var(--animation-duration-normal) var(--animation-easing)
    forwards;
}

.zoom-in {
  animation: zoomIn var(--animation-duration-normal) var(--animation-easing)
    forwards;
}

.bounce-in {
  animation: bounceIn var(--animation-duration-slow)
    var(--animation-easing-bounce) forwards;
}

/* Continuous Animations */
.pulse {
  animation: pulse 2s ease-in-out infinite;
}

.pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

.float {
  animation: float 3s ease-in-out infinite;
}

.float-reverse {
  animation: floatReverse 3s ease-in-out infinite;
}

.spin {
  animation: spin 2s linear infinite;
}

.glow {
  animation: glow 2s ease-in-out infinite;
}

.neon-glow {
  animation: neonGlow 2s ease-in-out infinite;
}

/* Hover Animations */
.hover-lift:hover {
  animation: hoverLift var(--animation-duration-fast) var(--animation-easing)
    forwards;
}

.hover-scale:hover {
  animation: hoverScale var(--animation-duration-fast) var(--animation-easing)
    forwards;
}

.hover-glow:hover {
  animation: hoverGlow var(--animation-duration-fast) var(--animation-easing)
    forwards;
}

/* ===================================
   ANIMACIONES ESPECÍFICAS DEL SITIO
   =================================== */

/* Hero Section Animations */
.hero-title {
  animation: fadeInUp 1s ease-out 0.5s both;
}

.hero-subtitle {
  animation: fadeInUp 1s ease-out 0.8s both;
}

.hero-description {
  animation: fadeInUp 1s ease-out 1.1s both;
}

.hero-buttons {
  animation: fadeInUp 1s ease-out 1.4s both;
}

.hero-placeholder-image {
  animation: scaleIn 1s ease-out 0.3s both;
}

/* Service Cards */
.service-card {
  animation: fadeInUp 0.8s ease-out both;
  transition: all 0.3s ease;
}

.service-card:hover {
  animation: hoverLift 0.3s ease forwards;
}

/* Benefit Items */
.benefit-item {
  animation: fadeInLeft 0.8s ease-out both;
  transition: all 0.3s ease;
}

.benefit-item:hover {
  animation: none;
  transform: translateX(10px);
}

/* Contact Cards */
.contact-info-card {
  animation: scaleIn 0.8s ease-out both;
  transition: all 0.3s ease;
}

.contact-info-card:hover {
  animation: hoverLift 0.3s ease forwards;
}

/* Stats Animation */
.stat-item {
  animation: bounceIn 1s ease-out both;
}

/* Navigation */
.navbar {
  animation: slideInDown 0.8s ease-out both;
}

/* Scroll to Top */
.scroll-to-top {
  animation: scaleIn 0.5s ease-out both;
}

.scroll-to-top.visible {
  animation: scaleIn 0.5s ease-out both;
}

/* ===================================
   DELAYS PARA ANIMACIONES ESCALONADAS
   =================================== */

.animate-on-scroll:nth-child(1) {
  animation-delay: 0.1s;
}
.animate-on-scroll:nth-child(2) {
  animation-delay: 0.2s;
}
.animate-on-scroll:nth-child(3) {
  animation-delay: 0.3s;
}
.animate-on-scroll:nth-child(4) {
  animation-delay: 0.4s;
}
.animate-on-scroll:nth-child(5) {
  animation-delay: 0.5s;
}
.animate-on-scroll:nth-child(6) {
  animation-delay: 0.6s;
}

.service-card:nth-child(1) {
  animation-delay: 0.2s;
}
.service-card:nth-child(2) {
  animation-delay: 0.4s;
}
.service-card:nth-child(3) {
  animation-delay: 0.6s;
}

.benefit-item:nth-child(1) {
  animation-delay: 0.1s;
}
.benefit-item:nth-child(2) {
  animation-delay: 0.3s;
}
.benefit-item:nth-child(3) {
  animation-delay: 0.5s;
}
.benefit-item:nth-child(4) {
  animation-delay: 0.7s;
}

.contact-info-card:nth-child(1) {
  animation-delay: 0.2s;
}
.contact-info-card:nth-child(2) {
  animation-delay: 0.4s;
}
.contact-info-card:nth-child(3) {
  animation-delay: 0.6s;
}

/* ===================================
   RESPONSIVE ANIMATIONS
   =================================== */

@media (max-width: 768px) {
  /* Reducir duración en móviles */
  :root {
    --animation-duration-fast: 0.2s;
    --animation-duration-normal: 0.4s;
    --animation-duration-slow: 0.6s;
  }

  /* Deshabilitar animaciones complejas */
  .float,
  .float-reverse,
  .pulse-glow,
  .neon-glow {
    animation: none !important;
  }

  /* Simplificar hover effects */
  .hover-lift:hover,
  .hover-scale:hover,
  .hover-glow:hover {
    animation: none !important;
    transform: none !important;
  }
}

@media (max-width: 576px) {
  /* Deshabilitar casi todas las animaciones en móviles pequeños */
  .animate-on-scroll,
  .service-card,
  .benefit-item,
  .contact-info-card {
    animation: fadeIn 0.3s ease-out both !important;
  }

  /* Mantener solo animaciones esenciales */
  .hero-title,
  .hero-subtitle,
  .hero-description,
  .hero-buttons {
    animation: fadeInUp 0.5s ease-out both !important;
  }
}

/* ===================================
   PERFORMANCE OPTIMIZATIONS
   =================================== */

/* Reducir animaciones para usuarios que prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .pulse,
  .float,
  .spin,
  .glow,
  .neon-glow {
    animation: none !important;
  }
}

/* GPU Acceleration para animaciones suaves */
.animate-on-scroll,
.service-card,
.benefit-item,
.contact-info-card,
.hero-placeholder-image,
.trading-placeholder-image {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
  will-change: transform, opacity;
}

/* Optimización para animaciones continuas */
.pulse,
.float,
.spin,
.glow {
  will-change: transform, box-shadow, text-shadow;
}

/* ===================================
   FALLBACK PARA NAVEGADORES ANTIGUOS
   =================================== */

/* Fallback para navegadores sin soporte de animaciones */
@supports not (animation: fadeIn 1s) {
  .animate-on-scroll,
  .service-card,
  .benefit-item,
  .contact-info-card {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ===================================
   DEBUGGING - REMOVER EN PRODUCCIÓN
   =================================== */

/* Uncomment for debugging animations */
/*
.animate-on-scroll {
    border: 1px solid red !important;
}

.animate-on-scroll.animated {
    border: 1px solid green !important;
}
*/
