/* ==========================================================================
   بطاقات المنتجات — صور موحّدة + شريط عروض يتقلّب تلقائياً
   مكتوب لمتاجر سلة (Salla) — الصقه في: إعدادات الثيم > CSS مخصص
   ========================================================================== */

:root {
  --pc-img-bg: #f4f5f7;        /* خلفية منطقة الصورة (فاتحة ومحايدة) */
  --pc-radius: 16px;           /* انحناء الزوايا */
  --pc-offer-1: #b4142f;       /* لون شريط الخصومات */
  --pc-offer-2: #0b6b5d;       /* لون شريط الشحن */
  --pc-flip-time: 7s;          /* مدة دورة كاملة (رسالتين) */
}


/* ==========================================================================
   1) توحيد الصور: كلها مربعة 1:1 والمنتج في المنتصف وظاهر بالكامل
   ========================================================================== */

/* يحسّن سرعة التمرير في الصفحات الطويلة: المتصفح ما يرسم إلا البطاقات القريبة.
   لو لاحظت قصّ في أي عنصر حول البطاقة احذف هذين السطرين. */
.s-product-card-entry {
  content-visibility: auto;
  contain-intrinsic-size: auto 380px;
}

.s-product-card-entry .s-product-card-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1 !important;   /* مربع ثابت = لا قفزات في الصفحة أثناء التحميل */
  height: auto !important;
  overflow: hidden;
  border-radius: var(--pc-radius);
  background: var(--pc-img-bg);
}

.s-product-card-entry .s-product-card-image > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.s-product-card-entry .s-product-card-image img,
.s-product-card-entry .s-product-card-image-cover,
.s-product-card-entry .s-product-card-image-contain {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  box-sizing: border-box;
  padding: 8%;                       /* مسافة تنفّس حول المنتج */
  object-fit: contain !important;    /* المنتج كامل بدون قص */
  object-position: center !important;
  mix-blend-mode: multiply;          /* الخلفية البيضاء للصورة تذوب في خلفية البطاقة */
}


/* ==========================================================================
   2) شريط العروض: يقلب لوحده بين رسالتين (بين الصورة وزر "أضف للسلة")
      - لتغيير النص: عدّل content في مكانين:
        القاعدة الأساسية بالأسفل + المفتاح pc-swap
   ========================================================================== */

.s-product-card-entry:not(.s-product-card-horizontal) .s-product-card-content::before {
  content: "🔥 خصومات لفترة محدودة";
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;                  /* يتسع لسطرين على الجوال */
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background-color: var(--pc-offer-1);
  color: #fff;
  direction: rtl;
  text-align: center;
  font-size: clamp(10.5px, 2.9vw, 12.5px);
  font-weight: 700;
  line-height: 1.35;
  backface-visibility: hidden;
  transform-origin: 50% 50%;
  animation:
    pc-flip var(--pc-flip-time) infinite,
    pc-swap var(--pc-flip-time) infinite;
}

/* حركة القلب ثلاثية الأبعاد (transform + opacity فقط = خفيفة على الجوال) */
@keyframes pc-flip {
  0%        { transform: perspective(600px) rotateX(-90deg); opacity: 0; }
  6%, 44%   { transform: perspective(600px) rotateX(0);      opacity: 1; }
  50%       { transform: perspective(600px) rotateX(90deg);  opacity: 0; }
  50.01%    { transform: perspective(600px) rotateX(-90deg); opacity: 0; }
  56%, 94%  { transform: perspective(600px) rotateX(0);      opacity: 1; }
  100%      { transform: perspective(600px) rotateX(90deg);  opacity: 0; }
}

/* تبديل النص واللون يحصل في لحظة اختفاء الشريط (منتصف القلبة) */
@keyframes pc-swap {
  0%, 50% {
    content: "🔥 خصومات لفترة محدودة";
    background-color: var(--pc-offer-1);
  }
  50.01%, 100% {
    content: "🚚 شحن مجاني داخل القصيم وعفيف";
    background-color: var(--pc-offer-2);
  }
}


/* ==========================================================================
   3) الجوال
   ========================================================================== */

@media (max-width: 480px) {
  .s-product-card-entry .s-product-card-image { border-radius: 12px; }
  .s-product-card-entry:not(.s-product-card-horizontal) .s-product-card-content::before {
    min-height: 36px;
    margin-bottom: 8px;
    padding: 5px 8px;
    border-radius: 8px;
  }
}


/* ==========================================================================
   4) احترام إعدادات "تقليل الحركة" في جهاز الزائر
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .s-product-card-entry:not(.s-product-card-horizontal) .s-product-card-content::before {
    animation: none;
    opacity: 1;
    transform: none;
    content: "🚚 شحن مجاني داخل القصيم وعفيف";
    background-color: var(--pc-offer-2);
  }
}