/* =====================================================
   PRODUCT PAGE — صفحه محصول
===================================================== */

:root {
  --p-brand: #b32a65;
  --p-brand-2: #9a2457;
  --p-text: #1f1a1e;
  --p-muted: #7a7080;
  --p-bg: #ffffff;
  --p-soft: #faf5f8;
  --p-border: #eee7ec;
  --p-radius: 12px;
  --p-radius-lg: 20px;
  --p-tr: .25s cubic-bezier(.25, .1, .25, 1);
}

[data-theme="dark"] {
  --p-bg: #16131a;
  --p-text: #f8f4f7;
  --p-muted: #a89ea8;
  --p-soft: #1e1b22;
  --p-border: #2a242f;
}
/* =====================================================
   FIX: جلوگیری از بزرگ شدن خودکار عکس گالری
===================================================== */

/* ۱) حذف انیمیشن transform روی عکس اصلی */
.gallery-img-wrapper img {
  transition: none !important;
  transform: none !important;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ۲) حذف hover-zoom (حتی در دسکتاپ) */
.gallery-main:hover .gallery-img-wrapper img {
  transform: none !important;
}

/* ۳) روی دستگاه‌های لمسی (موبایل/تبلت) که hover ندارند، قفل :hover را خاموش کن */
@media (hover: none) {
  .gallery-main:hover .gallery-img-wrapper img {
    transform: none !important;
  }
}

/* ۴) جلوگیری از پرش اولیه به‌خاطر aspect-ratio در حین load */
.gallery-main {
  contain: layout paint;
}

.gallery-img-wrapper {
  contain: layout paint;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   HERO تیره
═══════════════════════════════════════════════════════ */
.product-hero {
  background: linear-gradient(180deg, #1c1c21 0%, #26262c 100%);
  padding: 70px 0 100px;
  position: relative;
  overflow: hidden;
}

.product-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(179, 42, 101, .25) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(179, 42, 101, .15) 0%, transparent 50%);
  pointer-events: none;
}

.product-hero-inner {
  width: min(1220px, 94%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
}

.product-hero-icon {
  width: 140px;
  height: 140px;
  padding: 22px;
  background: rgba(255, 255, 255, .95);
  border-radius: var(--p-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .4);
  overflow: hidden;
}

.product-hero-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-hero-icon span {
  font-size: 4rem;
  opacity: .35;
}

.product-hero-cats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.product-hero-cats a {
  padding: 6px 16px 7px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s ease;
}

.product-hero-cats a:hover {
  background: rgba(255, 255, 255, .2);
}

/* ═══════════════════════════════════════════════════════
   PAGE
═══════════════════════════════════════════════════════ */
.product-page {
  background: var(--p-bg);
  padding: 0 0 60px;
  margin-top: -60px;
  position: relative;
  z-index: 1;
}

.product-inner {
  width: min(1220px, 94%);
  margin: 0 auto;
  padding: 0 15px;
}

/* ═══════════════════════════════════════════════════════
   BREADCRUMB
═══════════════════════════════════════════════════════ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
  font-size: .82rem;
  color: var(--p-muted);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--p-muted);
  text-decoration: none;
  transition: color .2s ease;
}

.breadcrumb a:hover {
  color: var(--p-brand);
}

.breadcrumb .current {
  color: var(--p-text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

/* ═══════════════════════════════════════════════════════
   LAYOUT (گالری + اطلاعات)
═══════════════════════════════════════════════════════ */
.product-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 20px 0 40px;
  align-items: start;
}

/* ═══════════════════════════════════════════════════════
   GALLERY
═══════════════════════════════════════════════════════ */
.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-main {
  width: 100%;
  border-radius: var(--p-radius-lg);
  overflow: hidden;
  background: var(--p-soft);
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--p-border);
}

.gallery-img-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.gallery-img-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform .4s ease;
}

.gallery-main:hover .gallery-img-wrapper img {
  transform: scale(1.05);
}

.gallery-placeholder {
  font-size: 6rem;
  opacity: .25;
  background: linear-gradient(135deg, var(--p-soft), var(--p-border));
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--p-border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--p-text);
  transition: 0.2s ease;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.gallery-nav:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.08);
}

.gallery-prev { left: 16px; }
.gallery-next { right: 16px; }

/* Thumbs */
.gallery-thumbs {
  width: 100%;
}

.gallery-thumbs .swiper-slide {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: 0.2s ease;
  background: var(--p-soft);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-thumbs .swiper-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-thumbs .swiper-slide-thumb-active {
  border-color: var(--p-brand);
}

/* ═══════════════════════════════════════════════════════
   INFO
═══════════════════════════════════════════════════════ */
.product-info {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.product-title {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--p-text);
  line-height: 1.4;
  letter-spacing: -.3px;
}

.product-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .84rem;
}

.product-rating .stars {
  color: #f4b942;
  letter-spacing: 1px;
}

.rating-text {
  color: var(--p-muted);
  font-weight: 500;
}

.product-cat-badge {
  display: inline-block;
  padding: 4px 14px 5px;
  background: rgba(179, 42, 101, .1);
  color: var(--p-brand);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .2s ease;
}

.product-cat-badge:hover {
  background: rgba(179, 42, 101, .18);
}

.product-short-desc {
  margin: 0;
  font-size: .95rem;
  line-height: 1.9;
  color: var(--p-muted);
  padding: 12px 16px;
  background: var(--p-soft);
  border-radius: 10px;
  border-right: 3px solid var(--p-brand);
}

/* ───── قیمت ───── */
.product-price-box {
  padding: 20px;
  background: linear-gradient(135deg, #fff2f7 0%, #ffe9f0 100%);
  border-radius: var(--p-radius);
  border: 1px solid #f5d0df;
}

[data-theme="dark"] .product-price-box {
  background: linear-gradient(135deg, #2a1a24 0%, #1e1219 100%);
  border-color: #3a1f2a;
}

.price-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.price-line + .price-line {
  margin-top: 6px;
}

.old-price {
  font-size: .9rem;
  color: #b8aeba;
  text-decoration: line-through;
  font-weight: 400;
}

.discount-badge {
  padding: 3px 12px 4px;
  background: var(--p-brand);
  color: #fff;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .3px;
}

.final-price {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--p-brand);
  font-feature-settings: "ss02";
  line-height: 1;
}

.product-price-box .currency {
  font-size: .95rem;
  color: var(--p-muted);
  font-weight: 500;
}

/* ───── موجودی ───── */
.product-stock {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  font-weight: 600;
}

.product-stock .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.product-stock.in-stock { color: #1a7a3f; }
.product-stock.in-stock .dot { background: #27ae60; }
.product-stock.in-stock .dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(39, 174, 96, .25);
  animation: stockPulse 2s ease-out infinite;
}

@keyframes stockPulse {
  0%   { transform: scale(.7); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.product-stock.out-stock { color: #c0392b; }
.product-stock.out-stock .dot { background: #c0392b; }

/* ───── فرم افزودن ───── */
.product-form {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin-top: 4px;
}

.product-form.out { display: block; }

.qty-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  overflow: hidden;
  background: var(--p-bg);
  flex-shrink: 0;
  height: 54px;
}

.qty-btn {
  width: 42px;
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 1.3rem;
  color: var(--p-text);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
  font-family: inherit;
  display: grid;
  place-items: center;
}

.qty-btn:hover {
  background: var(--p-soft);
  color: var(--p-brand);
}

.qty-input {
  width: 54px;
  height: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--p-text);
  outline: none;
  font-feature-settings: "ss02";
  -moz-appearance: textfield;
  appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.add-to-cart-btn {
  flex: 1;
  height: 54px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--p-radius);
  background: var(--p-brand);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: 0.25s ease;
  position: relative;
  overflow: hidden;
}

.add-to-cart-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transform: translateX(-200%);
  transition: transform .6s ease;
}

.add-to-cart-btn:hover::before {
  transform: translateX(200%);
}

.add-to-cart-btn:hover {
  background: var(--p-brand-2);
  box-shadow: 0 12px 24px -10px rgba(179, 42, 101, .5);
  transform: translateY(-1px);
}

.add-to-cart-btn:active {
  transform: translateY(0);
}

.add-to-cart-btn.disabled,
.add-to-cart-btn:disabled {
  background: var(--p-soft);
  color: var(--p-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.add-to-cart-btn.disabled::before,
.add-to-cart-btn:disabled::before {
  display: none;
}

/* ───── ویژگی‌ها ───── */
.product-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 18px;
  background: var(--p-soft);
  border-radius: var(--p-radius);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--p-text);
  font-weight: 600;
}

.feature-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--p-bg);
  border-radius: 8px;
  font-size: .9rem;
  flex-shrink: 0;
  color: var(--p-brand);
}

/* ═══════════════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════════════ */
.product-tabs {
  margin-top: 30px;
  background: var(--p-bg);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  overflow: hidden;
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--p-border);
  background: var(--p-soft);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-header::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 16px 24px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  color: var(--p-muted);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  transition: color .2s ease;
}

.tab-btn::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  right: 50%;
  height: 3px;
  background: var(--p-brand);
  transition: left .25s ease, right .25s ease;
  border-radius: 3px 3px 0 0;
}

.tab-btn:hover {
  color: var(--p-text);
}

.tab-btn.active {
  color: var(--p-brand);
}

.tab-btn.active::after {
  left: 20px;
  right: 20px;
}

.tabs-content {
  padding: 28px;
}

.tab-panel {
  display: none;
  animation: panelFade .3s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes panelFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tab-rich-text {
  font-size: .95rem;
  line-height: 2;
  color: var(--p-text);
  max-width: 60em;
}

.empty-tab {
  text-align: center;
  color: var(--p-muted);
  padding: 30px 0;
  font-size: .9rem;
}

/* جدول مشخصات */
.specs-table {
  width: 100%;
  border-collapse: collapse;
}

.specs-table th,
.specs-table td {
  padding: 14px 16px;
  text-align: right;
  font-size: .9rem;
  border-bottom: 1px solid var(--p-border);
}

.specs-table th {
  color: var(--p-muted);
  font-weight: 600;
  width: 200px;
  background: var(--p-soft);
}

.specs-table td {
  color: var(--p-text);
  font-weight: 500;
}

.specs-table code {
  font-family: ui-monospace, monospace;
  background: var(--p-soft);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: .82rem;
  direction: ltr;
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════
   REVIEWS in tab
═══════════════════════════════════════════════════════ */
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.review-item {
  padding: 18px;
  background: var(--p-soft);
  border-radius: var(--p-radius);
  border-right: 3px solid var(--p-brand);
}

.review-item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.review-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--p-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 900;
  flex-shrink: 0;
}

.review-item-name {
  font-weight: 800;
  font-size: .92rem;
  color: var(--p-text);
}

.review-item-title {
  font-size: .72rem;
  color: var(--p-muted);
  margin-top: 2px;
}

.review-item-stars {
  color: #f4b942;
  letter-spacing: 2px;
  margin-bottom: 6px;
  font-size: .9rem;
}

.review-item-text {
  margin: 0;
  font-size: .88rem;
  line-height: 1.9;
  color: var(--p-text);
}

/* ═══════════════════════════════════════════════════════
   RELATED
═══════════════════════════════════════════════════════ */
.product-related {
  margin-top: 50px;
}

.related-title {
  margin: 0 0 22px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--p-text);
}

.related-swiper {
  overflow: hidden;
  padding: 4px 4px 40px;
}

.rel-card {
  display: flex;
  flex-direction: column;
  background: var(--p-soft);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: 0.25s ease;
}

.rel-card:hover {
  transform: translateY(-4px);
  border-color: var(--p-brand);
  box-shadow: 0 16px 30px -12px rgba(179, 42, 101, .25);
}

.rel-image {
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

[data-theme="dark"] .rel-image { background: #191620; }

.rel-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform .4s ease;
}

.rel-card:hover .rel-image img {
  transform: scale(1.08);
}

.rel-image span {
  font-size: 2.4rem;
  opacity: .3;
}

.rel-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.rel-cat {
  font-size: .68rem;
  color: var(--p-muted);
  font-weight: 600;
}

.rel-title {
  font-size: .88rem;
  font-weight: 800;
  color: var(--p-text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.rel-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  flex-wrap: wrap;
}

.rel-price del {
  font-size: .72rem;
  color: #b8aeba;
  text-decoration: line-through;
}

.rel-price strong {
  font-size: .98rem;
  font-weight: 800;
  color: var(--p-brand);
  font-feature-settings: "ss02";
}

.rel-price strong span {
  font-size: .68rem;
  font-weight: 500;
  color: var(--p-muted);
  margin-right: 2px;
}

/* nav */
.rel-nav {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.related-swiper {
  position: relative;
}

.rel-prev,
.rel-next {
  position: absolute;
  top: -50px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--p-border);
  background: var(--p-bg);
  color: var(--p-text);
  font-family: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  transition: 0.2s ease;
  display: grid;
  place-items: center;
}

.rel-prev { right: 0; }
.rel-next { right: 46px; }

.rel-prev:hover,
.rel-next:hover {
  background: var(--p-brand);
  color: #fff;
  border-color: var(--p-brand);
}

.rel-prev.swiper-button-disabled,
.rel-next.swiper-button-disabled {
  opacity: .3;
  cursor: default;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .product-hero {
    padding: 50px 0 80px;
  }

  .product-hero-icon {
    width: 110px;
    height: 110px;
    padding: 18px;
  }

  .product-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .product-title {
    font-size: 1.45rem;
  }

  .final-price {
    font-size: 1.55rem;
  }

  .tabs-content {
    padding: 20px;
  }

  .tab-btn {
    padding: 14px 18px;
    font-size: .85rem;
  }

  .specs-table th {
    width: 130px;
    font-size: .82rem;
  }

  .specs-table td {
    font-size: .82rem;
  }

  .rel-prev,
  .rel-next {
    top: -42px;
  }
}

@media (max-width: 560px) {
  .product-page { margin-top: -50px; }
  .product-hero { padding: 40px 0 70px; }

  .product-hero-icon {
    width: 90px;
    height: 90px;
    padding: 14px;
    border-radius: 16px;
  }

  .breadcrumb { font-size: .72rem; }
  .breadcrumb .current { max-width: 140px; }

  .product-layout { padding: 10px 0 30px; gap: 20px; }

  .product-title { font-size: 1.2rem; }

  .product-short-desc { font-size: .85rem; padding: 10px 12px; }

  .product-price-box { padding: 14px; }

  .final-price { font-size: 1.3rem; }

  .product-form {
    flex-direction: column;
    gap: 10px;
  }

  .qty-box {
    width: 100%;
    justify-content: space-between;
    height: 48px;
  }

  .qty-btn { flex: 1; }
  .qty-input { flex: 1; }

  .add-to-cart-btn {
    width: 100%;
    height: 48px;
    font-size: .9rem;
  }

  .product-features {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 14px;
  }

  .feature-item { font-size: .72rem; gap: 6px; }
  .feature-icon { width: 24px; height: 24px; font-size: .8rem; }

  .gallery-nav { width: 36px; height: 36px; }
  .gallery-prev { left: 10px; }
  .gallery-next { right: 10px; }

  .tabs-content { padding: 16px; }
  .tab-btn { padding: 12px 14px; font-size: .8rem; }

  .specs-table th,
  .specs-table td { padding: 10px 12px; }
  .specs-table th { width: 110px; font-size: .75rem; }
  .specs-table td { font-size: .78rem; }

  .review-item { padding: 14px; }
  .review-item-avatar { width: 38px; height: 38px; font-size: .95rem; }

  .related-title { font-size: 1rem; margin-bottom: 16px; }
  .rel-prev, .rel-next { width: 34px; height: 34px; top: -36px; }
  .rel-next { right: 42px; }
}

/* ═══════════════════════════════════════════════════════
   DARK MODE
═══════════════════════════════════════════════════════ */
[data-theme="dark"] .product-price-box {
  background: linear-gradient(135deg, #2a1a24 0%, #1e1219 100%);
  border-color: #3a1f2a;
}

[data-theme="dark"] .gallery-nav {
  background: rgba(30, 27, 34, .9);
  border-color: #3a3440;
  color: #f8f4f7;
}

[data-theme="dark"] .gallery-nav:hover {
  background: rgba(40, 36, 44, .95);
}

[data-theme="dark"] .gallery-placeholder {
  background: linear-gradient(135deg, #1e1b22, #2a242f);
}

[data-theme="dark"] .review-item {
  background: #1e1b22;
}

[data-theme="dark"] .specs-table th {
  background: #1e1b22;
}

[data-theme="dark"] .specs-table code {
  background: #1e1b22;
}

[data-theme="dark"] .rel-image {
  background: #191620;
}