/* Enhanced Animations for Dr. Capdevilla Website */

/* Floating Animation */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

.floating {
  animation: float 6s ease-in-out infinite;
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.pulsing {
  animation: pulse 2s ease-in-out infinite;
}

/* Glow Animation */
@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 40px rgba(59, 130, 246, 0.6); }
}

.glowing {
  animation: glow 3s ease-in-out infinite;
}

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

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

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(100px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Bounce Animation */
@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    transform: translate3d(0, -30px, 0);
  }
  70% {
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0, -4px, 0);
  }
}

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

/* Rotate Animation */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.rotating {
  animation: rotate 20s linear infinite;
}

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

.shaking {
  animation: shake 0.5s ease-in-out;
}

/* Typewriter Animation */
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

.typewriter {
  overflow: hidden;
  border-right: 3px solid var(--color-primary);
  white-space: nowrap;
  animation: typewriter 3s steps(40, end), blink 0.75s step-end infinite;
}

/* Morph Animation */
@keyframes morph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}

.morphing {
  animation: morph 8s ease-in-out infinite;
}

/* Particle Animation */
@keyframes particles {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-1000px) rotate(720deg);
    opacity: 0;
  }
}

.particle {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  animation: particles 10s linear infinite;
}

/* Wave Animation */
@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(20deg); }
  75% { transform: rotate(-20deg); }
}

.waving {
  animation: wave 2s ease-in-out infinite;
  transform-origin: 70% 70%;
}

/* Heartbeat Animation */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  10%, 30% { transform: scale(0.9); }
  20%, 40%, 60%, 80% { transform: scale(1.1); }
  50%, 70% { transform: scale(1.05); }
}

.heartbeat {
  animation: heartbeat 2s ease-in-out infinite;
}

/* Loading Animation */
@keyframes loading {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner {
  border: 3px solid var(--color-gray-300);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: loading 1s linear infinite;
}

/* Progress Animation */
@keyframes progress {
  from { width: 0%; }
  to { width: 100%; }
}

.progress-bar {
  height: 4px;
  background: var(--gradient-primary);
  border-radius: 2px;
  animation: progress 2s ease-out;
}

/* Stagger Animation Classes */
.stagger-fade-in > * {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-fade-in > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-fade-in > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-fade-in > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-fade-in > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-fade-in > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-fade-in > *:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Magnetic Effect */
.magnetic {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Parallax Effect */
.parallax {
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

/* Glow Text Animation */
@keyframes glowText {
  0%, 100% { 
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5),
                 0 0 20px rgba(59, 130, 246, 0.3),
                 0 0 30px rgba(59, 130, 246, 0.2);
  }
  50% { 
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.8),
                 0 0 30px rgba(59, 130, 246, 0.6),
                 0 0 40px rgba(59, 130, 246, 0.4);
  }
}

.glow-text {
  animation: glowText 3s ease-in-out infinite;
}

/* Shimmer Effect */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.shimmer {
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.3) 50%, 
    transparent 100%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite;
}

/* Elastic Scale */
@keyframes elasticScale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.elastic {
  animation: elasticScale 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Animation Utilities */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hover Animations */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hover-lift:hover {
  transform: translateY(-10px);
}

.hover-grow {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

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

/* Performance Optimizations */
.gpu-accelerated {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

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

.will-change-opacity {
  will-change: opacity;
}
