/* ==========
   1. Главная страница
   ========== */

body.home-page {
  background: radial-gradient(circle at top, #ecfdf3 0, #f9fafb 45%, #f1f5f9 100%);
}

.home-hero {
  padding: 28px 0 18px;
}

.home-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 26px;
  align-items: center;
}

.home-hero__title {
  font-size: 2.1rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.home-hero__subtitle {
  margin-top: 10px;
  font-size: 0.98rem;
  color: var(--sg-color-text-muted);
}

.home-hero__bullets {
  margin-top: 14px;
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.home-hero__bullet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.home-hero__bullet-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
  flex-shrink: 0;
}

.home-hero__aside {
  align-self: stretch;
}

.home-hero__card {
  background-color: #ffffff;
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: var(--sg-shadow-soft);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.home-hero__card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.home-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #166534;
  font-size: 0.8rem;
}

.home-hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--sg-color-text-muted);
}

.home-hero__note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--sg-color-text-muted);
}

/* Блок категорий на главной */

.home-categories {
  margin-top: 26px;
}

.home-categories__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.home-categories__title {
  font-size: 1.1rem;
  font-weight: 600;
}

.home-categories__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-categories__tab {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  font-size: 0.8rem;
  color: var(--sg-color-text-muted);
}

.home-categories__tab--active {
  border-color: #22c55e;
  background-color: #ecfdf3;
  color: #166534;
}

/* ==========
   2. Листинг категории
   ========== */

body.listing-page {
  background-color: #f9fafb;
}

.listing-header {
  margin-bottom: 14px;
}

.listing-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.listing-title h1 {
  font-size: 1.6rem;
  font-weight: 700;
}

.listing-title__count {
  font-size: 0.85rem;
  color: var(--sg-color-text-muted);
}

.listing-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  justify-content: space-between;
  align-items: center;
}

.listing-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.listing-sort {
  font-size: 0.85rem;
  color: var(--sg-color-text-muted);
}

/* Верхний/нижний SEO-текст */

.listing-text {
  margin: 18px 0;
  font-size: 0.92rem;
  color: var(--sg-color-text);
}

.listing-text p + p {
  margin-top: 8px;
}

/* Пагинация */

.pagination {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
}

.pagination__link {
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sg-color-border);
  background-color: #ffffff;
}

.pagination__link--active {
  border-color: #16a34a;
  background-color: #ecfdf3;
  color: #166534;
  font-weight: 600;
}

/* ==========
   3. Карточка товара
   ========== */

body.product-page {
  background-color: #f9fafb;
}

.product-page .product__title {
  margin-bottom: 6px;
}

.product__rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--sg-color-text-muted);
}

.product__rating-stars {
  display: inline-flex;
  gap: 2px;
  font-size: 0.9rem;
}

.product__price {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-size: 1.4rem;
  font-weight: 700;
}

.product__short-desc {
  font-size: 0.95rem;
  color: var(--sg-color-text-muted);
  margin-top: 6px;
}

/* Стили для вариантов цен*/

.product__price-variants {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.price-variant {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.price-variant:hover {
  border-color: #22c55e;
  background: #ecfdf3;
}

.price-variant__qty {
  font-size: 0.9rem;
  color: #475569;
  font-weight: 500;
}

.price-variant__price {
  font-size: 1.25rem;
  font-weight: 700;
  color: #166534;
}

/* Нет в наличии */
.product__price--unavailable {
  padding: 16px;
  background: #f8fafc;
  border-radius: 10px;
  text-align: center;
  color: #64748b;
  font-size: 1rem;
  margin-bottom: 16px;
  border: 1px dashed #cbd5e1;
}

.stock-badge--out-of-stock {
  background: #fef3c7;
  color: #92400e;
}

.stock-badge--out-of-stock .stock-badge__icon {
  background: #fff;
  color: #f59e0b;
}

/* Стили для отсутствия товара */
.product__price--unavailable {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  text-align: center;
  color: #6c757d;
  font-size: 16px;
  margin-bottom: 16px;
}

.stock-badge--out-of-stock {
  background: #ffc107;
  color: #000;
}

.stock-badge--out-of-stock .stock-badge__icon {
  background: #fff;
  color: #ffc107;
}

/* Адаптивность */
@media (max-width: 576px) {
  .price-variant {
    padding: 10px 12px;
  }

  .price-variant__price {
    font-size: 16px;
  }

  .price-variant__qty {
    font-size: 13px;
  }
}

/* Галерея на карточке */

.product__gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.gallery__main {
  flex: 1;
  min-height: 400px;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 20% 0, #f1f5f9 0, #e5e7eb 40%, #d1d5db 100%);
  box-shadow: var(--sg-shadow-sm);
}

.gallery__images {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 400px;
}

.gallery__slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
}

.gallery__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
}

/* CSS-only переключение галереи */
.gallery__radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gallery__radio:checked + .gallery__slide {
  display: block;
}

/* Миниатюры */
.gallery__thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.thumb__label {
  flex: 0 0 70px;
  height: 70px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.2s ease;
  background: #f1f5f9;
}

.thumb__label:hover {
  opacity: 0.9;
  border-color: #cbd5e1;
}

.thumb__label img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Активная миниатюра через селекторы ~ */
.gallery__radio:nth-of-type(1):checked ~ .gallery__thumbs .thumb__label:nth-child(1),
.gallery__radio:nth-of-type(2):checked ~ .gallery__thumbs .thumb__label:nth-child(2),
.gallery__radio:nth-of-type(3):checked ~ .gallery__thumbs .thumb__label:nth-child(3),
.gallery__radio:nth-of-type(4):checked ~ .gallery__thumbs .thumb__label:nth-child(4),
.gallery__radio:nth-of-type(5):checked ~ .gallery__thumbs .thumb__label:nth-child(5) {
  border-color: #22c55e;
  opacity: 1;
}
/* Блок «Преимущества» */

.product__highlights {
  margin-top: 10px;
}

.highlights__title {
  font-size: 1rem;
  margin-bottom: 8px;
}

.highlights__list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.highlight__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

/* Контент табов */

.product__tabs {
  margin-top: 32px;
}

.tab__radio {
  position: absolute;
  opacity: 0;
}

.tabs__header {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: -2px;
  position: relative;
  z-index: 1;
}

.tab__label {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab__label:hover {
  color: #166534;
}

/* Активный таб */
#tab-desc:checked ~ .tabs__header label[for="tab-desc"],
#tab-specs:checked ~ .tabs__header label[for="tab-specs"],
#tab-reviews:checked ~ .tabs__header label[for="tab-reviews"],
#tab-delivery:checked ~ .tabs__header label[for="tab-delivery"] {
  color: #166534;
  border-bottom-color: #22c55e;
}

/* Контент табов */
.tabs__content {
  position: relative;
  background: #ffffff;
  border-radius: 0 0 14px 14px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-top: none;
}

.tab__pane {
  display: none;
}

#tab-desc:checked ~ .tabs__content #tab-desc-content,
#tab-specs:checked ~ .tabs__content #tab-specs-content,
#tab-reviews:checked ~ .tabs__content #tab-reviews-content,
#tab-delivery:checked ~ .tabs__content #tab-delivery-content {
  display: block;
}

/* Стили для HTML-описания из базы */
.product__full-desc {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--sg-color-text);
}

.product__full-desc h2,
.product__full-desc h3,
.product__full-desc h4 {
  margin: 24px 0 12px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--sg-color-text);
}

.product__full-desc h2 {
  font-size: 1.25rem;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.product__full-desc h3 {
  font-size: 1.1rem;
  color: #166534;
}

.product__full-desc h4 {
  font-size: 1rem;
}

.product__full-desc p {
  margin-bottom: 12px;
}

.product__full-desc ul,
.product__full-desc ol {
  margin: 12px 0;
  padding-left: 24px;
}

.product__full-desc li {
  margin-bottom: 6px;
}

.product__full-desc strong {
  font-weight: 600;
  color: #1f2937;
}

.product__full-desc blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  background: #f8fafc;
  border-left: 4px solid #22c55e;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

/* Ссылки категорий в описании */
.product-subcategories {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.subcategory-link {
  display: inline-block;
  padding: 4px 12px;
  margin: 2px;
  background: #ecfdf3;
  color: #166534;
  text-decoration: none;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.subcategory-link:hover {
  background: #dcfce7;
}

/* Характеристики в табе */

.specs__grid--full {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.spec__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.spec__name {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.spec__value {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

/* Блок отзывов */

.reviews__summary {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.reviews__empty {
  padding: 10px 12px;
  border-radius: 10px;
  background-color: #f9fafb;
  border: 1px dashed rgba(226, 232, 240, 0.9);
  font-size: 0.9rem;
  color: var(--sg-color-text-muted);
}

/* Блок доставки */

.delivery-block {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
}

.delivery-block__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ==========
   4. Адаптив
   ========== */

@media (max-width: 960px) {
  .home-hero__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-hero__aside {
    order: -1;
  }

  /* Карточка товара на планшете */
  .product {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .gallery__main {
    min-height: 350px;
  }

  .gallery__images {
    min-height: 350px;
  }
}

@media (max-width: 768px) {
  .product {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .gallery__main {
    min-height: 300px;
  }

  .gallery__images {
    min-height: 300px;
  }

  .thumb__label {
    flex: 0 0 60px;
    height: 60px;
  }

  .product__title {
    font-size: 1.25rem;
  }

  .tabs__header {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs__header::-webkit-scrollbar {
    display: none;
  }

  .tab__label {
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .tabs__content {
    padding: 16px;
  }

  .specs__grid--full {
    grid-template-columns: 1fr;
  }

  .product__features {
    grid-template-columns: 1fr;
  }

  .price-variant {
    padding: 12px 14px;
  }

  .price-variant__price {
    font-size: 1.1rem;
  }
}

@media (max-width: 640px) {
  .home-hero {
    padding-top: 18px;
  }

  .home-hero__title {
    font-size: 1.7rem;
  }

  .gallery__main {
    min-height: 280px;
  }

  .gallery__images {
    min-height: 280px;
  }
}

@media (max-width: 480px) {
  .gallery__main {
    min-height: 250px;
  }

  .gallery__images {
    min-height: 250px;
  }

  .product__title {
    font-size: 1.1rem;
  }

  .breadcrumb {
    font-size: 0.8rem;
    flex-wrap: wrap;
  }

  .product__full-desc h2 {
    font-size: 1.1rem;
  }

  .product__full-desc h3 {
    font-size: 1rem;
  }

  /* Mobile: compact purchase button */
  .btn--purchase .btn__text {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .btn__text-sub {
    font-size: 0.65rem;
  }

  .btn--purchase .btn__icon {
    font-size: 1rem;
    padding: 3px;
  }

  /* Mobile: header CTA compact */
  .btn--header-cta {
    padding: 5px 10px;
  }

  .btn--header-cta .btn__text-main {
    font-size: 0.8rem;
  }

  .btn--header-cta .btn__text-sub {
    font-size: 0.6rem;
  }
}