/**
 * RADEXEL Design System - Animations & Transitions
 *
 * Keyframe definitions and utility classes for motion.
 * All animations respect prefers-reduced-motion.
 */

/* ==========================================================================
   Keyframes
   ========================================================================== */

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

/* Fade In + slide Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In + slide Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade Out */
@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Fade Out + slide Down */
@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

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

/* Slide Out to Left */
@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-100%);
  }
}

/* Slide In from Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide Out to Right */
@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Scale In (modal / popover) */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Scale Out */
@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* Skeleton Pulse (gradient shimmer) */
@keyframes skeletonPulse {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

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

/* Pulse (status indicators) */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

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

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

/* Typing dots */
@keyframes typingDot {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

/* Progress bar indeterminate */
@keyframes progressIndeterminate {
  0% {
    left: -30%;
    width: 30%;
  }
  50% {
    width: 50%;
  }
  100% {
    left: 100%;
    width: 30%;
  }
}

/* Toast auto-dismiss progress */
@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}


/* ==========================================================================
   Animation Utility Classes
   ========================================================================== */

.animate-fade-in {
  animation: fadeIn var(--duration-base) var(--ease-out) forwards;
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
}

.animate-fade-in-down {
  animation: fadeInDown var(--duration-slow) var(--ease-out) forwards;
}

.animate-fade-out {
  animation: fadeOut var(--duration-base) var(--ease-in) forwards;
}

.animate-slide-in-left {
  animation: slideInLeft var(--duration-slow) var(--ease-out) forwards;
}

.animate-slide-in-right {
  animation: slideInRight var(--duration-slow) var(--ease-out) forwards;
}

.animate-slide-out-left {
  animation: slideOutLeft var(--duration-slow) var(--ease-in) forwards;
}

.animate-slide-out-right {
  animation: slideOutRight var(--duration-slow) var(--ease-in) forwards;
}

.animate-scale-in {
  animation: scaleIn var(--duration-base) var(--ease-out) forwards;
}

.animate-scale-out {
  animation: scaleOut var(--duration-base) var(--ease-in) forwards;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-pulse {
  animation: pulse 2s var(--ease-default) infinite;
}

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

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


/* ==========================================================================
   Staggered Entrance (for lists)
   ========================================================================== */

.stagger-children > * {
  opacity: 0;
  animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.stagger-children > *:nth-child(8) { animation-delay: 350ms; }
.stagger-children > *:nth-child(9) { animation-delay: 400ms; }
.stagger-children > *:nth-child(10) { animation-delay: 450ms; }


/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .animate-fade-in,
  .animate-fade-in-up,
  .animate-fade-in-down,
  .animate-fade-out,
  .animate-slide-in-left,
  .animate-slide-in-right,
  .animate-slide-out-left,
  .animate-slide-out-right,
  .animate-scale-in,
  .animate-scale-out,
  .animate-bounce,
  .animate-shake {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .animate-spin {
    animation: none !important;
  }

  .animate-pulse {
    animation: none !important;
    opacity: 1 !important;
  }

  .stagger-children > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
