/* Shared animations - Keyframe animations used across multiple components */
/* MUST load BEFORE any component CSS that uses these animations */

/* ============================================================================
   T042: REDUCED MOTION SUPPORT
   ============================================================================ */
/* Respect user preferences for reduced motion - accessibility requirement */
@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;
  }
}

/* ============================================================================
   T043: SMOOTH SCROLL BEHAVIOR
   ============================================================================ */
html {
  scroll-behavior: smooth;
}

/* Override smooth scroll for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ============================================================================
   EXISTING ANIMATIONS (preserved from original file)
   ============================================================================ */

/* Spinner rotation for loading states */
@keyframes spinner-rotate {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Slide-in animation for notifications */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade-in animation for general use */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Fade-in from top for no-content message */
@keyframes fadeInTop {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ============================================================================
   T044: FADE IN UP ANIMATION
   ============================================================================ */
/* Hardware-accelerated entrance animation using transform and opacity only */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Utility class for fade-in-up animation */
.fade-in-up {
  animation: fadeInUp var(--duration-slow) var(--ease-in-out-smooth) both;
}

/* ============================================================================
   T045: STAGGERED ANIMATIONS FOR LISTS
   ============================================================================ */
/* Apply fade-in-up to all children with staggered delays */
.stagger-children > * {
  animation: fadeInUp var(--duration-slow) var(--ease-in-out-smooth) both;
}

/* Stagger delays for first 12 items (75ms intervals) */
.stagger-children > *:nth-child(1)  { animation-delay: 0ms; }
.stagger-children > *:nth-child(2)  { animation-delay: 75ms; }
.stagger-children > *:nth-child(3)  { animation-delay: 150ms; }
.stagger-children > *:nth-child(4)  { animation-delay: 225ms; }
.stagger-children > *:nth-child(5)  { animation-delay: 300ms; }
.stagger-children > *:nth-child(6)  { animation-delay: 375ms; }
.stagger-children > *:nth-child(7)  { animation-delay: 450ms; }
.stagger-children > *:nth-child(8)  { animation-delay: 525ms; }
.stagger-children > *:nth-child(9)  { animation-delay: 600ms; }
.stagger-children > *:nth-child(10) { animation-delay: 675ms; }
.stagger-children > *:nth-child(11) { animation-delay: 750ms; }
.stagger-children > *:nth-child(12) { animation-delay: 825ms; }

/* ============================================================================
   T046: HOVER UTILITY CLASSES
   ============================================================================ */

/* Hover Lift - Elevates element on hover */
.hover-lift {
  transition: transform var(--duration-normal) var(--ease-in-out-smooth);
}

.hover-lift:hover {
  transform: translateY(-4px);
}

/* Hover Glow - Adds shadow glow on hover */
.hover-glow {
  transition: box-shadow var(--duration-normal) var(--ease-in-out-smooth);
}

.hover-glow:hover {
  box-shadow: var(--shadow-xl), var(--shadow-colored);
}

/* Hover Scale - Slightly enlarges element on hover */
.hover-scale {
  transition: transform var(--duration-normal) var(--ease-in-out-smooth);
}

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

/* Combined hover effects */
.hover-lift-glow {
  transition:
    transform var(--duration-normal) var(--ease-in-out-smooth),
    box-shadow var(--duration-normal) var(--ease-in-out-smooth);
}

.hover-lift-glow:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl), var(--shadow-colored);
}

/* ============================================================================
   T047: LOADING SKELETON SHIMMER (OPTIONAL)
   ============================================================================ */

/* Shimmer animation for skeleton loading states */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Skeleton loading class */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-border-subtle) 0%,
    var(--color-bg-elevated) 50%,
    var(--color-border-subtle) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  border-radius: 0.25rem;
}

/* Skeleton variants for different element types */
.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  border-radius: 0.25rem;
}

.skeleton-heading {
  height: 2rem;
  width: 60%;
  margin-bottom: 1rem;
  border-radius: 0.25rem;
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

.skeleton-card {
  height: 200px;
  border-radius: 1rem;
}

/* ============================================================================
   ADDITIONAL UTILITY ANIMATIONS
   ============================================================================ */

/* Pulse animation for loading indicators */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* Bounce animation for attention-grabbing elements */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

.animate-bounce {
  animation: bounce 1s infinite;
}

/* Spin animation for loading spinners */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

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

.slide-in-right {
  animation: slideInRight var(--duration-normal) var(--ease-in-out-smooth) both;
}

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

.slide-in-left {
  animation: slideInLeft var(--duration-normal) var(--ease-in-out-smooth) both;
}

/* Fade in scale (zoom in) */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fade-in-scale {
  animation: fadeInScale var(--duration-normal) var(--ease-in-out-smooth) both;
}

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

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

/* ============================================================================
   PERFORMANCE NOTES
   ============================================================================ */
/*
 * All animations use hardware-accelerated properties (transform, opacity)
 * to maintain 60fps performance.
 *
 * Animations respect prefers-reduced-motion for accessibility.
 *
 * Animation tokens from themes.css are used for consistent timing:
 *   - --duration-fast: 150ms
 *   - --duration-normal: 250ms
 *   - --duration-slow: 350ms
 *   - --ease-in-out-smooth: cubic-bezier(0.4, 0, 0.2, 1)
 *   - --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55)
 */
