.product-page {
  padding-top: calc(var(--header-h) + 1.5rem);
  padding-bottom: 4rem;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.product-page > .container {
  width: min(var(--max, 1180px), calc(100% - 2rem));
  max-width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
  min-width: 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
  max-width: 100%;
}

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

.product-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 2rem);
  align-items: start;
  margin-bottom: 2.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.product-gallery {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.gallery-main {
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(15, 23, 42, 0.04));
  min-height: 320px;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  padding: 0.85rem;
}

.gallery-main img,
.gallery-main iframe {
  width: 100%;
  height: 100%;
  max-height: min(70vh, 560px);
  object-fit: contain;
  border-radius: 16px;
  display: block;
}

.gallery-thumbs {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.gallery-thumb {
  width: 84px;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  flex: 0 0 auto;
  background: var(--surface);
}

.gallery-thumb.active {
  border-color: var(--green);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 640px) {
  .gallery-main {
    min-height: 240px;
    padding: 0.6rem;
  }

  .gallery-main img,
  .gallery-main iframe {
    max-height: min(58vh, 360px);
  }
}

.product-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(1rem, 2.2vw, 1.5rem);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.product-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.chip-type {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green-dark);
}

html[data-theme='dark'] .chip-type {
  color: var(--green);
}

.chip-badge {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.product-title {
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.45rem;
}

.product-type {
  color: var(--green);
  font-weight: 800;
  font-size: 0.92rem;
  margin-bottom: 0.65rem;
}

.product-short-desc {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.discount-banner {
  border-radius: 18px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.1rem;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(245, 158, 11, 0.12));
  border: 1px solid rgba(239, 68, 68, 0.18);
}

.discount-banner.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.discount-banner-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.discount-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.discount-banner-text {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 0.65rem;
}

.countdown-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.countdown-box strong {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  letter-spacing: 0.08em;
  color: #ef4444;
  font-variant-numeric: tabular-nums;
}

.price-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.price-panel-deal {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(34, 197, 94, 0.1));
  border-color: rgba(239, 68, 68, 0.22);
  box-shadow: 0 12px 28px rgba(239, 68, 68, 0.08);
}

.price-panel .price-deal-badge {
  display: inline-flex;
  width: fit-content;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 900;
}

.price-panel .price-save {
  font-size: 0.92rem;
  color: #047857;
  font-weight: 700;
}

.price-panel .price-save b {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}

html[data-theme='dark'] .price-panel .price-save {
  color: #6ee7b7;
}

/* Inline purchase widget (compact) */
.purchase-widget {
  margin-bottom: 1rem;
  background: linear-gradient(180deg, rgba(34,197,94,0.02), transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
}

.purchase-widget .pw-group {
  margin-bottom: 0.6rem;
}

.purchase-widget label span {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
}

.purchase-widget input[type="text"],
.purchase-widget input[type="tel"],
.purchase-widget input[type="email"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  color: var(--text);
}

.pw-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
}

.pw-price .label { color: var(--muted); font-size: 0.95rem; }
.pw-price strong { font-size: 1.1rem; color: var(--green); font-weight: 900; }

.pw-actions { text-align: center; }

@media (max-width: 960px) {
  .purchase-widget { padding: 0.75rem; }
}

.price-panel-main {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.price-panel-main strong {
  display: block;
  font-size: clamp(1.6rem, 3.2vw, 2.15rem);
  line-height: 1.1;
  color: var(--green-dark, #15803d);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}

.price-panel-main small {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}

.price-panel-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.product-actions .btn-buy {
  min-width: 180px;
}

.feature-list {
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.92rem;
}

.feature-list li::before {
  content: '✓';
  color: var(--green);
  font-weight: 900;
}

.product-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.details-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.35rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.details-card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.85rem;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  max-width: 100%;
}

.slider-nav {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.slider-arrow {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.3rem;
  display: inline-grid;
  place-items: center;
}

.similar-products-slider {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 260px);
  gap: 0.85rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding-bottom: 0.25rem;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
}

@media (max-width: 640px) {
  .section-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .slider-nav {
    justify-content: flex-end;
  }

  .similar-products-slider {
    grid-auto-columns: minmax(200px, calc(100% - 0.5rem));
    gap: 0.75rem;
  }
}

.similar-product-card {
  scroll-snap-align: start;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.similar-product-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}

.similar-product-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(15, 23, 42, 0.04));
  display: grid;
  place-items: center;
}

.similar-product-media img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.similar-product-content {
  padding: 0.85rem;
}

.similar-product-content h3 {
  font-size: 1rem;
  margin: 0 0 0.45rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.similar-product-content p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
  margin: 0 0 0.65rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.similar-product-price {
  display: inline-flex;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--green-dark);
  font-weight: 900;
  font-size: 0.82rem;
}

.details-body {
  color: var(--muted);
  white-space: pre-wrap;
  line-height: 1.9;
}

.comments-list {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.35rem;
}

.comment-item {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.comment-item-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--slate, #0f172a);
  color: #fff;
  font-weight: 800;
  flex-shrink: 0;
}

.comment-meta strong {
  display: block;
  margin-bottom: 0.15rem;
}

.comment-stars {
  color: #fbbf24;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
}

.comment-item p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.comment-form {
  display: grid;
  gap: 0.95rem;
  padding: 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.04), transparent);
}

.rating-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.rating-picker-label {
  font-size: 0.88rem;
  font-weight: 700;
}

.rating-stars {
  display: inline-flex;
  gap: 0.15rem;
}

.star-btn {
  border: 0;
  background: transparent;
  color: #cbd5e1;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.star-btn.active,
.star-btn.hover {
  color: #fbbf24;
}

.star-btn:hover {
  transform: scale(1.12);
}

.comment-form label span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: var(--bg);
  color: var(--text);
}

#product-price,
#product-original-price {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.form-note {
  color: var(--muted);
  font-size: 0.82rem;
}

.product-card-link {
  cursor: pointer;
}

.product-card-link:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.product-timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-size: 0.74rem;
  font-weight: 800;
}

@media (max-width: 960px) {
  .product-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .product-gallery {
    position: static;
  }

  .product-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-info,
  .details-card {
    padding: 1rem;
    min-width: 0;
    max-width: 100%;
  }

  .price-panel,
  .product-actions,
  .feature-list {
    gap: 0.65rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .countdown-box {
    flex-direction: column;
    align-items: stretch;
  }

  .product-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .product-page {
    padding-top: calc(var(--header-h) + 1rem);
  }

  .breadcrumb {
    font-size: 0.8rem;
  }

  .gallery-main {
    min-height: 240px;
    padding: 0.6rem;
  }

  .gallery-main img,
  .gallery-main iframe {
    max-height: min(55vh, 340px);
  }

  .gallery-thumb {
    width: 74px;
  }

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

  .price-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .product-actions {
    flex-direction: column;
  }

  .product-actions .btn-buy {
    min-width: 100%;
  }

  .details-card,
  .product-info {
    padding: 1rem;
    border-radius: 18px;
  }

  .similar-products-slider {
    grid-auto-columns: minmax(200px, calc(100% - 0.5rem));
  }
}
