/* ============================================================
   СТРАНИЦА ТОВАРА: галерея, блок покупки, характеристики,
   отзывы с разбивкой оценок, вопросы и «Смотрите также».
   Раскладка в духе маркетплейсов, адаптив — от 360px.
   ============================================================ */

.product-breadcrumb {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
}
.product-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.product-breadcrumb a:hover { color: var(--primary); }
.product-breadcrumb .breadcrumb-item.active { color: var(--primary); }

/* ===== Верхний блок ===== */
.product-top {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  align-items: start;
}

/* --- Галерея --- */
.gallery {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
}
.gallery:only-child,
.gallery:not(:has(.gallery__thumbs)) {
  grid-template-columns: minmax(0, 1fr);
}
.gallery__thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.gallery__thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 96px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery__thumb:hover { transform: translateY(-2px); }
.gallery__thumb.is-active { border-color: var(--primary); }

.gallery__stage {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--glass-border);
}
.gallery__track {
  display: flex;
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gallery__slide {
  flex: 0 0 100%;
  min-width: 100%;
}
.gallery__slide img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}
.gallery__badge {
  position: absolute;
  top: 12px;
  left: 12px;
}
/* Точки нужны только там, где лента листается пальцем */
.gallery__dots { display: none; }

/* --- Блок покупки --- */
.buy-box {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 16px;
}
.buy-box__brand {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.buy-box__name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  margin: 2px 0 8px;
  line-height: 1.25;
}
.buy-box__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.rating-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: var(--text-muted);
}
.rating-inline i { color: var(--gold); }
.rating-inline b { color: var(--text-dark); }
.rating-inline:hover { color: var(--primary); }
.buy-box__article { color: var(--text-light); }

.buy-box__price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.buy-box__price .price__current { font-size: 1.9rem; }
.buy-box__save {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--success);
  background: rgba(46, 125, 50, 0.12);
  padding: 3px 10px;
  border-radius: 30px;
}

/* ===== Секции под верхним блоком ===== */
.product-section {
  margin-top: 36px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.product-section__title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.product-section__count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-light);
}
.product-section__subtitle {
  font-size: 1rem;
  font-weight: 700;
  margin: 20px 0 8px;
}
.product-description {
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}
/* Внутри секции сетка похожих товаров не должна прижиматься к краям */
.product-section .products__grid { margin-top: 4px; }

/* --- Характеристики --- */
.specs { margin: 0; }
.specs__row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(26, 42, 58, 0.1);
}
.specs__row:last-child { border-bottom: none; }
.specs dt {
  color: var(--text-light);
  font-weight: 500;
  font-size: 0.9rem;
}
.specs dd {
  margin: 0;
  color: var(--text-dark);
  font-weight: 600;
  font-size: 0.9rem;
}

/* --- Панель оценок (как в крупных маркетплейсах) --- */
.rating-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  padding: 20px 22px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
}
.rating-panel__score {
  text-align: center;
  min-width: 96px;
}
.rating-panel__value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-dark);
}
.rating-panel__stars {
  color: var(--gold);
  font-size: 0.9rem;
  margin: 8px 0 4px;
}
.rating-panel__total {
  font-size: 0.78rem;
  color: var(--text-light);
  white-space: nowrap;
}
.rating-panel__recommend {
  min-width: 128px;
  padding-left: 24px;
  border-left: 1px solid rgba(26, 42, 58, 0.1);
  text-align: center;
  color: var(--success);
}
.rating-panel__recommend i {
  font-size: 1.1rem;
}
.rating-panel__recommend-value {
  margin-top: 4px;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}
.rating-panel__recommend-label {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--text-muted);
}
.rating-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rating-bar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}
.rating-bar__label {
  color: var(--text-muted);
  white-space: nowrap;
}
.rating-bar__label i {
  color: var(--gold);
  font-size: 0.7rem;
}
.rating-bar__track {
  height: 8px;
  border-radius: 8px;
  background: rgba(26, 42, 58, 0.08);
  overflow: hidden;
}
.rating-bar__fill {
  display: block;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--gold), var(--primary));
  transition: width 0.4s ease;
}
.rating-bar__count {
  color: var(--text-light);
  text-align: right;
}

/* --- Шапка раздела отзывов/вопросов с кнопкой-действием --- */
.feedback {
  margin-bottom: 20px;
}
.feedback__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  cursor: pointer;
  list-style: none;
}
.feedback__head::-webkit-details-marker {
  display: none;
}
.feedback__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-dark);
}
.feedback__count {
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(74, 144, 217, 0.15);
  color: var(--secondary);
  font-size: 0.8rem;
  font-weight: 700;
}
.feedback__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(241, 90, 36, 0.35);
  background: rgba(255, 255, 255, 0.6);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}
.feedback__cta i {
  font-size: 0.8rem;
}
.feedback__head:hover .feedback__cta {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(241, 90, 36, 0.28);
}
/* Раскрытая форма — кнопка гаснет до «свернуть» */
.feedback[open] .feedback__cta {
  border-color: rgba(26, 42, 58, 0.15);
  color: var(--text-muted);
}
.feedback[open] .feedback__head:hover .feedback__cta {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(26, 42, 58, 0.25);
  color: var(--text-dark);
  box-shadow: none;
}
.feedback__form {
  margin-top: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.feedback__field {
  margin-bottom: 12px;
}
.feedback__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}
.feedback__submit {
  margin-top: 12px;
}
.feedback__guest {
  margin: 14px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* --- Пусто: отзывов или вопросов ещё нет --- */
.feedback__empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-light);
}
.feedback__empty i {
  display: block;
  margin-bottom: 10px;
  font-size: 2rem;
}
.feedback__empty p {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--text-muted);
}
.feedback__empty span {
  font-size: 0.85rem;
}

/* Звёзды-переключатель: рисуем в обратном порядке, чтобы CSS-селектор
   «предыдущие соседи» подсвечивал звёзды слева от выбранной */
.star-picker {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
  margin-bottom: 12px;
}
.star-picker input { display: none; }
.star-picker label {
  cursor: pointer;
  font-size: 1.5rem;
  color: rgba(26, 42, 58, 0.18);
  transition: color 0.15s, transform 0.15s;
}
.star-picker label:hover,
.star-picker label:hover ~ label,
.star-picker input:checked ~ label {
  color: var(--gold);
}
.star-picker label:hover { transform: scale(1.12); }

/* --- Отзывы --- */
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.review-card {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.review-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.review-card__avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: var(--white);
  font-weight: 800;
}
.review-card__who { flex: 1; min-width: 0; }
.review-card__name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-dark);
}
.review-card__date {
  font-size: 0.75rem;
  color: var(--text-light);
}
.review-card__stars {
  color: var(--gold);
  font-size: 0.8rem;
  white-space: nowrap;
}
.review-card__text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.review-card__reply {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--secondary);
  text-decoration: none;
}
.review-card__reply:hover { color: var(--primary); }

/* --- Вопросы и ответы --- */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qa-card {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.qa-card__q,
.qa-card__a {
  display: flex;
  gap: 12px;
}
.qa-card__a {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(26, 42, 58, 0.12);
}
.qa-card__marker {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  background: rgba(74, 144, 217, 0.15);
  color: var(--secondary);
}
.qa-card__marker--answer {
  background: rgba(241, 90, 36, 0.15);
  color: var(--primary);
}
.qa-card__body { flex: 1; min-width: 0; }
.qa-card__who {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.qa-card__badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: rgba(241, 90, 36, 0.14);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 20px;
}
.qa-card__date {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-light);
}
.qa-card__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.qa-card__pending {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-light);
  font-style: italic;
}
.qa-card__answer-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(26, 42, 58, 0.12);
}

/* ============================================================
   ПЛАНШЕТЫ И ТЕЛЕФОНЫ
   ============================================================ */
@media (max-width: 991px) {
  .product-top {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .buy-box {
    position: static;
  }
}

@media (max-width: 768px) {
  /* Миниатюры уезжают под фото и листаются вбок — вертикальная колонка
     на узком экране съедала бы половину ширины галереи */
  .gallery {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .gallery__thumbs {
    flex-direction: row;
    order: 2;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .gallery__thumb {
    width: 56px;
    height: 72px;
  }

  /* Лента листается пальцем: нативный скролл с прилипанием к слайду */
  .gallery__track {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    transform: none !important;
    -webkit-overflow-scrolling: touch;
  }
  .gallery__track::-webkit-scrollbar { display: none; }
  .gallery__slide { scroll-snap-align: start; }
  .gallery__slide img { aspect-ratio: 1 / 1; }

  .gallery__dots {
    display: flex;
    gap: 6px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
  }
  .gallery__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(26, 42, 58, 0.25);
    transition: background 0.2s, width 0.2s;
  }
  .gallery__dot.is-active {
    width: 18px;
    border-radius: 6px;
    background: var(--primary);
  }

  .buy-box {
    padding: 16px;
    gap: 14px;
  }
  .buy-box__name { font-size: 1.2rem; }
  .buy-box__price .price__current { font-size: 1.6rem; }

  .product-section {
    margin-top: 20px;
    padding: 16px;
    border-radius: var(--radius-md);
  }
  .product-section__title { font-size: 1.1rem; margin-bottom: 14px; }

  .specs__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 8px 0;
  }

  /* Панель оценок в столбик: полоски получают всю ширину экрана */
  .rating-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
  }
  .rating-panel__value { font-size: 2.4rem; }
  .rating-panel__recommend {
    min-width: 0;
    padding: 14px 0 0;
    border-left: none;
    border-top: 1px solid rgba(26, 42, 58, 0.1);
  }
  /* Заголовок и кнопка на телефоне встают в столбик, кнопка — во всю ширину */
  .feedback__head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  .feedback__cta { justify-content: center; }

  .review-card,
  .qa-card { padding: 14px; }
}

@media (max-width: 480px) {
  .product-breadcrumb {
    font-size: 0.75rem;
    padding: 6px 12px;
  }
  .buy-box__name { font-size: 1.08rem; }
  .buy-box__price .price__current { font-size: 1.45rem; }
  .buy-box__meta { font-size: 0.78rem; gap: 10px; }
  .product-section { padding: 14px; }
  .rating-panel__value { font-size: 2.1rem; }
  .star-picker label { font-size: 1.35rem; }
  .review-card__avatar { width: 34px; height: 34px; font-size: 0.85rem; }
  .review-card__text,
  .qa-card__text { font-size: 0.85rem; }
  .gallery__thumb { width: 50px; height: 64px; }
}
