/* =============================================================================
   BlocHost Design System - Animations
   Transitions, keyframes, and animation utilities
   ============================================================================= */

/* =========================================================================
   Transition Utilities
   ========================================================================= */

.transition-none { transition: none !important; }
.transition-all { transition: all var(--transition-normal) !important; }
.transition-colors { transition: color var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal) !important; }
.transition-opacity { transition: opacity var(--transition-normal) !important; }
.transition-shadow { transition: box-shadow var(--transition-normal) !important; }
.transition-transform { transition: transform var(--transition-normal) !important; }

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

/* Transition timing functions */
.ease-linear { transition-timing-function: linear !important; }
.ease-in { transition-timing-function: ease-in !important; }
.ease-out { transition-timing-function: ease-out !important; }
.ease-in-out { transition-timing-function: ease-in-out !important; }

/* =========================================================================
   Animation Utilities
   ========================================================================= */

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

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

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

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

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

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

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

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

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

/* =========================================================================
   Fade Animations
   ========================================================================= */

.fade-in {
  animation: fadeIn var(--transition-normal) ease-out forwards;
}

.fade-out {
  animation: fadeOut var(--transition-normal) ease-out forwards;
}

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

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

/* Fade with direction */
.fade-in-up {
  animation: fadeInUp var(--transition-slow) ease-out forwards;
}

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

.fade-in-left {
  animation: fadeInLeft var(--transition-slow) ease-out forwards;
}

.fade-in-right {
  animation: fadeInRight var(--transition-slow) ease-out forwards;
}

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

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

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

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

/* =========================================================================
   Scale Animations
   ========================================================================= */

.scale-in {
  animation: scaleIn var(--transition-normal) ease-out forwards;
}

.scale-out {
  animation: scaleOut var(--transition-normal) ease-out forwards;
}

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

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* =========================================================================
   Slide Animations
   ========================================================================= */

.slide-in-top {
  animation: slideInTop var(--transition-slow) ease-out forwards;
}

.slide-in-bottom {
  animation: slideInBottom var(--transition-slow) ease-out forwards;
}

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

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

@keyframes slideInTop {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes slideInBottom {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* Slide out */
.slide-out-top {
  animation: slideOutTop var(--transition-slow) ease-in forwards;
}

.slide-out-bottom {
  animation: slideOutBottom var(--transition-slow) ease-in forwards;
}

@keyframes slideOutTop {
  from { transform: translateY(0); }
  to { transform: translateY(-100%); }
}

@keyframes slideOutBottom {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

/* =========================================================================
   Shake Animation
   ========================================================================= */

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

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

/* =========================================================================
   Wobble Animation
   ========================================================================= */

.wobble {
  animation: wobble 1s ease-in-out;
}

@keyframes wobble {
  0%, 100% { transform: translateX(0) rotate(0); }
  15% { transform: translateX(-10px) rotate(-5deg); }
  30% { transform: translateX(8px) rotate(3deg); }
  45% { transform: translateX(-6px) rotate(-3deg); }
  60% { transform: translateX(4px) rotate(2deg); }
  75% { transform: translateX(-2px) rotate(-1deg); }
}

/* =========================================================================
   Attention Seekers
   ========================================================================= */

/* Heartbeat */
.heartbeat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}

/* Flash */
.flash {
  animation: flash 1s ease-in-out;
}

@keyframes flash {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

/* Rubber band */
.rubber-band {
  animation: rubberBand 1s ease-in-out;
}

@keyframes rubberBand {
  0% { transform: scaleX(1); }
  30% { transform: scaleX(1.25) scaleY(0.75); }
  40% { transform: scaleX(0.75) scaleY(1.25); }
  50% { transform: scaleX(1.15) scaleY(0.85); }
  65% { transform: scaleX(0.95) scaleY(1.05); }
  75% { transform: scaleX(1.05) scaleY(0.95); }
  100% { transform: scaleX(1); }
}

/* =========================================================================
   Loading Animations
   ========================================================================= */

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-gray-lighter) 25%,
    var(--color-light) 50%,
    var(--color-gray-lighter) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: var(--radius-md);
}

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

/* Loading dots */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background-color: var(--color-primary);
  border-radius: 50%;
  animation: loadingDot 1.4s infinite ease-in-out both;
}

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

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

/* =========================================================================
   Transform Utilities
   ========================================================================= */

/* Scale on hover */
.hover-scale:hover {
  transform: scale(1.05);
}

.hover-scale-sm:hover {
  transform: scale(1.02);
}

.hover-scale-lg:hover {
  transform: scale(1.1);
}

/* Lift on hover */
.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

/* Rotate on hover */
.hover-rotate:hover {
  transform: rotate(3deg);
}

/* =========================================================================
   Animation Delays
   ========================================================================= */

.delay-75 { animation-delay: 75ms; }
.delay-100 { animation-delay: 100ms; }
.delay-150 { animation-delay: 150ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }
.delay-700 { animation-delay: 700ms; }
.delay-1000 { animation-delay: 1000ms; }

/* =========================================================================
   Animation Play State
   ========================================================================= */

.animate-paused { animation-play-state: paused !important; }
.animate-running { animation-play-state: running !important; }

/* =========================================================================
   Animation Fill Mode
   ========================================================================= */

.animate-fill-none { animation-fill-mode: none !important; }
.animate-fill-forwards { animation-fill-mode: forwards !important; }
.animate-fill-backwards { animation-fill-mode: backwards !important; }
.animate-fill-both { animation-fill-mode: both !important; }

/* =========================================================================
   Animation Iteration
   ========================================================================= */

.animate-once { animation-iteration-count: 1 !important; }
.animate-infinite { animation-iteration-count: infinite !important; }

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

@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;
  }
  
  .animate-spin,
  .animate-ping,
  .animate-pulse,
  .animate-bounce {
    animation: none !important;
  }
}
