/* تحسينات أداء بطاقات الموديل - منع الاهتزاز */

/* تحسينات عامة للبطاقات */
.model-card {
  /* تحسين الأداء */
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  perspective: 1000px;
  
  /* منع الاهتزاز */
  contain: layout style paint;
  isolation: isolate;
  
  /* تحسين الانتقالات */
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* تحسينات الصور */
.model-card img {
  /* تحسين الأداء */
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  perspective: 1000px;
  
  /* منع الاهتزاز */
  contain: layout style paint;
  isolation: isolate;
  
  /* تحسين جودة الصور */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  
  /* تحسين الانتقالات */
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* تحسينات النص */
.model-card p {
  /* منع الاهتزاز */
  contain: layout style;
  isolation: isolate;
  
  /* تحسين العرض */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* تحسينات الشبكة */
.models-grid {
  /* تحسين الأداء */
  contain: layout style;
  isolation: isolate;
  
  /* منع الاهتزاز */
  will-change: contents;
}

/* تحسينات التأثيرات عند التمرير */
.model-card:hover {
  /* تحسين الانتقال */
  transform: translateY(-5px) translateZ(0);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  
  /* منع الاهتزاز */
  contain: layout style paint;
}

/* تحسينات للأجهزة المحمولة */
@media (max-width: 768px) {
  .model-card {
    /* تقليل التأثيرات على الأجهزة المحمولة */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  .model-card:hover {
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  }
  
  .model-card img {
    /* تحسين الأداء على الأجهزة المحمولة */
    image-rendering: auto;
  }
}

/* تحسينات للأجهزة الضعيفة */
@media (prefers-reduced-motion: reduce) {
  .model-card,
  .model-card img {
    transition: none;
  }
  
  .model-card:hover {
    transform: none;
  }
}

/* تحسينات للشاشات عالية الدقة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .model-card img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* منع التحديثات المتكررة */
.model-card[data-updating="true"] {
  pointer-events: none;
  opacity: 0.8;
}

/* تحسينات للتحميل */
.model-card[data-loading="true"] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* تحسينات للشبكة */
.models-grid {
  /* تحسين التخطيط */
  contain: layout style;
  
  /* منع إعادة التخطيط المتكرر */
  will-change: contents;
}

/* تحسينات للبطاقات الجديدة */
.model-card[data-new="true"] {
  animation: newModelFadeIn 0.5s ease-out;
}

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

/* تحسينات للبطاقات المحدثة */
.model-card[data-updated="true"] {
  animation: modelUpdate 0.3s ease-out;
}

@keyframes modelUpdate {
  0% {
    transform: scale(1) translateZ(0);
  }
  50% {
    transform: scale(1.02) translateZ(0);
  }
  100% {
    transform: scale(1) translateZ(0);
  }
} 