/* Компактные товары — только главная страница (сетка 2×5 и карусель) */

.compact-products {
  margin-top: 60px;
}

/* Главная: фон для grid с возможностью менять прозрачность */
.compact-products.compact-products--grid {
  position: relative;
  background-color: transparent;
}

.compact-products.compact-products--grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: var(--compact-products-grid-bg-color, transparent);
  background-image: var(--compact-products-grid-bg-image, url("/wp-content/uploads/bg-main2-scaled.avif"));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: var(--compact-products-grid-bg-opacity, 1);
  pointer-events: none;
  z-index: 0;
}

.compact-products.compact-products--grid > .container {
  position: relative;
  z-index: 1;
}

.compact-products__content {
  padding: 48px 0;
}

.compact-products > .container {
  padding-left: 0;
  padding-right: 0;
}

.compact-products__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
  padding-left: 0;
  padding-right: 0;
}

.compact-products__title {
  color: var(--text-color);
  font-size: 25px;
  font-style: normal;
  font-weight: 400;
  line-height: 100%;
  margin: 0;
}

/* Главная: отступы heading на мобиле */

/* На главной странице стрелки не нужны */
.compact-products__nav {
  display: none;
}

/* Карусель на главной */
.compact-products__carousel.carousel-container {
  display: flex;
  width: 100%;
}

.compact-products__carousel .compact-products__swiper-wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.compact-products__carousel .compact-products__swiper {
  width: 100%;
  overflow: hidden;
}

.compact-products__carousel .compact-products__swiper .swiper-wrapper {
  align-items: stretch;
}

.compact-products__carousel .compact-products__swiper .swiper-slide {
  height: auto;
  box-sizing: border-box;
}

.compact-products__prev,
.compact-products__next {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.compact-products__prev svg,
.compact-products__next svg {
  width: 20px;
  height: 20px;
}

.compact-products__prev svg path,
.compact-products__next svg path {
  transition: 0.3s ease all;
}

@media (hover: hover) {
  .compact-products__next:hover svg path {
    transform: translateX(3px);
  }

  .compact-products__prev:hover svg path {
    transform: translateX(-3px);
  }
}

.compact-products__swiper {
  position: relative;
  width: 100%;
}

.compact-products__slide {
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  transition: border-color 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
}

@media (hover: hover) {
  .compact-products__slide:hover {
    border-color: var(--accent, #ffeba5);
  }
}

.compact-products__card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.compact-products__image-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  border-radius: 8px 8px 0 0;
}

.compact-products__image-wrapper .compact-products__price-discount {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
}

.compact-products__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.compact-products__card-content {
  padding: 12px;
  background: rgba(38, 38, 38, 0.95);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 100px;
}

.compact-products__card-title {
  color: var(--text-color);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  /* stylelint-disable property-no-vendor-prefix */
  -webkit-line-clamp: 3;
  /* stylelint-enable property-no-vendor-prefix */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compact-products__category {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0;
}

.compact-products__price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  align-self: stretch;
  width: 100%;
  min-height: 2.25rem;
  padding: 0.35rem 0.6rem;
  background: linear-gradient(135deg, #ffeba5 0%, #ffeba5 45%, rgba(255, 255, 255, 0.9) 100%);
  border-radius: 0 0 8px 8px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.compact-products__price-bar .woocommerce-Price-amount,
.compact-products__price-bar bdi,
.compact-products__price-bar .woocommerce-Price-currencySymbol {
  color: rgba(0, 0, 0, 0.55);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: line-through;
}

.compact-products__price-right {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.compact-products__price-right .woocommerce-Price-amount,
.compact-products__price-right bdi,
.compact-products__price-right .woocommerce-Price-currencySymbol {
  color: rgba(0, 0, 0, 0.9);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.compact-products__price-discount {
  padding: 3px 5px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: var(--buttons-gradient);
  color: var(--accent-dark);
  font-size: 14px;
  font-style: normal;
  font-weight: 600;
  line-height: 100%;
}

/* Сетка 2×5 на главной (десктоп) */
.compact-products--grid > .container {
  padding-left: 0;
  padding-right: 0;
}

.compact-products--grid .compact-products__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  width: 100%;
  align-items: stretch;
  row-gap: 40px;
}

.compact-products--grid .compact-products__grid .compact-products__slide {
  min-width: 0;
  height: 100%;
  display: flex;
}

.compact-products--grid .compact-products__card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

@media (max-width: 999px) {
  .compact-products--grid .compact-products__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Мобильная версия — главная */
@media (max-width: 768px) {
  .compact-products {
    margin-top: 40px;
  }

  .compact-products.compact-products--grid .compact-products__image {
    width: 100%;
    height: auto;
  }

  .compact-products__content {
    padding: 20px 0;
  }

  .compact-products__heading {
    margin-bottom: 10px;
  }

  /* Мобила: карусель с отступом слева, grid без отступа */
  .compact-products:not(.compact-products--grid) .compact-products__heading {
    padding-left: 15px;
  }

  .compact-products.compact-products--grid .compact-products__heading {
    padding-left: 0;
  }

  .compact-products__title {
    font-size: 20px;
    padding-bottom: 15px;
  }

  .compact-products__swiper-wrap {
    padding: 0 15px;
  }

  /* Grid на мобиле — один ряд и отступы как у карусели */
  .compact-products--grid > .container {
    padding-left: 15px;
    padding-right: 15px;
  }

  .compact-products--grid .compact-products__grid-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    padding: 0 15px;
  }

  .compact-products--grid .compact-products__grid-scroll::-webkit-scrollbar {
    display: none;
  }

  .compact-products--grid .compact-products__grid {
    display: flex;
    flex-direction: row;
    grid-template-columns: unset;
    gap: 8px;
    width: max-content;
  }

  .compact-products--grid .compact-products__grid .compact-products__slide {
    flex: 0 0 auto;
    min-width: 220px;
    scroll-snap-align: start;
  }

  .compact-products__prev,
  .compact-products__next {
    width: 30px;
    height: 30px;
    padding: 3px;
  }

  .compact-products__prev svg,
  .compact-products__next svg {
    width: 18px;
    height: 18px;
  }

  .compact-products__card-content {
    padding: 12px;
    gap: 8px;
    min-height: 100px;
  }

  .compact-products__price-row {
    min-height: 2rem;
    padding: 0.3rem 0.5rem;
  }

  .compact-products__price-right .woocommerce-Price-amount,
  .compact-products__price-right bdi {
    font-size: 16px;
  }

  .compact-products__price-bar .woocommerce-Price-amount,
  .compact-products__price-bar bdi {
    font-size: 11px;
  }

  .compact-products__card-title {
    font-size: 12px;
    /* stylelint-disable property-no-vendor-prefix */
    -webkit-line-clamp: 3;
    /* stylelint-enable property-no-vendor-prefix */
    line-height: 1.3;
  }

  .compact-products__category {
    font-size: 12px;
  }

  .compact-products__price-discount {
    font-size: 12px;
    padding: 4px;
  }

  /* Grid на мобиле — ширина карточек как у карусели */
  .compact-products--grid .compact-products__grid .compact-products__slide {
    flex: 0 0 180px;
    min-width: 180px;
    max-width: 180px;
  }
}
