/* ─────────────────────────────────────────────────────────
   Product Page v2 — Optimized Hero (Above-the-fold)
   Blueprint: 60/40 split, sticky buy-box, trust cluster.
   Removed vs v1: compatibility chip, bonus points line.
   ───────────────────────────────────────────────────────── */

html, body {
  overflow-x: clip; /* safety net проти горизонтального скролу */
}

.product-page {
  background-color: #f8f9fa;
  padding-bottom: 64px;
}

.product-breadcrumbs {
  padding: 16px 0;
  font-size: 13px;
  color: #6b7280;
}
.product-breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.product-breadcrumbs a {
  color: #3b82f6;
  text-decoration: none;
}
.product-breadcrumbs a:hover {
  text-decoration: underline;
}
.product-breadcrumbs li[aria-current="page"] {
  color: var(--sh-fg, #09090b);
}

/* ── Hero shell ───────────────────────────────────────── */
.product-hero {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  padding: 24px;
  margin-bottom: 24px;
}

.product-hero__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

/* Critical: дозволяє grid-cell стискатися нижче за свій intrinsic content width.
   Без цього довгий H1 розпирає колонку і створює horizontal overflow на mobile. */
.product-hero__media,
.product-hero__buy-box {
  min-width: 0;
}

@media (min-width: 992px) {
  .product-hero__layout {
    grid-template-columns: 6fr 4fr; /* 60/40 split */
    align-items: start;
  }
  .product-hero__buy-box {
    position: sticky;
    top: 120px;
  }
}

/* ── Media gallery (60%) ──────────────────────────────── */
.product-hero__media {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.product-hero__main-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid var(--sh-border, #e4e4e7);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-hero__main-img img {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
}
.product-hero__thumbnails {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.product-hero__thumb {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border: 1px solid var(--sh-border, #e4e4e7);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s;
  background: #fff;
}
.product-hero__thumb:hover,
.product-hero__thumb.is-active {
  opacity: 1;
  border-color: var(--sh-fg, #09090b);
}
.product-hero__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 5px;
}

/* ── Buy box (40%) ────────────────────────────────────── */
.product-hero__title {
  font-family: 'Exo 2', sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 12px 0;
  color: var(--sh-fg, #09090b);
  overflow-wrap: anywhere; /* довгі коди типу "APC62A" мають переноситись */
}

/* Rating row */
.product-hero__reviews {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #4b5563;
}
.product-hero__stars {
  display: inline-flex;
  gap: 2px;
  color: #fbbf24;
}
.product-hero__stars svg {
  display: block;
}
.product-hero__reviews-link {
  color: #3b82f6;
  text-decoration: none;
}
.product-hero__reviews-link:hover {
  text-decoration: underline;
}

/* Meta line: Виробник · Код · Артикул  (бонуси прибрано) */
.product-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sh-border, #e4e4e7);
}
.product-hero__meta-item strong {
  color: var(--sh-fg, #09090b);
  font-weight: 600;
}
.product-hero__meta-item a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
}
.product-hero__meta-item a:hover {
  text-decoration: underline;
}

/* Price cluster */
.product-hero__price-cluster {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}
.product-hero__price-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.product-hero__price {
  font-family: 'Exo 2', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--sh-fg, #09090b);
  line-height: 1;
}
.product-hero__stock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #16a34a;
  font-weight: 600;
  font-size: 14px;
}
.product-hero__stock::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: #16a34a;
  border-radius: 50%;
}
.product-hero__price-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4b5563;
  margin-top: 8px;
}
.product-hero__price-line + .product-hero__price-line {
  margin-top: 4px;
}
.product-hero__price-line--accent {
  color: #16a34a;
  font-weight: 600;
}
.product-hero__price-line svg {
  flex-shrink: 0;
  color: #64748b;
}
.product-hero__price-line--accent svg {
  color: #16a34a;
}

/* ── Service info (нижче CTA, перед trust strip) ───────── */
.product-hero__service {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px;
  background: #fffbeb; /* теплий фон щоб відділити від price-cluster */
  border: 1px solid #fde68a;
  border-radius: 8px;
}
.product-hero__service-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--sh-fg, #09090b);
  line-height: 1.4;
}
.product-hero__service-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b45309;
}
.product-hero__service-text strong {
  display: block;
  font-weight: 600;
}
.product-hero__service-text span {
  color: #78716c;
  font-size: 12px;
}

/* Warranty options as cards (replacement for <select>) */
.product-hero__options {
  margin-bottom: 20px;
}
.product-hero__option-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--sh-fg, #09090b);
}
.product-hero__option-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.product-hero__option-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  border: 1px solid var(--sh-border, #e4e4e7);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
}
.product-hero__option-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.product-hero__option-card:hover {
  border-color: #94a3b8;
}
.product-hero__option-card:has(input:checked) {
  border-color: var(--sh-fg, #09090b);
  background: #f4f4f5;
}
.product-hero__option-title {
  font-weight: 600;
  color: var(--sh-fg, #09090b);
}
.product-hero__option-price {
  color: #64748b;
  font-size: 12px;
}

/* Actions */
.product-hero__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.product-hero__actions-row {
  display: flex;
  gap: 10px;
}
.product-hero__qty {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--sh-border, #e4e4e7);
  border-radius: 6px;
  overflow: hidden;
  width: 110px;
  flex-shrink: 0;
  background: #fff;
}
.product-hero__qty-btn {
  background: #f1f5f9;
  border: none;
  width: 36px;
  font-size: 18px;
  cursor: pointer;
  color: #475569;
  transition: background 0.15s;
}
.product-hero__qty-btn:hover {
  background: #e2e8f0;
}
.product-hero__qty-input {
  width: 100%;
  border: none;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--sh-fg, #09090b);
  -moz-appearance: textfield;
  background: transparent;
}
.product-hero__qty-input::-webkit-outer-spin-button,
.product-hero__qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.product-hero__btn-primary {
  flex-grow: 1;
  background: var(--sh-fg, #09090b);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: 'Exo 2', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  padding: 12px;
  transition: background-color 0.18s;
}
.product-hero__btn-primary:hover {
  background: var(--sh-fg-hover, #27272a);
}
.product-hero__btn-secondary {
  width: 100%;
  background: transparent;
  color: var(--sh-fg, #09090b);
  border: 1px solid var(--sh-border, #e4e4e7);
  border-radius: 6px;
  padding: 11px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s;
}
.product-hero__btn-secondary:hover {
  background: var(--sh-subtle, #f4f4f5);
}

/* Trust strip */
.product-hero__trust {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--sh-border, #e4e4e7);
}
.product-hero__trust-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.product-hero__trust-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #f1f5f9;
  border-radius: 50%;
  color: #2563eb;
  flex-shrink: 0;
}
.product-hero__trust-text {
  font-size: 13px;
  color: var(--sh-fg, #09090b);
  line-height: 1.35;
}
.product-hero__trust-text strong {
  display: block;
  font-weight: 600;
}
.product-hero__trust-text span {
  color: #64748b;
}
.product-hero__trust-text a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}
.product-hero__trust-text a:hover {
  border-bottom-color: currentColor;
}

/* Tabs/description placeholder */
.product-tabs-placeholder {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  padding: 28px;
  text-align: center;
  color: #64748b;
  border: 2px dashed #cbd5e1;
}
.product-tabs-placeholder p {
  margin: 0 0 6px;
}

/* ── Mobile sticky CTA bar ────────────────────────────── */
.product-mobile-bar {
  display: none;
}

@media (max-width: 991px) {
  .product-hero {
    padding: 16px;
  }
  .product-hero__layout {
    gap: 24px;
  }
  .product-hero__title {
    font-size: 19px;
  }
  .product-hero__price {
    font-size: 28px;
  }
  .product-hero__option-cards {
    grid-template-columns: repeat(3, 1fr); /* 3 cards в ряд на mobile теж */
  }
  .product-hero__option-card {
    padding: 8px 4px;
    font-size: 12px;
  }
  .product-hero__meta {
    gap: 4px 12px;
    font-size: 12px;
  }

  /* Mobile sticky bar: ціна · phone (icon-only secondary) · "В корзину" (primary) */
  .product-mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--sh-border, #e4e4e7);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  }
  .product-mobile-bar__price {
    font-family: 'Exo 2', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--sh-fg, #09090b);
    flex-shrink: 0;
    line-height: 1;
  }
  .product-mobile-bar__phone {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--sh-border, #e4e4e7);
    border-radius: 8px;
    background: #fff;
    color: var(--sh-fg, #09090b);
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s;
  }
  .product-mobile-bar__phone:hover {
    background: var(--sh-subtle, #f4f4f5);
    border-color: #94a3b8;
  }
  .product-mobile-bar__btn {
    flex-grow: 1;
    background: var(--sh-fg, #09090b);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Exo 2', sans-serif;
    font-size: 15px;
    font-weight: 700;
    padding: 12px;
    cursor: pointer;
    min-height: 44px;
  }
  body.product-page {
    padding-bottom: 84px;
  }

  /* Service info: 2 колонки на mobile щоб компактніше */
  .product-hero__service {
    grid-template-columns: 1fr;
  }
}

/* ── Preview toolbar (тільки для прототипу — прибрати в production) ── */
.product-preview-toolbar {
  position: fixed;
  bottom: 100px;
  right: 16px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none; /* щоб клікалися лише кнопки, не порожній простір */
}
.product-preview-toggle {
  pointer-events: auto;
  background: #1f2937;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  white-space: nowrap;
}
.product-preview-toggle:hover {
  background: #111827;
}
@media (min-width: 992px) {
  .product-preview-toolbar {
    bottom: 24px;
  }
}
