/*
 * SWARM Animation Library
 * Professional animations inspired by Solana
 * Version 1.0.0
 */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Fade Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@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);
  }
}

/* Scale Animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* Slide Animations */
@keyframes slideInUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

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

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Glow Animations */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.6);
  }
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.3),
                0 0 40px rgba(0, 229, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.5),
                0 0 60px rgba(0, 229, 255, 0.3);
  }
}

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

/* Spin Animations */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Bounce Animations */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

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

@keyframes pulseSoft {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

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

/* Gradient Shift */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Fade Classes */
.animate-fade-in {
  animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-out {
  animation: fadeOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Scale Classes */
.animate-scale-in {
  animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-out {
  animation: scaleOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Slide Classes */
.animate-slide-in-up {
  animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-in-down {
  animation: slideInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-in-left {
  animation: slideInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Glow Classes */
.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

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

/* Shimmer Effect */
.animate-shimmer {
  background: linear-gradient(
    90deg,
    rgba(183, 189, 198, 0.05) 0%,
    rgba(0, 229, 255, 0.2) 50%,
    rgba(183, 189, 198, 0.05) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 3s infinite;
}

/* Spin Classes */
.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-spin-slow {
  animation: spinSlow 3s linear infinite;
}

/* Bounce Classes */
.animate-bounce {
  animation: bounce 1s ease-in-out infinite;
}

.animate-bounce-in {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* Pulse Classes */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-pulse-soft {
  animation: pulseSoft 2s ease-in-out infinite;
}

/* Float Class */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Gradient Shift */
.animate-gradient {
  background: linear-gradient(
    270deg,
    #00E5FF,
    #00AAFF,
    #18DC7E,
    #00E5FF
  );
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
}

/* ============================================
   ANIMATION DELAYS
   ============================================ */

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ============================================
   HOVER EFFECTS
   ============================================ */

/* Lift Effect */
.hover-lift {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2),
              0 0 30px rgba(0, 229, 255, 0.3);
}

/* Glow Effect */
.hover-glow {
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.5),
              0 0 60px rgba(0, 229, 255, 0.3);
}

/* Scale Effect */
.hover-scale {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.hover-scale-sm:hover {
  transform: scale(1.02);
}

.hover-scale-lg:hover {
  transform: scale(1.1);
}

/* Brightness Effect */
.hover-brighten {
  transition: filter 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-brighten:hover {
  filter: brightness(1.2);
}

/* Border Glow Effect */
.hover-border-glow {
  transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-border-glow:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
}

/* Rotate Effect */
.hover-rotate {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

/* Slide Effect */
.hover-slide-right {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-slide-right:hover {
  transform: translateX(5px);
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

/* Elements hidden by default for scroll reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* ============================================
   MICRO-INTERACTIONS
   ============================================ */

/* Button Press */
.active-press:active {
  transform: scale(0.95);
}

/* Ripple Effect Container */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.3);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(183, 189, 198, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(183, 189, 198, 0.05) 0%,
    rgba(183, 189, 198, 0.1) 50%,
    rgba(183, 189, 198, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

/* ============================================
   TRANSITION UTILITIES
   ============================================ */

.transition-all {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-colors {
  transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-transform {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.transition-opacity {
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Duration Utilities */
.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }
.duration-700 { transition-duration: 700ms; }
.duration-1000 { transition-duration: 1000ms; }

/* Timing Functions */
.ease-linear { transition-timing-function: linear; }
.ease-in { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Force GPU acceleration for smooth animations */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

/* ============================================
   ENHANCED CARD 3D TILT
   ============================================ */

.card-3d-tilt {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
  transform-style: preserve-3d;
}

.card-3d-tilt:hover {
  transform: perspective(800px) rotateX(2deg) rotateY(-2deg) translateY(-6px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 229, 255, 0.1);
}

/* ============================================
   COUNTER / TICKER ANIMATION
   ============================================ */

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

.animate-count-up {
  animation: countUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   NEON BORDER ANIMATION
   ============================================ */

@keyframes neonBorderGlow {
  0%, 100% { border-color: rgba(0, 229, 255, 0.3); box-shadow: 0 0 10px rgba(0, 229, 255, 0.1); }
  33% { border-color: rgba(147, 51, 234, 0.3); box-shadow: 0 0 10px rgba(147, 51, 234, 0.1); }
  66% { border-color: rgba(0, 170, 255, 0.3); box-shadow: 0 0 10px rgba(0, 170, 255, 0.1); }
}

.animate-neon-border {
  animation: neonBorderGlow 6s ease-in-out infinite;
}

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