/* ==========================================================================
   СкладПромо — Карточка товара (PDP) и общие товарные компоненты
   Дизайн-система Nike (DESIGN-nike.md):
   Монохромная база (#111111 / #ffffff / #f5f5f5), акцентный синий (#1151ff),
   Bebas Neue для дисплейных заголовков, чистая 8px-сетка, пилюли-CTA.
   ========================================================================== */

/* ====== ОБЩАЯ ОБЕРТКА СТРАНИЦЫ ТОВАРА ====== */
.product-page-main {
  max-width: 1440px;
  margin: 0 auto 64px;
  padding: 0 24px;
}

@media (max-width: 600px) {
  .product-page-main {
    padding: 0 16px 48px;
  }
}

.product-page-wrap {
  max-width: 1200px;
  margin: 0 auto;
}

/* ====== ХЛЕБНЫЕ КРОШКИ ====== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--mute);
  padding: 20px 0 24px;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--mute);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.bc-sep {
  color: var(--hairline);
  font-size: 0.75rem;
  user-select: none;
}
.breadcrumb span:last-child {
  color: var(--ink);
  font-weight: 500;
}

/* ====== ГЛАВНЫЙ БЛОК ТОВАРА (MEDIA + BUY BOX) ====== */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
  background: var(--canvas);
  padding-bottom: 48px;
  border-bottom: 1px solid var(--hairline-soft);
}

@media (max-width: 920px) {
  .product-detail {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-bottom: 36px;
  }
}

/* МЕДИА-БЛОК (ФОТО) */
.product-detail-media {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: calc(var(--header-h, 60px) + 24px);
}

@media (max-width: 920px) {
  .product-detail-media {
    position: static;
  }
}

.pdp-img-frame {
  width: 100%;
  aspect-ratio: 1;
  background: var(--soft-cloud);
  border: 1px solid var(--hairline-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* .pdp-img-frame теперь ещё и <button> (клик = зум фото в модалке) —
   сбрасываем стили кнопки, чтобы визуально ничем не отличалась от div. */
button.pdp-img-frame {
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
}

.product-detail-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 40px;
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
  display: block;
}
.pdp-img-frame:hover .product-detail-img {
  transform: scale(1.04);
}

/* НАНЕСЕНИЕ ЛОГОТИПА (рендерится только при logo_service_available) */
.product-branding {
  background: var(--soft-cloud);
  border: 1px solid var(--hairline-soft);
  padding: 24px;
  margin-top: 28px;
}
.product-branding h2 { font-size: 1.25rem; margin: 0 0 14px; }
.branding-facts { display: flex; flex-wrap: wrap; gap: 22px; margin: 0 0 12px; }
.branding-fact dt { font-size: .78rem; color: var(--mute); margin-bottom: 4px; }
.branding-fact dd { margin: 0; font-size: .95rem; font-weight: 600; color: var(--ink); display: flex; flex-wrap: wrap; gap: 6px; }
.branding-method {
  background: var(--canvas); border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-pill); padding: 3px 10px; font-size: .82rem; font-weight: 500;
}
.branding-note { font-size: .88rem; color: var(--charcoal); margin: 0; }

/* ОПТОВАЯ СЕТКА ЦЕН */
.wholesale-tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline-soft);
  border: 1px solid var(--hairline-soft);
  margin-top: 12px;
}
.tier-col {
  background: var(--canvas);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
}
.tier-col.active { background: var(--soft-cloud); }
.tier-qty { font-size: 0.76rem; color: var(--mute); }
.tier-price { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.tier-label { font-size: 0.72rem; color: var(--mute); }
.tier-col:not(.active) .tier-label { color: var(--success); font-weight: 600; }

@media (max-width: 420px) {
  .wholesale-tiers { grid-template-columns: 1fr; }
  .tier-col { flex-direction: row; align-items: baseline; justify-content: space-between; text-align: left; }
}

.pdp-zoom-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(17, 17, 17, 0.72);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-detail-no-img {
  width: 100%;
  aspect-ratio: 1;
  background: var(--soft-cloud);
  border: 1px solid var(--hairline-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  font-size: 0.95rem;
}

.card-video-btn {
  align-self: flex-start;
  background: var(--soft-cloud);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.card-video-btn:hover {
  background: var(--hairline-soft);
  border-color: var(--ink);
}

/* ИНФОРМАЦИОННЫЙ БЛОК (BUY BOX) */
.product-detail-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pdp-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.product-detail-article {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--mute);
  background: var(--soft-cloud);
  border: 1px solid var(--hairline-soft);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.pdp-cat-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  transition: background 0.15s;
}
.pdp-cat-tag:hover {
  background: var(--soft-cloud);
}

.product-detail-name {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0;
}

/* ЦЕНОВОЙ БЛОК */
.product-detail-prices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--soft-cloud);
  border: 1px solid var(--hairline-soft);
  padding: 16px 20px;
}

.pdp-prices-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.pdp-retail .pdp-val {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand-accent);
}

.pdp-old-price {
  font-size: 1.1rem;
  color: var(--mute);
  text-decoration: line-through;
  margin: 0;
}

.pdp-sale-note {
  color: var(--sale);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
}

.pdp-opt-note {
  font-size: 0.88rem;
  color: var(--charcoal);
  line-height: 1.4;
  margin: 0;
}

/* НАЛИЧИЕ И ИНТЕРАКТИВНЫЙ ТУЛТИП ОБНОВЛЕНИЯ */
.product-detail-qty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  margin: 2px 0 6px;
  position: relative;
  align-self: flex-start;
}
.product-detail-qty.in-stock {
  color: var(--success);
}
.product-detail-qty.out-stock {
  color: var(--mute);
}
.product-detail-qty .stock-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.pdp-stock-text {
  font-weight: 600;
}

.pdp-stock-tooltip-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--mute);
  cursor: pointer;
  padding: 3px;
  border-radius: 50%;
  transition: color 0.15s, background-color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pdp-stock-tooltip-trigger:hover,
.pdp-stock-tooltip-trigger:focus-visible,
.pdp-stock-tooltip-trigger.is-open {
  color: var(--ink);
  background: var(--hairline-soft);
}

.pdp-tooltip-icon {
  display: block;
}

.pdp-stock-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--ink);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.pdp-stock-tooltip::after {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent var(--ink) transparent transparent;
}
.pdp-stock-tooltip time {
  color: #ffffff;
  font-weight: 600;
}

@media (max-width: 640px) {
  .pdp-stock-tooltip {
    left: -90px;
    right: auto;
    top: calc(100% + 8px);
    bottom: auto;
    transform: translateY(-4px);
  }
  .pdp-stock-tooltip::after {
    left: 96px;
    right: auto;
    top: auto;
    bottom: 100%;
    transform: none;
    border-color: transparent transparent var(--ink) transparent;
  }
}

/* Показ при hover, focus-visible и на мобильных по клику (.is-open) */
.pdp-stock-tooltip-trigger:hover .pdp-stock-tooltip,
.pdp-stock-tooltip-trigger:focus-visible .pdp-stock-tooltip,
.pdp-stock-tooltip-trigger.is-open .pdp-stock-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}

@media (max-width: 640px) {
  .pdp-stock-tooltip-trigger:hover .pdp-stock-tooltip,
  .pdp-stock-tooltip-trigger:focus-visible .pdp-stock-tooltip,
  .pdp-stock-tooltip-trigger.is-open .pdp-stock-tooltip {
    transform: translateY(0);
  }
}

/* Стили тултипа в блоке «Коротко о товаре» */
.pdp-facts-stock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.product-facts .pdp-stock-tooltip {
  left: 50%;
  right: auto;
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
}
.product-facts .pdp-stock-tooltip::after {
  left: 50%;
  right: auto;
  top: 100%;
  bottom: auto;
  transform: translateX(-50%);
  border-color: var(--ink) transparent transparent transparent;
}
.product-facts .pdp-stock-tooltip-trigger:hover .pdp-stock-tooltip,
.product-facts .pdp-stock-tooltip-trigger:focus-visible .pdp-stock-tooltip,
.product-facts .pdp-stock-tooltip-trigger.is-open .pdp-stock-tooltip {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .product-facts .pdp-stock-tooltip {
    left: auto;
    right: -10px;
    transform: translateY(4px);
  }
  .product-facts .pdp-stock-tooltip::after {
    left: auto;
    right: 18px;
    transform: none;
  }
  .product-facts .pdp-stock-tooltip-trigger:hover .pdp-stock-tooltip,
  .product-facts .pdp-stock-tooltip-trigger:focus-visible .pdp-stock-tooltip,
  .product-facts .pdp-stock-tooltip-trigger.is-open .pdp-stock-tooltip {
    transform: translateY(0);
  }
}

.pdp-trust-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pdp-trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--canvas);
  border: 1px solid var(--hairline-soft);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--charcoal);
}
.pdp-trust-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-accent);
}

.product-factual-summary {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--charcoal);
  margin: 0;
}

/* ДЕЙСТВИЯ (КОЛИЧЕСТВО + КНОПКИ) */
.pdp-action-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.pdp-qty-and-cart {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .pdp-qty-and-cart {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
  }
  .wholesale-btn {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }
  .product-detail-info .add-to-cart-btn {
    min-width: 0;
    width: 100%;
  }
}

.pdp-qty-picker {
  display: inline-flex;
  align-items: center;
  background: var(--soft-cloud);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  height: 52px;
  padding: 0 6px;
}
.pdp-qty-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.pdp-qty-btn:hover {
  background: var(--hairline-soft);
}
.pdp-qty-input {
  width: 44px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  outline: none;
}

.product-action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.product-detail-info .add-to-cart-btn {
  flex: 1;
  min-width: 200px;
  height: 52px;
  padding: 0 28px;
  background: var(--ink);
  color: #ffffff;
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.product-detail-info .add-to-cart-btn:hover {
  background: var(--charcoal);
  border-color: var(--charcoal);
}
.product-detail-info .add-to-cart-btn:active {
  transform: scale(0.98);
}
.product-detail-info .add-to-cart-btn.added {
  background: var(--success);
  border-color: var(--success);
}

.wholesale-btn {
  flex: 1;
  min-width: 220px;
  height: 52px;
  padding: 0 24px;
  border: 1px solid var(--ink);
  background: var(--canvas);
  color: var(--ink);
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.wholesale-btn:hover {
  background: var(--soft-cloud);
}

/* ====== СЕКЦИИ СТРАНИЦЫ ТОВАРА (ФАКТЫ, ХАРАКТЕРИСТИКИ, ОПИСАНИЕ) ====== */
.product-facts,
.product-characteristics,
.product-description,
.product-wholesale,
.product-faq,
.related-products {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--hairline-soft);
}

.product-facts h2,
.product-characteristics h2,
.product-description h2,
.product-wholesale h2,
.product-faq h2,
.related-products h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 20px;
}

/* КОРОТКО О ТОВАРЕ (DL) */
.product-facts dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 0;
}
.product-facts dl > div {
  padding: 16px 20px;
  background: var(--soft-cloud);
  border: 1px solid var(--hairline-soft);
}
.product-facts dt {
  color: var(--mute);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  font-weight: 500;
}
.product-facts dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

/* ТАБЛИЦА ХАРАКТЕРИСТИК */
.product-attrs {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--canvas);
}
.product-attrs th,
.product-attrs td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--hairline-soft);
}
.product-attrs th {
  color: var(--mute);
  font-weight: 500;
  width: 220px;
  background: var(--soft-cloud);
}
.product-attrs td {
  color: var(--ink);
  font-weight: 500;
}
.product-attrs thead th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mute);
  background: var(--canvas);
  border-bottom: 2px solid var(--hairline);
  padding: 10px 16px;
}

/* ОПИСАНИЕ И ОБЗОР ТОВАРА */
.product-description p,
.product-overview p {
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--charcoal);
  max-width: 74ch;
  margin: 0 0 12px;
}
.product-overview a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.product-overview a:hover {
  color: var(--brand-accent);
}

/* ====== ОПТОВЫЕ УСЛОВИЯ (B2B ФОРМА) ====== */
.product-wholesale {
  background: var(--soft-cloud);
  border: 1px solid var(--hairline-soft);
  padding: 36px 32px;
  scroll-margin-top: calc(var(--header-h, 60px) + 24px);
}

@media (max-width: 640px) {
  .product-wholesale {
    padding: 24px 16px;
  }
}

.product-wholesale p {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--charcoal);
  max-width: 68ch;
  margin: 0 0 20px;
}

.product-wholesale form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.product-wholesale fieldset {
  display: contents;
}
.product-wholesale textarea,
.product-wholesale form button,
.product-wholesale #wholesale-status {
  grid-column: 1 / -1;
}
.product-wholesale input,
.product-wholesale textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--hairline);
  background: var(--canvas);
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.product-wholesale input:focus,
.product-wholesale textarea:focus {
  border-color: var(--ink);
}
.product-wholesale textarea {
  min-height: 90px;
  resize: vertical;
}
.product-wholesale form button {
  height: 52px;
  background: var(--ink);
  color: #ffffff;
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.product-wholesale form button:hover {
  background: var(--charcoal);
}
.product-wholesale #wholesale-status {
  margin: 4px 0 0;
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--success);
  font-weight: 500;
}

@media (max-width: 560px) {
  .product-wholesale form {
    grid-template-columns: 1fr;
  }
}

/* ====== АККОРДЕОН FAQ ====== */
.product-faq details {
  border-bottom: 1px solid var(--hairline-soft);
  padding: 16px 0;
  transition: background-color 0.15s;
}
.product-faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}
.product-faq summary::-webkit-details-marker {
  display: none;
}
.product-faq summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--mute);
  transition: transform 0.2s;
}
.product-faq details[open] summary::after {
  content: "−";
}
.product-faq p {
  line-height: 1.6;
  margin: 12px 0 0;
  color: var(--charcoal);
  font-size: 0.95rem;
  max-width: 72ch;
}

/* ====== ПОХОЖИЕ ТОВАРЫ ====== */
.related-products > p {
  color: var(--mute);
  font-size: 0.95rem;
}
.related-products .catalog-products-grid {
  margin-top: 16px;
}

/* ====== МОБИЛЬНАЯ ЛИПКАЯ ПАНЕЛЬ ПОКУПКИ (STICKY BAR) ====== */
.pdp-sticky-bar {
  display: none;
}

@media (max-width: 640px) {
  .pdp-sticky-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 95;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid var(--hairline);
    padding: 10px 16px max(10px, env(safe-area-inset-bottom)) 16px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }
  .pdp-sticky-bar.is-visible {
    transform: translateY(0);
  }
  .pdp-sticky-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .pdp-sticky-title {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
  }
  .pdp-sticky-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--brand-accent);
  }
  .pdp-sticky-btn {
    height: 42px;
    padding: 0 20px;
    background: var(--ink);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }
}
