/* ==========================================================================
   ANIMATIONS - Keyframes & Animation Utilities
   ========================================================================== */

/* ==========================================================================
   CARD ANIMATIONS
   ========================================================================== */

@keyframes cardIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-in {
  animation: cardIn var(--duration-normal) var(--ease-spring) forwards;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

/* Stagger children - automatic delays based on child index */
.stagger-children > *:nth-child(1) { --delay: 0s; }
.stagger-children > *:nth-child(2) { --delay: 0.05s; }
.stagger-children > *:nth-child(3) { --delay: 0.1s; }
.stagger-children > *:nth-child(4) { --delay: 0.15s; }
.stagger-children > *:nth-child(5) { --delay: 0.2s; }
.stagger-children > *:nth-child(6) { --delay: 0.25s; }
.stagger-children > *:nth-child(7) { --delay: 0.3s; }
.stagger-children > *:nth-child(8) { --delay: 0.35s; }
.stagger-children > *:nth-child(9) { --delay: 0.4s; }
.stagger-children > *:nth-child(10) { --delay: 0.45s; }

/* ==========================================================================
   VIEW TRANSITIONS
   ========================================================================== */

@keyframes viewFadeIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes viewFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.view-enter {
  animation: viewFadeIn var(--duration-normal) var(--ease-out) forwards;
}

.view-exit {
  animation: viewFadeOut var(--duration-fast) var(--ease-out) forwards;
}

/* ==========================================================================
   PULSE / LIVE INDICATOR
   ========================================================================== */

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.1);
  }
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--positive);
  border-radius: 50%;
  animation: pulse 2s var(--ease-out) infinite;
}

.live-dot-warning {
  background: var(--warning);
}

.live-dot-negative {
  background: var(--negative);
}

/* ==========================================================================
   ACCESSIBILITY - Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-in {
    opacity: 1;
    transform: none;
  }

  .view-enter,
  .view-exit {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .live-dot {
    animation: none;
  }
}

/* ==========================================================================
   UTILITY ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
}

.fade-out {
  animation: fadeOut var(--duration-fast) var(--ease-out) forwards;
}

.slide-up {
  animation: slideUp var(--duration-normal) var(--ease-spring) forwards;
}

.slide-down {
  animation: slideDown var(--duration-normal) var(--ease-spring) forwards;
}
