/* ============================================
   PAGE & VIEW TRANSITIONS
   ============================================ */

/* View entrance animation */
.view-enter {
  animation: fadeSlideIn var(--duration-slow) var(--ease-out);
}

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

/* View exit animation (for future use) */
.view-exit {
  animation: fadeSlideOut var(--duration-normal) var(--ease-out);
}

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

/* ============================================
   STAGGERED LIST ANIMATIONS
   ============================================ */

/* Workout cards stagger */
.workout-card {
  animation: fadeSlideIn var(--duration-slow) var(--ease-out) backwards;
}

.workout-card:nth-child(1) { animation-delay: 0ms; }
.workout-card:nth-child(2) { animation-delay: 40ms; }
.workout-card:nth-child(3) { animation-delay: 80ms; }
.workout-card:nth-child(4) { animation-delay: 120ms; }
.workout-card:nth-child(5) { animation-delay: 160ms; }
.workout-card:nth-child(6) { animation-delay: 200ms; }
.workout-card:nth-child(7) { animation-delay: 240ms; }
.workout-card:nth-child(8) { animation-delay: 280ms; }
.workout-card:nth-child(9) { animation-delay: 320ms; }
.workout-card:nth-child(10) { animation-delay: 360ms; }
.workout-card:nth-child(n+11) { animation-delay: 400ms; }

/* Stat cards stagger */
.stat-card {
  animation: fadeSlideIn var(--duration-slow) var(--ease-out) backwards;
}

.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 60ms; }
.stat-card:nth-child(3) { animation-delay: 120ms; }
.stat-card:nth-child(4) { animation-delay: 180ms; }

/* ============================================
   SCALE ANIMATIONS
   ============================================ */

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-enter {
  animation: scaleIn var(--duration-normal) var(--ease-out);
}

/* Pop animation for buttons and interactive elements */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pop {
  animation: pop var(--duration-normal) var(--ease-spring);
}

/* ============================================
   FADE ANIMATIONS
   ============================================ */

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

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

.fade-enter {
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

.fade-exit {
  animation: fadeOut var(--duration-normal) var(--ease-out);
}

/* ============================================
   PULSE ANIMATION (for loading states)
   ============================================ */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse {
  animation: pulse 2s var(--ease-in-out) infinite;
}

/* ============================================
   SHIMMER EFFECT (for skeleton loading)
   ============================================ */

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

.shimmer {
  background: linear-gradient(
    90deg,
    var(--color-gray-200) 0%,
    var(--color-gray-100) 50%,
    var(--color-gray-200) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ============================================
   BOUNCE ANIMATION
   ============================================ */

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.bounce {
  animation: bounce 0.6s var(--ease-spring);
}

/* ============================================
   SHAKE ANIMATION (for errors)
   ============================================ */

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

.shake {
  animation: shake 0.5s var(--ease-out);
}

/* ============================================
   SLIDE ANIMATIONS
   ============================================ */

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

.slide-in-right { animation: slideInRight var(--duration-slow) var(--ease-out); }
.slide-in-left { animation: slideInLeft var(--duration-slow) var(--ease-out); }
.slide-in-up { animation: slideInUp var(--duration-slow) var(--ease-out); }
.slide-in-down { animation: slideInDown var(--duration-slow) var(--ease-out); }

/* ============================================
   CHART ANIMATIONS
   ============================================ */

@keyframes barGrow {
  from {
    transform: scaleY(0);
    transform-origin: bottom;
  }
  to {
    transform: scaleY(1);
    transform-origin: bottom;
  }
}

.chart-bar-enter {
  animation: barGrow var(--duration-slower) var(--ease-out);
}

/* ============================================
   NUMBER COUNT ANIMATION
   ============================================ */

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

.count-up {
  animation: countUp var(--duration-normal) var(--ease-out);
}

/* ============================================
   LOADING DOT ANIMATION
   ============================================ */

@keyframes loadingDots {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.loading-dots span {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: var(--color-accent-primary);
  border-radius: var(--radius-full);
  animation: loadingDots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ============================================
   HOVER LIFT UTILITY
   ============================================ */

.hover-lift {
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lifted);
}

/* ============================================
   REDUCED MOTION - Override all animations
   ============================================ */

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

  .workout-card,
  .stat-card {
    animation: none !important;
  }

  .shimmer,
  .skeleton {
    animation: none !important;
    background: var(--color-gray-200) !important;
  }

  .loading-dots span {
    animation: none !important;
  }
}
