/**
 * ProRank Design System - Animation Utilities
 * 
 * Reusable animations and transitions for smooth user interactions.
 * Includes entrance, exit, and attention-seeking animations.
 * 
 * @module utilities/animations
 * @since 3.0.0
 */

/* ============================================
   TRANSITION UTILITIES
   Control transition properties
   ============================================ */

.prorank-transition-none {
  transition: none !important;
}

.prorank-transition-all {
  transition: all var(--prorank-transition-duration) var(--prorank-transition-timing) !important;
}

.prorank-transition-colors {
  transition: background-color var(--prorank-transition-duration) var(--prorank-transition-timing),
              border-color var(--prorank-transition-duration) var(--prorank-transition-timing),
              color var(--prorank-transition-duration) var(--prorank-transition-timing) !important;
}

.prorank-transition-opacity {
  transition: opacity var(--prorank-transition-duration) var(--prorank-transition-timing) !important;
}

.prorank-transition-transform {
  transition: transform var(--prorank-transition-duration) var(--prorank-transition-timing) !important;
}

/* Transition Duration */
.prorank-duration-75 { transition-duration: 75ms !important; }
.prorank-duration-100 { transition-duration: 100ms !important; }
.prorank-duration-150 { transition-duration: 150ms !important; }
.prorank-duration-200 { transition-duration: 200ms !important; }
.prorank-duration-300 { transition-duration: 300ms !important; }
.prorank-duration-500 { transition-duration: 500ms !important; }
.prorank-duration-700 { transition-duration: 700ms !important; }
.prorank-duration-1000 { transition-duration: 1000ms !important; }

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

/* ============================================
   ENTRANCE ANIMATIONS
   Animations for elements entering the view
   ============================================ */

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

.prorank-animate-fadeIn {
  animation: prorank-fadeIn 0.3s ease-out;
}

/* Fade In Up */
@keyframes prorank-fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.prorank-animate-fadeInUp {
  animation: prorank-fadeInUp 0.3s ease-out;
}

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

.prorank-animate-fadeInDown {
  animation: prorank-fadeInDown 0.3s ease-out;
}

/* Fade In Left */
@keyframes prorank-fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.prorank-animate-fadeInLeft {
  animation: prorank-fadeInLeft 0.3s ease-out;
}

/* Fade In Right */
@keyframes prorank-fadeInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.prorank-animate-fadeInRight {
  animation: prorank-fadeInRight 0.3s ease-out;
}

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

.prorank-animate-scaleIn {
  animation: prorank-scaleIn 0.2s ease-out;
}

/* Slide In */
@keyframes prorank-slideIn {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.prorank-animate-slideIn {
  animation: prorank-slideIn 0.3s ease-out;
}

/* ============================================
   EXIT ANIMATIONS
   Animations for elements leaving the view
   ============================================ */

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

.prorank-animate-fadeOut {
  animation: prorank-fadeOut 0.3s ease-out forwards;
}

/* Fade Out Up */
@keyframes prorank-fadeOutUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.prorank-animate-fadeOutUp {
  animation: prorank-fadeOutUp 0.3s ease-out forwards;
}

/* Fade Out Down */
@keyframes prorank-fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

.prorank-animate-fadeOutDown {
  animation: prorank-fadeOutDown 0.3s ease-out forwards;
}

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

.prorank-animate-scaleOut {
  animation: prorank-scaleOut 0.2s ease-out forwards;
}

/* ============================================
   ATTENTION ANIMATIONS
   Animations to draw attention to elements
   ============================================ */

/* Pulse */
@keyframes prorank-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* Bounce */
@keyframes prorank-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);
  }
}

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

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

.prorank-animate-shake {
  animation: prorank-shake 0.5s;
}

/* Wiggle */
@keyframes prorank-wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(3deg);
  }
  75% {
    transform: rotate(-3deg);
  }
}

.prorank-animate-wiggle {
  animation: prorank-wiggle 0.3s ease-in-out;
}

/* Flash */
@keyframes prorank-flash {
  0%, 50%, 100% {
    opacity: 1;
  }
  25%, 75% {
    opacity: 0;
  }
}

.prorank-animate-flash {
  animation: prorank-flash 1s;
}

/* ============================================
   LOADING ANIMATIONS
   Animations for loading states
   ============================================ */

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

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

/* Ping */
@keyframes prorank-ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

.prorank-animate-ping {
  animation: prorank-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* Loading Dots */
@keyframes prorank-dots {
  0%, 80%, 100% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
}

.prorank-animate-dots > * {
  animation: prorank-dots 1.4s infinite;
}

.prorank-animate-dots > *:nth-child(2) {
  animation-delay: 0.2s;
}

.prorank-animate-dots > *:nth-child(3) {
  animation-delay: 0.4s;
}

/* Skeleton Loading */
@keyframes prorank-shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.prorank-animate-shimmer {
  background: linear-gradient(
    90deg,
    var(--prorank-bg-tertiary) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    var(--prorank-bg-tertiary) 100%
  );
  background-size: 1000px 100%;
  animation: prorank-shimmer 2s infinite;
}

/* ============================================
   HOVER ANIMATIONS
   Animations triggered on hover
   ============================================ */

.prorank-hover-grow {
  transition: transform 0.2s ease;
}

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

.prorank-hover-shrink {
  transition: transform 0.2s ease;
}

.prorank-hover-shrink:hover {
  transform: scale(0.95);
}

.prorank-hover-rotate {
  transition: transform 0.2s ease;
}

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

.prorank-hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.prorank-hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--prorank-shadow-lg);
}

/* ============================================
   SPECIAL EFFECTS
   Premium animations and effects
   ============================================ */

/* Gradient Wave (ProRank Signature) */
@keyframes prorank-wave {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.prorank-animate-wave {
  background: var(--prorank-gradient-animated);
  background-size: 200% 200%;
  animation: prorank-wave 3s ease infinite;
}

/* Glow Effect */
@keyframes prorank-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(37, 99, 235, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.8);
  }
}

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

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

.prorank-animate-float {
  animation: prorank-float 3s ease-in-out infinite;
}

/* ============================================
   ANIMATION UTILITIES
   Control animation behavior
   ============================================ */

/* Animation Delay */
.prorank-delay-100 { animation-delay: 100ms !important; }
.prorank-delay-200 { animation-delay: 200ms !important; }
.prorank-delay-300 { animation-delay: 300ms !important; }
.prorank-delay-500 { animation-delay: 500ms !important; }
.prorank-delay-1000 { animation-delay: 1000ms !important; }

/* Animation Duration */
.prorank-animation-duration-100 { animation-duration: 100ms !important; }
.prorank-animation-duration-200 { animation-duration: 200ms !important; }
.prorank-animation-duration-300 { animation-duration: 300ms !important; }
.prorank-animation-duration-500 { animation-duration: 500ms !important; }
.prorank-animation-duration-1000 { animation-duration: 1000ms !important; }
.prorank-animation-duration-2000 { animation-duration: 2000ms !important; }

/* Animation Fill Mode */
.prorank-animation-fill-none { animation-fill-mode: none !important; }
.prorank-animation-fill-forwards { animation-fill-mode: forwards !important; }
.prorank-animation-fill-backwards { animation-fill-mode: backwards !important; }
.prorank-animation-fill-both { animation-fill-mode: both !important; }

/* Animation Play State */
.prorank-animation-running { animation-play-state: running !important; }
.prorank-animation-paused { animation-play-state: paused !important; }

/* ============================================
   RESPONSIVE ANIMATIONS
   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;
    scroll-behavior: auto !important;
  }
  
  .prorank-animate-spin {
    animation: prorank-spin 1.5s linear infinite;
  }
}