/**
 * BUMPd Web Animation Utilities
 * Centralized animation classes with accessibility and performance considerations
 */

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Ripple Effect for Buttons */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--color-white-alpha-30);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

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

/* Staggered Fade-in Animation */
.fade-in-stagger {
  opacity: 0;
  transform: translateY(20px);
}

.fade-in-stagger.visible {
  animation: fade-in-up var(--motion-duration-lg) var(--motion-ease-standard) forwards;
}

.fade-in-stagger:nth-child(1) { animation-delay: 0ms; }
.fade-in-stagger:nth-child(2) { animation-delay: 50ms; }
.fade-in-stagger:nth-child(3) { animation-delay: 100ms; }
.fade-in-stagger:nth-child(4) { animation-delay: 150ms; }
.fade-in-stagger:nth-child(5) { animation-delay: 200ms; }
.fade-in-stagger:nth-child(6) { animation-delay: 250ms; }

@keyframes fade-in-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In Animations */
.slide-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all var(--motion-duration-lg) var(--motion-ease-standard);
}

.slide-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all var(--motion-duration-lg) var(--motion-ease-standard);
}

.slide-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Scale Bounce */
@keyframes scale-bounce {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.scale-bounce {
  animation: scale-bounce var(--motion-duration-md) var(--motion-ease-standard);
}

/* CSS Spinner Fallback */
.css-spinner-fallback {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--color-coral-alpha-30);
  border-radius: 50%;
  border-top-color: var(--color-coral);
  animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Lottie Container Styles */
.lottie-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lottie-container--small {
  width: 40px;
  height: 40px;
}

.lottie-container--medium {
  width: 80px;
  height: 80px;
}

.lottie-container--large {
  width: 120px;
  height: 120px;
}

/* Success Animation Container */
.success-animation {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  margin-block: var(--spacing-md);
  margin-inline: 0;
}

/* Parallax Effect Base */
.parallax-container {
  position: relative;
  overflow: hidden;
}

.parallax-element {
  transition: transform var(--motion-duration-lg) var(--motion-ease-standard);
}

/* Smooth Height Transitions */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--motion-duration-lg) var(--motion-ease-standard);
}

.accordion-content.expanded {
  max-height: 2000px; /* Adjust based on content */
}

/* Toast Notification Animations */
@keyframes slide-in-from-right {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-out-to-right {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast {
  animation: slide-in-from-right var(--motion-duration-md) var(--motion-ease-standard);
}

.toast.removing {
  animation: slide-out-to-right var(--motion-duration-md) var(--motion-ease-standard);
}

/* Loading Pulse */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Attention Grabber */
@keyframes attention-grab {
  0%, 100% {
    transform: scale(1);
  }

  10%, 30% {
    transform: scale(0.95);
  }

  20% {
    transform: scale(1.05);
  }
}

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

/* Glow Effect */
@keyframes glow {
  0%, 100% {
    box-shadow: var(--shadow-default);
  }

  50% {
    box-shadow: var(--shadow-elevated);
  }
}


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