/* سیستم گرید کارت‌ها بدون نیاز به بوت‌استرپ */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 25px;
  flex-grow: 1; /* محتوای اصلی فضای باقی‌مانده را پر کند */
  order: 1; /* ترتیب نمایش در فلکس‌باکس */
}

.main-container {
    display: flex; /* استفاده از فلکس‌باکس برای چیدمان اصلی */
    flex-direction: row-reverse; /* سایدبار سمت راست */
    direction: rtl; /* جهت کلی صفحه */
    width: 100%;
    margin: 0 auto; /* مرکز چین کردن */
    padding: 10px;
    box-sizing: border-box;
}

.col-lg-4,
.col-md-6,
.col-sm-12 {
  box-sizing: border-box;
  padding: 0;
}

/* دسکتاپ – 3 ستونه */
.col-lg-4 {
  width: calc(33.333% - 20px);
}

/* تبلت – 2 ستونه */
@media (max-width: 992px) {
  .col-md-6 {
    width: calc(50% - 20px);
  }
}

/* موبایل – تک ستونه */
@media (max-width: 576px) {
  .col-sm-12 {
    min-width: 100%;
  }
}

/* ======== استایل کارت‌های محصول (میلگرد) ======== */
.custom-product-card {
  display: flex;
  flex-direction: row-reverse;
  align-items: stretch;
  justify-content: space-between;
  gap: 15px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 18px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.custom-product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-light) 0%, #0099f7 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}

.custom-product-card:hover::before {
  opacity: 0.06;
}

.custom-product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

/* عکس سمت چپ */
.card-product-image {
  width: 130px;
  height: 130px;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid var(--invoice-border-color);
  flex-shrink: 0;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.custom-product-card:hover .card-product-image {
  transform: scale(1.05);
}

/* بخش راست (عنوان + دکمه) */
.card-main-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: right;
  flex-grow: 1;
  position: relative;
  z-index: 1;
  justify-content: space-between;
  height: 130px;
}

/* عنوان */
.card-product-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #222;
  text-align: right;
  margin-top: 0;
}

.card-product-title a {
  color: inherit;
  text-decoration: none;
}

.card-product-title a:hover {
  color: #003d91;
}

/* دکمه مشاهده قیمت */
.card-product-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(90deg, var(--primary-light) 0%, #0099f7 100%);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(0, 153, 247, 0.3);
  transition: all 0.3s ease;
  margin-top: auto;
}

.card-product-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(0, 153, 247, 0.45);
  background: linear-gradient(90deg, #0099f7 0%, var(--primary-light) 100%);
}

/* ======= ریسپانسیو ======= */
@media (max-width: 992px) { /* تبلت: دو ستونه */
  .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .custom-product-card {
    padding: 16px;
  }
}

@media (max-width: 768px) { /* موبایل: تک ستونه */
  .custom-product-card {
    flex-direction: column-reverse;
    text-align: center;
    align-items: center;
  }

  .card-main-content {
    align-items: center;
  }

  .card-product-image {
    width: 100%;
    height: 180px;
  }

  .card-product-btn {
    width: 100%;
    justify-content: center;
  }
}
