/* ================================================================
   Product Detail Page
   ================================================================ */

:root {
  --pd-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pd-dark:   #111827;
  --pd-muted:  #6b7280;
  --pd-border: #e5e7eb;
  --pd-soft:   #f9fafb;
}

body { overflow-x: hidden; }

/* ── Хлебные крошки ───────────────────────────────────────────── */
.pd-breadcrumb {
  background: var(--pd-soft);
  border-bottom: 1px solid var(--pd-border);
  padding: 0.7rem 0;
}

.pd-breadcrumb .breadcrumb {
  font-family: var(--pd-font);
  font-size: 0.78rem;
  margin-bottom: 0;
}

.pd-breadcrumb .breadcrumb-item a {
  color: var(--pd-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.pd-breadcrumb .breadcrumb-item a:hover { color: var(--pd-dark); }

.pd-breadcrumb .breadcrumb-item.active {
  color: var(--pd-dark);
  font-weight: 500;
}

.pd-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: #d1d5db; }

/* ── Основной блок ────────────────────────────────────────────── */
.pd-main {
  padding: 2.5rem 0 3rem;
  background: #fff;
}

/* ── Вкладки Фото / Видео ─────────────────────────────────────── */
.pd-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pd-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  border: 1.5px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 0.85rem;
  color: #6b7280;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s;
}

.pd-tab:hover {
  border-color: #9ca3af;
  color: #374151;
}

.pd-tab--active {
  border-color: var(--pd-dark, #1e293b);
  background: var(--pd-dark, #1e293b);
  color: #fff;
}

/* ── Видео-плеер ──────────────────────────────────────────────── */
.pd-video-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.pd-video-iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* dark mode */
html[data-theme="dark"] .pd-tab {
  border-color: #374151;
  background: #1e293b;
  color: #9ca3af;
}
html[data-theme="dark"] .pd-tab:hover { color: #e2e8f0; border-color: #6b7280; }
html[data-theme="dark"] .pd-tab--active { border-color: #60a5fa; background: #1d4ed8; color: #fff; }

/* ── Галерея ──────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .pd-gallery {
    position: sticky;
    top: 80px;
    align-self: flex-start;
  }
}

@media (max-width: 767px) {
  .pd-gallery { margin-bottom: 1.5rem; }
}

.pd-img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  background: var(--pd-soft);
}

.pd-img--placeholder { opacity: 0.35; }

.pd-img:not(.pd-img--placeholder) { cursor: zoom-in; }

/* Swiper */
.pd-swiper {
  border-radius: 14px;
  overflow: hidden;
}

.pd-swiper .swiper-slide {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.pd-swiper .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.pd-swiper .swiper-button-prev,
.pd-swiper .swiper-button-next {
  color: #fff;
  background: rgba(0, 0, 0, 0.38);
  border-radius: 50%;
  width: 38px;
  height: 38px;
}

.pd-swiper .swiper-button-prev::after,
.pd-swiper .swiper-button-next::after {
  font-size: 14px;
  font-weight: 700;
}

.pd-swiper .swiper-pagination-bullet { background: rgba(255,255,255,0.7); opacity: 1; }
.pd-swiper .swiper-pagination-bullet-active { background: #fff; }

/* ── Лайтбокс ─────────────────────────────────────────────────── */
.pd-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: pdLbIn 0.18s ease;
}

.pd-lightbox.is-open { display: flex; }

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

.pd-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pd-lightbox__close:hover { background: rgba(255, 255, 255, 0.28); }

.pd-lightbox__img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  user-select: none;
}

/* ── Информационная колонка ───────────────────────────────────── */
.pd-info { padding-top: 0.25rem; }

@media (max-width: 767px) { .pd-info { padding-top: 0; } }

.pd-sku {
  font-family: var(--pd-font);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pd-muted);
  font-weight: 600;
  display: block;
  margin-bottom: 0.4rem;
}

.pd-title {
  font-family: var(--pd-font);
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 700;
  color: var(--pd-dark);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

/* ── Секции (Материал / Описание) ─────────────────────────────── */
.pd-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--pd-border);
}

.pd-section__label {
  font-family: var(--pd-font);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pd-dark);
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.pd-section__body {
  font-family: var(--pd-font);
  font-size: 1.025rem;
  color: #1f2937;
  line-height: 1.7;
}

/* ── Скролл-область описания ──────────────────────────────────── */
.pd-desc-wrap {
  position: relative;
}

.pd-description {
  max-height: 220px;
  overflow-y: auto;
  background: var(--pd-soft);
  border: 1px solid var(--pd-border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: #9ca3af var(--pd-border);
}

.pd-description::-webkit-scrollbar { width: 7px; }
.pd-description::-webkit-scrollbar-track {
  background: var(--pd-border);
  border-radius: 4px;
}
.pd-description::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 4px;
}
.pd-description::-webkit-scrollbar-thumb:hover { background: #6b7280; }

/* Кнопки прокрутки */
.pd-desc-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: absolute;
  right: -34px;
  top: 50%;
  transform: translateY(-50%);
}

.pd-desc-arrow {
  width: 28px;
  height: 28px;
  background: var(--pd-soft);
  border: 1px solid var(--pd-border);
  border-radius: 6px;
  color: var(--pd-muted);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.pd-desc-arrow:hover {
  background: var(--pd-border);
  color: var(--pd-dark);
}

@media (max-width: 991px) {
  .pd-desc-arrows { display: none; }
}

@media (max-width: 767px) {
  .pd-description { max-height: none; }
}

/* ── Блок покупки ─────────────────────────────────────────────── */
.pd-purchase { margin-top: 1.5rem; }

.pd-price {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.pd-price__old {
  font-family: var(--pd-font);
  font-size: 1rem;
  color: var(--pd-muted);
  text-decoration: line-through;
}

.pd-price__current {
  font-family: var(--pd-font);
  font-size: clamp(1.65rem, 3vw, 2.1rem);
  font-weight: 700;
  color: var(--pd-dark);
  letter-spacing: -0.025em;
}

/* ── Количество + кнопка ──────────────────────────────────────── */
.pd-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

@media (max-width: 575px) {
  .pd-actions { flex-direction: column; align-items: stretch; }
  .pd-quantity  { width: fit-content; }
}

.pd-quantity {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--pd-border);
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
}

.pd-qty-btn {
  background: var(--pd-soft);
  border: none;
  width: 38px;
  height: 46px;
  font-size: 1.15rem;
  color: var(--pd-dark);
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}

.pd-qty-btn:hover { background: var(--pd-border); }

.pd-qty-input {
  width: 50px;
  height: 46px;
  border: none;
  border-left: 1px solid var(--pd-border);
  border-right: 1px solid var(--pd-border);
  text-align: center;
  font-size: 0.95rem;
  font-family: var(--pd-font);
  color: var(--pd-dark);
  background: #fff;
  -moz-appearance: textfield;
}

.pd-qty-input:focus { outline: none; }
.pd-qty-input::-webkit-inner-spin-button,
.pd-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

.pd-cart-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.6rem;
  background: var(--pd-dark);
  color: #fff;
  border-radius: 9px;
  font-family: var(--pd-font);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  height: 46px;
}

.pd-cart-btn:hover {
  background: #1f2937;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

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

@media (max-width: 575px) { .pd-cart-btn { width: 100%; } }

/* ── Блок «Другие товары» ─────────────────────────────────────── */
.pd-related {
  background: var(--pd-soft);
  padding: 3rem 0 4rem;
  border-top: 1px solid var(--pd-border);
}

/* ── Спиннер ──────────────────────────────────────────────────── */
.spinner {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border: 8px solid #f3f3f3;
  border-top: 8px solid #3498db;
  border-radius: 50%;
  width: 50px; height: 50px;
  animation: spin 1s linear infinite;
  z-index: 9999;
  display: none;
}

@keyframes spin {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Тёмная тема ──────────────────────────────────────────────── */
html[data-theme="dark"] .pd-breadcrumb {
  background: #1f2937;
  border-bottom-color: #374151;
}

html[data-theme="dark"] .pd-breadcrumb .breadcrumb-item a { color: #9ca3af; }
html[data-theme="dark"] .pd-breadcrumb .breadcrumb-item a:hover { color: #f9fafb; }
html[data-theme="dark"] .pd-breadcrumb .breadcrumb-item.active { color: #f9fafb; }
html[data-theme="dark"] .pd-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: #4b5563; }

html[data-theme="dark"] .pd-main { background: #111827; }

html[data-theme="dark"] .pd-img { background: #1f2937; }

html[data-theme="dark"] .pd-sku { color: #6b7280; }
html[data-theme="dark"] .pd-title { color: #f9fafb; }

html[data-theme="dark"] .pd-section { border-bottom-color: #374151; }
html[data-theme="dark"] .pd-section__label { color: #d1d5db; }
html[data-theme="dark"] .pd-section__body  { color: #d1d5db; }

html[data-theme="dark"] .pd-description {
  background: #1f2937;
  border-color: #374151;
  scrollbar-color: #4b5563 #374151;
}
html[data-theme="dark"] .pd-description::-webkit-scrollbar-track { background: #374151; }
html[data-theme="dark"] .pd-description::-webkit-scrollbar-thumb { background: #4b5563; }

html[data-theme="dark"] .pd-desc-arrow {
  background: #1f2937;
  border-color: #374151;
  color: #9ca3af;
}
html[data-theme="dark"] .pd-desc-arrow:hover { background: #374151; color: #f9fafb; }

html[data-theme="dark"] .pd-price__current { color: #f9fafb; }
html[data-theme="dark"] .pd-price__old     { color: #6b7280; }

html[data-theme="dark"] .pd-quantity { border-color: #374151; }
html[data-theme="dark"] .pd-qty-btn  { background: #1f2937; color: #f9fafb; }
html[data-theme="dark"] .pd-qty-btn:hover { background: #374151; }
html[data-theme="dark"] .pd-qty-input {
  background: #111827;
  color: #f9fafb;
  border-left-color: #374151;
  border-right-color: #374151;
}

html[data-theme="dark"] .pd-cart-btn { background: #f9fafb; color: #111827; }
html[data-theme="dark"] .pd-cart-btn:hover { background: #e5e7eb; color: #111827; }

html[data-theme="dark"] .pd-related {
  background: #1f2937;
  border-top-color: #374151;
}

html[data-theme="dark"] .pd-related .section-divider__title { color: #f9fafb; }
html[data-theme="dark"] .pd-related .section-divider__line  { background: #374151; }
html[data-theme="dark"] .pd-related .section-divider__link  { color: #9ca3af; }
html[data-theme="dark"] .pd-related .section-divider__link:hover { color: #f9fafb; }
