:root {
  --main-color: #ff8716;
  --dark-color: #222222;
  --parg-color: #666666;
  --dark-red: #d01418;
  --border-color: #6666662a;
  --name-item: #0066c0;
  --light-bg: #f8f9fa;
  --light-gray: #e0e0e0;
  --soft-red-bg: #fff5f5;
  --soft-red-border: #ffebee;
  --gold-star: #ffd700;
  --disabled-bg: #f5f5f5;
  --text-light: #999;
  --text-dark: #333;
}

/* ✅ شبكة المنتجات */
#products_dev {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px 0;
  min-height: 400px;
}

/* ✅ بطاقة المنتج */
.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border-color);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: var(--main-color);
}

/* ✅ صورة المنتج */
.product-image {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: var(--light-bg);
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-image .hover-img {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.product-card:hover .product-image img:first-child {
  opacity: 0;
}

.product-card:hover .product-image .hover-img {
  opacity: 1;
}

/* ✅ شارة الخصم */
.discount-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(135deg, var(--dark-red), #ff3742);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.3);
}

/* ✅ أزرار الإجراءات */
.product-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
}

.product-card:hover .product-actions {
  opacity: 1;
  transform: translateX(0);
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: var(--parg-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.action-btn:hover {
  background: var(--main-color);
  color: white;
  transform: scale(1.1);
}

/* ✅ معلومات المنتج */
.product-info {
  padding: 16px;
}

.product-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--dark-color);
  margin: 0 0 12px 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}

/* ✅ تقييم المنتج */
.product-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.stars {
  display: flex;
  gap: 2px;
}

.stars i {
  color: var(--main-color);
  font-size: 12px;
}

.rating-count {
  font-size: 12px;
  color: var(--parg-color);
  font-weight: 500;
}

/* ✅ تسعير المنتج */
.product-pricing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.current-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--main-color);
}

.old-price {
  font-size: 14px;
  color: var(--parg-color);
  text-decoration: line-through;
}

/* ✅ إحصائيات المنتج */
.product-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--parg-color);
}

.sold-count {
  background: #f0f8ff;
  color: var(--dark-color);
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.brand-name {
  color: var(--parg-color);
  font-weight: 500;
}

/* ✅ رسائل الحالة */
.no-products,
.error-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  font-size: 16px;
}

.no-products {
  color: var(--parg-color);
}

.error-message {
  color: var(--dark-red);
  background: var(--soft-red-bg);
  border-radius: 12px;
  border: 1px solid var(--soft-red-border);
}

/* ✅ شريط الصفحات */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 40px auto;
  flex-wrap: wrap;
  width: fit-content;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  border: 1px solid var(--light-gray);
  background: white;
  color: var(--parg-color);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  transition: all 0.3s ease;
}

.page-btn:hover:not(.disabled),
.page-btn.active {
  background: var(--main-color);
  color: white;
  border-color: var(--main-color);
}

.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--disabled-bg);
}

.page-dots {
  color: var(--text-light);
  padding: 0 8px;
}

/* ✅ الإشعارات */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  transform: translateX(400px);
  transition: transform 0.3s ease;
  max-width: 300px;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  border-left: 4px solid #2ed573;
}

.notification.error {
  border-left: 4px solid var(--dark-red);
}

.notification.info {
  border-left: 4px solid #3742fa;
}

.notification.success i {
  color: #2ed573;
}

.notification.error i {
  color: var(--dark-red);
}

.notification.info i {
  color: #3742fa;
}

/* الاستجابة للشاشات المختلفة */

/* الشاشات الكبيرة */
@media (min-width: 1400px) {
  #products_dev {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
  }
}

/* الشاشات المتوسطة */
@media (max-width: 1200px) {
  #products_dev {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
  }

  .product-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
  }
}

@media (max-width: 1000px) {
  #products_dev {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .product-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
  }
}

@media (max-width: 800px) {
  #products_dev {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }

  .product-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
  }
}



/* الأجهزة اللوحية */
@media (max-width: 768px) {
  #products_dev {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 16px 0;
  }
  
  .product-image {
    height: 240px;
  }
  
  .product-info {
    padding: 12px;
  }
  
  .product-title {
    font-size: 20px;
  }
  
  .current-price {
    font-size: 16px;
  }
  
  .pagination {
    gap: 6px;
    margin: 30px 30px;
  }
  
  .page-btn {
    min-width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .notification {
    right: 10px;
    left: 10px;
    transform: translateY(-100px);
    max-width: none;
  }
  
  .notification.show {
    transform: translateY(0);
  }
}

@media (max-width: 550px) {
  #products_dev {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* ✅ منتجين في الصف */
    gap: 14px;
    padding: 14px 10px;
  }

  .product-card {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  .product-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* ✅ يحافظ على تناسق الصورة */
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* ✅ عرض الصورة بالكامل بدون قص */
    transition: transform 0.3s ease;
  }

  .product-info {
    padding: 10px;
  }

  .product-title {
    font-size: 18px;
    min-height: 38px;
    line-height: 1.3;
  }

  .current-price {
    font-size: 15px;
  }

  .old-price {
    font-size: 10px;
  }

  .product-rating {
    gap: 6px;
    margin-bottom: 10px;
  }

  .stars i {
    font-size: 11px;
  }

  .rating-count {
    font-size: 11px;
  }

  .product-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .discount-badge {
    font-size: 11px;
    padding: 5px 8px;
  }

  .action-btn {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .pagination {
    gap: 6px;
    margin: 30px 30px;
  }

  .page-btn {
    min-width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .notification {
    right: 10px;
    left: 10px;
    transform: translateY(-100px);
    max-width: none;
  }

  .notification.show {
    transform: translateY(0);
  }
}


/* الهواتف الصغيرة */
@media (max-width: 480px) {
  #products_dev {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* ✅ عرض منتجين في الصف */
    gap: 12px;
    padding: 12px 10px;
  }

  .product-card {
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }

  /*.product-image {*/
  /*  width: 100%;*/
  /*  height: 180px;*/
  /*}*/

  /*.product-info {*/
  /*  padding: 10px;*/
  /*}*/
   .product-card {
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
  }

  .product-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* ✅ يحافظ على تناسق الصورة */
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .product-image img {
    width: 100%;
    height: auto;
    object-fit: contain; /* ✅ عرض الصورة بالكامل بدون قص */
    transition: transform 0.3s ease;
  }


  .product-title {
    font-size: 15px;
    min-height: 36px;
    line-height: 1.3;
  }

  .current-price {
    font-size: 14px;
  }

  .old-price {
    font-size: 12px;
  }

  .product-rating {
    gap: 6px;
    margin-bottom: 10px;
  }

  .stars i {
    font-size: 11px;
  }

  .rating-count {
    font-size: 11px;
  }

  .product-stats {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .discount-badge {
    font-size: 10px;
    padding: 4px 6px;
  }

  .action-btn {
    width: 34px;
    height: 34px;
  }

  .pagination {
    gap: 6px;
    margin: 30px 30px;
  }

  .page-btn {
    min-width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .notification {
    right: 10px;
    left: 10px;
    transform: translateY(-100px);
    max-width: none;
  }

  .notification.show {
    transform: translateY(0);
  }
}


/* شاشات صغيرة جداً */
@media (max-width: 360px) {
  #products_dev {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .product-image {
    height: 180px;
  }
  
  .product-info {
    padding: 8px;
  }
  
  .current-price {
    font-size: 14px;
  }
  
  .product-title {
    font-size: 11px;
    min-height: 33px;
  }
}

/* تحسينات الأداء */
.product-card {
  will-change: transform;
}

.product-image img {
  will-change: transform, opacity;
}

/* تحميل الصور */
.product-image img[src=""] {
  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;
  }
}

/* تحسين النقر على الهواتف */
@media (hover: none) {
  .product-actions {
    opacity: 1;
    transform: translateX(0);
  }
  
  .product-card:hover {
    transform: none;
  }
  
  .product-card:active {
    transform: scale(0.98);
  }
}

/*---------------------------------------------------------*/
