/* Mobile-Optimized Animations - Performance First */

/* Base animation setup */
.observe-viewport {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease-out;
}

.observe-viewport.in-viewport {
  opacity: 1;
  transform: translateY(0);
}

/* Fade in animation */
.animate-fadeIn {
  animation: fadeIn 0.3s ease-out forwards;
}

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

/* Slide in from left */
.animate-slideInLeft {
  animation: slideInLeft 0.3s ease-out forwards;
}

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

/* Slide in from right */
.animate-slideInRight {
  animation: slideInRight 0.3s ease-out forwards;
}

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

/* Scale in animation */
.animate-scaleIn {
  animation: scaleIn 0.3s ease-out forwards;
}

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

/* Touch feedback */
.touch-feedback {
  transform: scale(0.98);
  transition: transform 0.1s ease-out;
}

/* Loading pulse */
.loading-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* Swipe indicators */
.swipe-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
  pointer-events: none;
}

.swipe-indicator.left {
  left: 10px;
  animation: swipeLeft 0.5s ease-out;
}

.swipe-indicator.right {
  right: 10px;
  animation: swipeRight 0.5s ease-out;
}

@keyframes swipeLeft {
  0% {
    opacity: 0;
    transform: translateY(-50%) translateX(20px);
  }
  50% {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%) translateX(-20px);
  }
}

@keyframes swipeRight {
  0% {
    opacity: 0;
    transform: translateY(-50%) translateX(-20px);
  }
  50% {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%) translateX(20px);
  }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
  /* Reduce animation duration for better performance */
  .observe-viewport,
  .animate-fadeIn,
  .animate-slideInLeft,
  .animate-slideInRight,
  .animate-scaleIn {
    animation-duration: 0.2s;
    transition-duration: 0.2s;
  }
  
  /* Disable complex animations on low-end devices */
  @media (max-resolution: 1dppx) {
    .observe-viewport,
    .animate-fadeIn,
    .animate-slideInLeft,
    .animate-slideInRight,
    .animate-scaleIn {
      animation: none;
      transition: none;
      opacity: 1;
      transform: none;
    }
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .observe-viewport,
  .animate-fadeIn,
  .animate-slideInLeft,
  .animate-slideInRight,
  .animate-scaleIn,
  .touch-feedback,
  .loading-pulse {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .loading-pulse {
    animation: none;
  }
  
  .swipe-indicator {
    border: 2px solid currentColor;
    background: currentColor;
  }
}

/* Battery optimization for mobile */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
  /* Use will-change sparingly and remove after animation */
  .observe-viewport.in-viewport {
    will-change: transform, opacity;
  }
  
  .observe-viewport.animation-complete {
    will-change: auto;
  }
}

/* Dark mode animation adjustments */
@media (prefers-color-scheme: dark) {
  .swipe-indicator {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
  }
}

/* Touch-specific animations */
@media (hover: none) and (pointer: coarse) {
  /* Faster touch feedback */
  .touch-feedback {
    transition-duration: 0.1s;
  }
  
  /* Remove hover-based animations */
  .hover-animation {
    animation: none;
    transition: none;
  }
}