/* ===================================
   PRODUCTS GRID - DIFFERENT LAYOUTS
   =================================== */

/* الصفحة الرئيسية - 4 منتجات */
.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

/* صفحة المتجر - 3 منتجات */
.shop-section .products-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.product-item {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;

  position: relative;
  border: 1px solid #f0f0f0;
}

.product-item:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ===================================
   PRODUCT IMAGE WITH HOVER EFFECT
   =================================== */

.product-image {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
  background: #fafafa;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s ease;
}

.product-image .secondary-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.product-item:hover .product-image .secondary-image {
  opacity: 1;
}

.product-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #e74c3c;
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  z-index: 3;
}

.product-placeholder {
  width: 100%;
  height: 100%;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dee2e6;
  font-size: 48px;
}

/* ===================================
   PRODUCT INFO - CLEAN LAYOUT
   =================================== */

.product-info {
  padding: 20px 16px;
  text-align: right;
}

.product-info h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 12px 0;
  line-height: 1.4;
  color: #2c3e50;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-info h3 a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.product-info h3 a:hover {
  color: #007cba;
}

/* ===================================
   PRODUCT PRICE - FIXED VERSION
   =================================== */

.products-grid .product-price {
  margin: 0 !important;
  font-weight: 600 !important;
  font-size: 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  color: #2c3e50 !important;
  line-height: 1.2 !important;
}

.products-grid .product-price .old-price {
  text-decoration: line-through !important;
  font-size: 15px !important;
  font-weight: 400 !important;
  margin: 0 !important;
}

.products-grid .product-price .current-price {
  font-size: 18px !important;
  font-weight: 600 !important;
  margin: 0 !important;
}

/* السعر المخفض - أحمر فقط عندما يكون هناك old-price */
.products-grid .product-price .old-price + .current-price {
  color: #e74c3c;
}

/* ===================================
   PRODUCT ACTIONS - SHOPIFY STYLE LEFT BOTTOM
   =================================== */

.product-actions {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.3s ease;
}

.product-item:hover .product-actions {
  opacity: 1;
  transform: translateX(0);
}

.action-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.action-btn i {
  font-size: 16px;
  color: #2c3e50;
  transition: color 0.2s ease;
}

.action-btn:hover {
  background: #007cba;
  transform: scale(1.1);
}

.action-btn:hover i {
  color: white;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Tablet - 3 products per row for homepage, 2 for shop */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  
  .shop-section .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
  
  .product-image {
    height: 280px;
  }
}

/* Mobile - 2 products per row */
@media (max-width: 768px) {
  .products-grid,
  .shop-section .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .product-image {
    height: 220px;
  }
  
  .product-info {
    padding: 16px 12px;
  }
  
  .product-info h3 {
    font-size: 14px;
    min-height: 38px;
  }
  
  .products-grid .product-price {
    font-size: 16px;
  }
  
  .products-grid .product-price .current-price {
    font-size: 16px !important;
  }
  
  .products-grid .product-price .old-price {
    font-size: 14px !important;
  }
  
  .product-actions {
    opacity: 1;
    transform: translateX(0);
    bottom: 8px;
    left: 8px;
  }
  
  .action-btn {
    width: 36px;
    height: 36px;
  }
  
  .action-btn i {
    font-size: 14px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .products-grid {
    gap: 12px;
  }
  
  .product-image {
    height: 180px;
  }
  
  .product-info {
    padding: 12px 8px;
  }
  
  .product-info h3 {
    font-size: 13px;
    min-height: 34px;
  }
  
  .products-grid .product-price {
    font-size: 15px;
  }
  
  .products-grid .product-price .current-price {
    font-size: 15px !important;
  }
  
  .products-grid .product-price .old-price {
    font-size: 13px !important;
  }
}

/* ===================================
   NO PRODUCTS MESSAGE
   =================================== */

.no-products {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.no-products p {
  font-size: 16px;
  margin: 0;
}


/* ===================================
   تحسين النقر على الصورة للانتقال للمنتج
   =================================== */

/* جعل رابط الصورة يغطي كامل منطقة الصورة */
.product-image > a {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

/* التأكد من أن الصور داخل الرابط تملأ المساحة */
.product-image > a img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* جعل أزرار الإجراءات فوق الرابط */
.product-actions {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

/* التأكد من أن الأزرار قابلة للنقر */
.product-actions .action-btn {
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  z-index: 11;
}

/* تحسين منطقة النقر على الموبايل */
@media (max-width: 768px) {
  .product-image > a {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    cursor: pointer;
  }
  
  /* زيادة منطقة النقر للأزرار على الموبايل */
  .product-actions .action-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* منع تداخل hover مع النقر على الموبايل */
@media (hover: none) and (pointer: coarse) {
  .product-image > a:active {
    opacity: 0.9;
  }
}

/* التأكد من أن Badge لا يمنع النقر */
.product-badge {
  pointer-events: none;
  z-index: 5;
}
