/* css/lazy-loading.css */
/* ============================================ */
/* LAZY LOADING STYLES - ستايلات التحميل التدريجي */
/* ============================================ */

/* تأثير التحميل للعناصر المنتظرة */
.lazy-placeholder {
  background: linear-gradient(90deg, 
    rgba(240, 240, 240, 0.8) 25%, 
    rgba(224, 224, 224, 0.8) 50%, 
    rgba(240, 240, 240, 0.8) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.lazy-placeholder::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.4) 50%, 
    transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes loading {
  0% { 
    background-position: 200% 0; 
  }
  100% { 
    background-position: -200% 0; 
  }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* تأثير الظهور عند التحميل */
.lazy-loaded {
  animation: fadeInScale 0.6s ease-out;
  opacity: 1;
  transform: scale(1);
}

@keyframes fadeInScale {
  from { 
    opacity: 0; 
    transform: scale(0.98); 
  }
  to { 
    opacity: 1; 
    transform: scale(1); 
  }
}

/* تعطيل الانتقالات أثناء التمرير لتحسين الأداء */
body.disable-transitions * {
  transition: none !important;
  animation-duration: 0s !important;
}

/* فئة مؤشر جاهزية النظام */
.lazy-loading-ready .lazy-placeholder {
  animation-play-state: running;
}

/* تحسين مظهر الصور أثناء التحميل */
.product-image img {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.product-image img.loaded {
  opacity: 1;
}

/* تأثيرات تحسين تجربة المستخدم */
@media (prefers-reduced-motion: reduce) {
  .lazy-placeholder,
  .lazy-loaded,
  .product-image img {
    animation: none !important;
    transition: none !important;
  }
}

/* دعم للأجهزة الضعيفة */
@media (max-width: 768px) {
  .lazy-placeholder {
    animation-duration: 2s;
  }
  
  .lazy-loaded {
    animation-duration: 0.4s;
  }
}

/* تعديلات للوضع الداكن */
@media (prefers-color-scheme: dark) {
  .lazy-placeholder {
    background: linear-gradient(90deg, 
      rgba(60, 60, 60, 0.8) 25%, 
      rgba(80, 80, 80, 0.8) 50%, 
      rgba(60, 60, 60, 0.8) 75%);
  }
}