/* ===== شاید اینها را هم بپسندید — موبایل‌اول، RTL، پالت سرمه‌ای/طلایی ===== */

.related-products {
  max-width: var(--max);
  margin: 8px auto 0;
  padding: 8px 16px 28px;
}
.related-products[hidden] {
  display: none !important;
}

.related-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.related-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.related-count {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.related-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(220, 185, 85, 0.55) transparent;
}
.related-track::-webkit-scrollbar {
  height: 4px;
}
.related-track::-webkit-scrollbar-thumb {
  background: rgba(220, 185, 85, 0.55);
  border-radius: 999px;
}

/* ~۲٫۳ کارت در عرض تا اسکرول افقی واضح باشد */
.related-card-wrap {
  position: relative;
  flex: 0 0 calc((100% - 12px) / 2.3);
  max-width: 220px;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

.related-card {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(
    160deg,
    rgba(13, 40, 61, 0.06),
    rgba(224, 177, 131, 0.08) 55%,
    rgba(13, 40, 61, 0.04)
  );
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  backdrop-filter: blur(10px) saturate(1.15);
  border: 1px solid rgba(224, 177, 131, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 8px 22px -12px rgba(13, 40, 61, 0.28);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.related-card:active {
  transform: scale(0.98);
}

.related-card-media {
  position: relative;
  aspect-ratio: 3 / 4;
  background: rgba(13, 40, 61, 0.06);
  overflow: hidden;
}
.related-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-card-wrap .fav-btn {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 40, 61, 0.42);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: var(--white);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 10px rgba(0, 0, 0, 0.28);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}
.related-card-wrap .fav-btn:active { transform: scale(0.9); }
.related-card-wrap .fav-btn.is-favorited { color: #e0455a; }
.related-card-wrap .fav-btn.is-favorited .icon-heart { fill: currentColor; }

.related-card-body {
  padding: 10px 11px 12px;
}
.related-card-compare {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: line-through;
  margin-bottom: 2px;
}
.related-card-price {
  margin: 0 0 6px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.35;
}
.related-card-name {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* اسکلت بارگذاری */
.related-skel {
  flex: 0 0 calc((100% - 12px) / 2.3);
  max-width: 220px;
  scroll-snap-align: start;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(224, 177, 131, 0.22);
  background: rgba(13, 40, 61, 0.04);
  pointer-events: none;
}
.related-skel-img {
  aspect-ratio: 3 / 4;
  background: linear-gradient(90deg, rgba(13,40,61,0.06), rgba(224,177,131,0.12), rgba(13,40,61,0.06));
  background-size: 200% 100%;
  animation: related-shimmer 1.2s ease-in-out infinite;
}
.related-skel-body {
  padding: 10px 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.related-skel-line {
  height: 10px;
  border-radius: 6px;
  background: rgba(13, 40, 61, 0.08);
}
.related-skel-line--price { width: 72%; height: 12px; }
.related-skel-line--name { width: 100%; }
.related-skel-line--name2 { width: 58%; }

@keyframes related-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (min-width: 720px) {
  .related-products { padding: 12px 24px 36px; }
  .related-head h2 { font-size: 1.3rem; }
  .related-card-wrap,
  .related-skel {
    flex-basis: calc((100% - 36px) / 4.2);
    max-width: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .related-skel-img { animation: none; }
  .related-card { transition: none; }
}
