/* ============================================
   Animations & Micro-interactions - مشوار تاورغاء 2026
   تأثيرات الحركة والانتقالات العصرية
   ============================================ */

/* ===== Page Transitions ===== */
@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

/* ===== Card Animations ===== */
@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes cardFloat {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-8px);
  }
}

/* ===== Filter Animation ===== */
@keyframes filterPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes filterGlow {
  0% { box-shadow: 0 0 5px rgba(14, 165, 233, 0.5); }
  50% { box-shadow: 0 0 20px rgba(14, 165, 233, 0.8); }
  100% { box-shadow: 0 0 5px rgba(14, 165, 233, 0.5); }
}

/* ===== Loading Animations ===== */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    transform: translateY(0);
  }
  40%, 43% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translateY(-10px);
  }
  70% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translateY(-5px);
  }
  90% {
    transform: translateY(-2px);
  }
}

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

/* ===== Status Badge Animation ===== */
@keyframes statusPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes statusDotBlink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ===== Image Zoom Animation ===== */
@keyframes imageZoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.1);
  }
}

/* ===== Button Press Animation ===== */
@keyframes buttonPress {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes buttonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

/* ===== Pull to Refresh Animation ===== */
@keyframes pullRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pullBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ===== Swipe Gesture Animations ===== */
@keyframes swipeLeft {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(-100%); opacity: 0; }
}

@keyframes swipeRight {
  0% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

@keyframes swipeUp {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-100%); opacity: 0; }
}

/* ===== Animation Classes ===== */
.animate-page-in {
  animation: pageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.animate-page-out {
  animation: pageSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade-in {
  animation: pageFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.animate-card-up {
  animation: cardSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.animate-card-in {
  animation: cardSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.animate-float {
  animation: cardFloat 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-filter-pulse {
  animation: filterPulse 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-filter-glow {
  animation: filterGlow 1.5s ease-in-out infinite;
}

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

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

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

.animate-status-pulse {
  animation: statusPulse 2s ease-in-out infinite;
}

.animate-status-dot {
  animation: statusDotBlink 2s ease-in-out infinite;
}

.animate-image-zoom {
  animation: imageZoom 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-button-press {
  animation: buttonPress 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-button-float {
  animation: buttonFloat 2s ease-in-out infinite;
}

.animate-pull-rotate {
  animation: pullRotate 1s linear infinite;
}

.animate-pull-bounce {
  animation: pullBounce 1s ease-in-out infinite;
}

.animate-swipe-left {
  animation: swipeLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-swipe-right {
  animation: swipeRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-swipe-up {
  animation: swipeUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ===== Animation Delays ===== */
.animate-delay-100 { animation-delay: 0.1s; }
.animate-delay-200 { animation-delay: 0.2s; }
.animate-delay-300 { animation-delay: 0.3s; }
.animate-delay-500 { animation-delay: 0.5s; }
.animate-delay-700 { animation-delay: 0.7s; }
.animate-delay-1000 { animation-delay: 1s; }

/* ===== Hover Animations (Desktop) ===== */
@media (hover: hover) {
  .hover-float:hover {
    animation: cardFloat 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
  
  .hover-glow:hover {
    animation: filterGlow 0.5s ease-out forwards;
  }
  
  .hover-zoom:hover img {
    animation: imageZoom 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
}

/* ===== Touch Animations (Mobile) ===== */
@media (hover: none) and (pointer: coarse) {
  .touch-press:active {
    animation: buttonPress 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

/* ===== Performance Optimizations ===== */
.animate-card-up,
.animate-card-in,
.animate-float,
.animate-page-in,
.animate-fade-in {
  will-change: transform, opacity;
}

.animate-spin,
.animate-pull-rotate {
  will-change: transform;
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-page-in,
  .animate-page-out,
  .animate-fade-in,
  .animate-card-up,
  .animate-card-in,
  .animate-float,
  .animate-filter-pulse,
  .animate-filter-glow,
  .animate-bounce,
  .animate-pulse,
  .animate-status-pulse,
  .animate-status-dot,
  .animate-image-zoom,
  .animate-button-float,
  .animate-pull-bounce {
    animation: none !important;
  }
}

/* ===== Stagger Animations ===== */
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }

/* ===== Intersection Observer Animations ===== */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-up.in-view {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-left.in-view {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-right.in-view {
  opacity: 1;
  transform: translateX(0);
}

.scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scale-in.in-view {
  opacity: 1;
  transform: scale(1);
}