/* =========================================================
   AJORR PRODUCT CARD UI REFACTOR
   UI-only — بدون تغییر منطق، دیتابیس، URL یا فیلترها
   ========================================================= */

:root {
  --pc-brand: #c95f32;
  --pc-brand-hover: #ad4925;
  --pc-brand-dark: #8e381d;

  --pc-surface: #ffffff;
  --pc-page: #faf9f7;
  --pc-border: #e6e2dc;

  --pc-text: #1d1b19;
  --pc-muted: #7b746c;

  --pc-success: #23845b;
  --pc-warning: #b86a12;
  --pc-danger: #c43d3d;

  --pc-radius: 16px;
}

/* =========================
   GRID
   ========================= */

.products {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

/* =========================
   CARD
   ========================= */

.product {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;

  background: var(--pc-surface);
  color: var(--pc-text);

  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  overflow: hidden;

  box-shadow: 0 2px 8px rgba(29, 27, 25, 0.04);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.product:hover {
  transform: translateY(-3px);
  border-color: rgba(201, 95, 50, 0.35);

  box-shadow:
    0 16px 36px rgba(29, 27, 25, 0.1);
}

/* =========================
   IMAGE
   ========================= */

.product .photo {
  position: relative;

  width: 100%;
  aspect-ratio: 4 / 3;

  overflow: hidden;
  background: #f3f1ed;
}

.product .photo img {
  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  transition: transform 0.4s cubic-bezier(.22,1,.36,1);
}

.product:hover .photo img {
  transform: scale(1.025);
}

/* =========================
   BADGE
   ========================= */

.product .photo span {
  position: absolute;

  top: 12px;
  right: 12px;

  z-index: 2;

  display: inline-flex;
  align-items: center;

  min-height: 28px;
  max-width: calc(100% - 24px);

  padding: 5px 11px;

  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.7);

  background: rgba(255,255,255,.94);

  color: var(--pc-text);

  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;

  box-shadow: 0 4px 14px rgba(29,27,25,.12);

  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

/* موجود */

.product .photo span {
  color: #176644;
  background: rgba(242,252,247,.96);
  border-color: rgba(35,132,91,.25);
}

/* =========================
   BODY
   ========================= */

.product .body {
  display: flex;
  flex: 1;
  flex-direction: column;

  min-width: 0;

  padding: 18px;
}

/* code */

.product .body small {
  display: block;

  margin-bottom: 6px;

  color: var(--pc-muted);

  font-size: 11px;
  font-weight: 500;

  line-height: 1.7;
}

/* =========================
   PRODUCT TITLE
   ========================= */

.product .body h3 {
  display: -webkit-box;

  margin: 0 0 14px;

  min-height: 3.2em;

  overflow: hidden;

  color: var(--pc-text);

  font-size: 17px;
  font-weight: 800;
  line-height: 1.6;

  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;

  transition: color 0.2s ease;
}

.product:hover .body h3 {
  color: var(--pc-brand-dark);
}

/* =========================
   SPECS
   ========================= */

.product .body dl {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 8px;

  margin: 0 0 15px;
  padding: 0;
}

.product .body dl > div {
  min-width: 0;

  padding: 9px 10px;

  border: 1px solid #eeeae5;
  border-radius: 10px;

  background: var(--pc-page);
}

.product .body dt {
  margin-bottom: 2px;

  color: var(--pc-muted);

  font-size: 10px;
  font-weight: 500;
}

.product .body dd {
  margin: 0;

  color: var(--pc-text);

  font-size: 12px;
  font-weight: 700;

  line-height: 1.6;
}

/* فقط بخش ابعاد */
.product .body dl > div:nth-child(2) dd {
  direction: ltr;
  text-align: right;

  display: -webkit-box;
  overflow: hidden;

  max-height: 3.2em;

  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;

  white-space: normal;
  word-break: normal;
}

/* =========================
   PRICE
   ========================= */

.product .body > p {
  margin: auto 0 12px;

  padding-top: 13px;

  border-top: 1px solid #eeeae5;

  color: var(--pc-brand);

  font-size: 12px;
  font-weight: 800;

  line-height: 1.8;
}

.product .body > p::before {
  content: "قیمت روز";

  display: block;

  margin-bottom: 1px;

  color: var(--pc-muted);

  font-size: 10px;
  font-weight: 500;
}

/* =========================
   CTA
   ========================= */

.product .body .btn {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  width: 100%;
  min-height: 46px;

  padding: 10px 14px;

  border: 1px solid var(--pc-brand);
  border-radius: 11px;

  background: var(--pc-brand);
  color: #fff;

  text-decoration: none;

  font-size: 12px;
  font-weight: 800;

  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.product .body .btn:hover {
  background: var(--pc-brand-hover);
  border-color: var(--pc-brand-hover);

  color: #fff;
}

.product .body .btn:active {
  transform: scale(.985);
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 1279px) {
  .products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product .body h3 {
    font-size: 16px;
  }
}

@media (max-width: 639px) {
  .products {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .product .photo {
    aspect-ratio: 16 / 10;
  }

  .product .body {
    padding: 16px;
  }

  .product .body h3 {
    min-height: auto;
    font-size: 17px;
  }

  .product .body .btn {
    min-height: 48px;
    font-size: 13px;
  }
}

/* =========================
   ACCESSIBILITY
   ========================= */

@media (prefers-reduced-motion: reduce) {
  .product,
  .product .photo img,
  .product .body .btn {
    transition: none !important;
  }

  .product:hover {
    transform: none;
  }

  .product:hover .photo img {
    transform: none;
  }
}
/* =========================
   DIMENSION CHIPS
   ========================= */

.product .dimension-chips {
  display: flex;
  flex-wrap: wrap;

  gap: 5px;

  direction: rtl;

  margin-top: 2px;
}

.product .dimension-chip {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  min-height: 25px;

  padding: 3px 7px;

  border: 1px solid #e5dfd8;
  border-radius: 7px;

  background: #ffffff;

  color: #2d2a27;

  font-size: 10px;
  font-weight: 700;

  direction: ltr;
  white-space: nowrap;
}

.product .dimension-more {
  background: #fff7f2;

  border-color: #f0c6b2;

  color: #8e381d;

  font-weight: 800;
}

/* موبایل */

@media (max-width: 639px) {

  .product .dimension-chip {
    min-height: 27px;

    padding: 4px 8px;

    font-size: 11px;
  }

}
/* بهبود نهایی باکس ابعاد */

.product .body dl {
  grid-template-columns: 1fr 1.35fr;
}

.product .body dl > div:nth-child(2) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.product .body dl > div:nth-child(2) dt {
  margin-bottom: 6px;
}

.product .dimension-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  direction: rtl;
  width: 100%;
}

.product .dimension-chip {
  flex: 0 0 auto;
}

@media (max-width: 639px) {

  .product .body dl {
    grid-template-columns: 0.8fr 1.2fr;
    gap: 8px;
  }

  .product .dimension-chip {
    padding: 3px 6px;
    font-size: 10px;
  }

}
/* پایداری بخش ابعاد برای هر تعداد سایز */

.product .body dl > div:nth-child(2) {
  min-width: 0;
  overflow: hidden;
}

.product .dimension-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;

  width: 100%;
  min-width: 0;

  overflow: hidden;
}

.product .dimension-chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

.product .dimension-more {
  flex: 0 0 auto;
  font-weight: 800;
}
.product .dimension-chips {
  justify-content: flex-start;
  direction: rtl;
}

.product .dimension-more {
  order: 99;
}