/* =============================================
   صفحه جزئیات محصول - گالری دُرج 👑 (بازطراحی SSR)
   ============================================= */

/* ---- صفحه ---- */
.pd-page {
  padding: 24px 0 60px;
  animation: pdFade 0.4s ease;
}

@keyframes pdFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- مسیر ---- */
.pd-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.pd-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.pd-breadcrumb a:hover {
  color: var(--gold-500);
}

.pd-breadcrumb__current {
  color: var(--text-primary);
  font-weight: 600;
}

/* ---- چیدمان اصلی ---- */
.pd-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 48px;
  align-items: start;
}

/* ===== گالری ===== */
.pd-gallery {
  position: sticky;
  top: 130px;
}

.pd-gallery__main {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--bg-subtle);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.10);
}

.pd-gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.pd-gallery__main:hover .pd-gallery__img {
  transform: scale(1.03);
}

.pd-gallery__noimg {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 4rem;
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--bg-subtle), var(--border-card));
}

.pd-gallery__noimg p {
  font-size: 1rem;
  color: var(--text-caption);
}

/* نشان موجودی */
.pd-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 2;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.pd-badge--in {
  background: var(--btn-bg, #cfa434);
}

.pd-badge--out {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

/* ناوبری گالری */
.pd-gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.25s;
  backdrop-filter: blur(4px);
}

.pd-gallery__main:hover .pd-gallery__nav {
  opacity: 1;
}

.pd-gallery__nav:hover {
  background: rgba(0, 0, 0, 0.55);
  transform: translateY(-50%) scale(1.1);
}

.pd-gallery__nav--prev { right: 10px; }
.pd-gallery__nav--next { left: 10px; }

.pd-gallery__counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 12px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
}

/* کوچک‌نگاره‌ها */
.pd-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.pd-thumb {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  padding: 0;
  background: var(--bg-subtle);
  transition: all 0.3s ease;
}

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

.pd-thumb:hover,
.pd-thumb.is-active {
  border-color: var(--gold-500);
  transform: translateY(-2px);
}

/* ===== اطلاعات ===== */
.pd-info {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.pd-title {
  font-size: 1.9rem;
  line-height: 1.5;
  color: var(--text-primary);
  margin: 0;
}

.pd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pd-meta__chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(207, 164, 52, 0.07);
  padding: 6px 14px;
  border-radius: 25px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold-600);
  text-decoration: none;
  transition: background 0.2s;
}

.pd-meta__link:hover {
  background: rgba(207, 164, 52, 0.16);
}

/* قیمت */
.pd-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  background: linear-gradient(135deg, rgba(207, 164, 52, 0.08), rgba(207, 164, 52, 0.02));
  border: 1px solid var(--border-gold-light);
  border-radius: 16px;
  padding: 16px 20px;
}

.pd-price__amount {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold-600);
  direction: ltr;
}

.pd-price__unit {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pd-price__note {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-caption);
}

/* ===== سایزها ===== */
.pd-sizes__title {
  font-size: 1rem;
  color: var(--text-primary);
  margin: 0 0 12px;
  font-weight: 700;
}

.pd-sizes__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.pd-size {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  background: var(--bg-card);
  border: 2px solid var(--border-gold);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.25s;
}

.pd-size:hover:not(:disabled) {
  border-color: var(--gold-400);
}

.pd-size.is-active {
  border-color: var(--gold-500);
  background: var(--gold-glow);
}

.pd-size:disabled,
.pd-size.is-out {
  opacity: 0.45;
  cursor: not-allowed;
}

.pd-size__name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pd-size__weight {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.pd-size__price {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-600);
  direction: ltr;
}

.pd-size__stock {
  font-size: 0.7rem;
  color: #2e7d32;
}

.pd-size__stock.is-out {
  color: #c0392b;
}

/* ===== مشخصات ===== */
.pd-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  background: var(--bg-inset);
  border: 1px solid var(--border-gold-light);
  border-radius: 16px;
  padding: 8px 20px;
}

.pd-spec {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-light);
}

.pd-spec:nth-last-child(-n+2) {
  border-bottom: none;
}

.pd-spec__label {
  font-size: 0.85rem;
  color: var(--text-caption);
}

.pd-spec__value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== عملیات ===== */
.pd-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.pd-cart {
  flex: 1;
  min-height: 54px;
  padding: 14px 24px;
  background: var(--btn-bg);
  color: var(--btn-color);
  border: none;
  border-radius: 30px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.pd-cart:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(207, 164, 52, 0.35);
}

.pd-cart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pd-cart svg {
  flex-shrink: 0;
}

.pd-fav {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border: 1px solid var(--border-gold-light);
  background: var(--bg-card);
  border-radius: 16px;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.pd-fav:hover {
  border-color: #dc2626;
  color: #dc2626;
  transform: scale(1.05);
}

.pd-fav.is-liked {
  background: var(--bg-inset);
  border-color: #dc2626;
  color: #dc2626;
}

.pd-fav:disabled {
  opacity: 0.6;
}

/* ===== ضمانت‌ها ===== */
.pd-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding-top: 6px;
}

.pd-trust span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ===== اشتراک ===== */
.pd-share {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-inset);
  border: 1px solid var(--border-gold-light);
  border-radius: 16px;
}

.pd-share > span {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: auto;
}

.pd-share__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-gold);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.25s;
}

.pd-share__btn:hover {
  background: var(--btn-bg);
  color: var(--btn-color);
  border-color: transparent;
  transform: translateY(-2px);
}

/* ===== توضیحات ===== */
.pd-desc {
  margin-top: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold-light);
  border-radius: 20px;
  padding: 30px;
}

.pd-desc__title {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--gold-500);
  display: inline-block;
}

.pd-desc__body {
  color: var(--text-primary);
  line-height: 2.1;
  font-size: 1rem;
}

/* ===== محصولات مشابه ===== */
.pd-similar {
  margin-top: 48px;
}

/* ===== کادر طلایی دور بخش‌های خانواده و مشابه ===== */
.pd-family,
#pdSimilar {
  margin-top: 56px;
  padding: 28px;
  border-radius: var(--radius-xl, 20px);
  background: linear-gradient(180deg, var(--bg-cream, #faf7ef), var(--bg-white));
  border: 1px solid var(--border-gold-light, #f0e6c0);
}

.pd-family .pd-sim,
#pdSimilar .pd-sim {
  border-color: var(--border-gold-light, #f0e6c0);
}

.pd-similar__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.pd-similar__title {
  font-size: 1.4rem;
  color: var(--text-primary);
  margin: 0;
}

.pd-similar__more {
  color: var(--gold-500);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
}

.pd-similar__more:hover {
  color: var(--gold-600);
}

.pd-similar__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

.pd-sim {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  text-align: center;
  border: 1px solid transparent;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.pd-sim:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  border-color: var(--gold-500);
}

.pd-sim__img {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-muted);
}

.pd-sim__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.pd-sim:hover .pd-sim__img img {
  transform: scale(1.08);
}

.pd-sim__body {
  padding: 12px 14px;
}

.pd-sim__body h4 {
  font-size: 0.88rem;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.pd-sim__body span {
  font-size: 0.75rem;
  color: var(--gold-500);
}

.pd-sim__price {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--gold-600, #b8922e);
}

/* ===== اسپینر دکمه ===== */
.pd-spin {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pdSpin 0.6s linear infinite;
}

@keyframes pdSpin {
  to { transform: rotate(360deg); }
}

/* ===== نوتیفیکیشن (توست) ===== */
.pd-toast {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translate(-50%, -30px);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  border-right: 5px solid var(--gold-500);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s ease;
}

.pd-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pd-toast--success { border-right-color: #2e7d32; }
.pd-toast--error { border-right-color: #c0392b; }
.pd-toast--warning { border-right-color: #f39c12; }
.pd-toast--info { border-right-color: var(--gold-500); }

.pd-toast__icon {
  display: inline-flex;
  flex-shrink: 0;
}

.pd-toast--success .pd-toast__icon { color: #2e7d32; }
.pd-toast--error .pd-toast__icon { color: #c0392b; }
.pd-toast--warning .pd-toast__icon { color: #f39c12; }
.pd-toast--info .pd-toast__icon { color: var(--gold-500); }

/* ===== ریسپانسیو ===== */
@media (max-width: 992px) {
  .pd-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .pd-gallery {
    position: static;
  }

  .pd-title {
    font-size: 1.6rem;
  }
}

@media (max-width: 768px) {
  .pd-page {
    padding: 16px 0 40px;
  }

  .pd-gallery__nav {
    opacity: 1;
  }

  .pd-title {
    font-size: 1.4rem;
  }

  .pd-specs {
    grid-template-columns: 1fr;
  }

  .pd-spec:nth-last-child(-n+2) {
    border-bottom: 1px dashed var(--border-light);
  }

  .pd-spec:last-child {
    border-bottom: none;
  }
}

@media (max-width: 480px) {
  .pd-gallery__main {
    aspect-ratio: 3 / 4;
  }

  .pd-gallery__nav {
    opacity: 1;
  }

  .pd-thumb {
    width: 60px;
    height: 60px;
  }

  .pd-similar__grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .pd-desc {
    padding: 20px;
  }

  .pd-price__amount {
    font-size: 1.5rem;
  }
}
