/* Product Gallery Module - Scoped CSS v1.2.1 */
/* Все стили изолированы через специфичные селекторы */
/* HTML остается без изменений - используются стандартные классы Bootstrap */

/* CSS Variables - только для модуля галереи */
.flat-single-product {
  --pg-white: #ffffff;
  --pg-dark: #000000;
  --pg-line: #e5e5e5;
  --pg-primary: #222222;
  --pg-rgba-dark-2: rgba(0, 0, 0, 0.8);
}

/* Изолированные стили только для галереи продукта */
/* Используем .flat-single-product как корневой селектор для изоляции */

.flat-single-product ul,
.flat-single-product li {
  list-style-type: none;
  margin-bottom: 0;
  padding-left: 0;
}

.flat-single-product img {
  max-width: 100%;
  height: auto;
}

/* Section */
.flat-single-product {
  padding: 40px 0;
}

.flat-single-product .tf-main-product {
  padding: 20px 0;
}

/* Product Gallery Slider */
.flat-single-product .product-thumbs-slider {
  display: flex;
  gap: 10px;
}

.flat-single-product .tf-product-media-wrap {
  width: 100%;
}

/* Thumbnails */
.flat-single-product .tf-product-media-thumbs {
  width: 122px;
  flex-shrink: 0;
  max-height: 758px;
}

.flat-single-product .tf-product-media-thumbs .swiper-slide {
  height: max-content;
  width: auto;
}

.flat-single-product .tf-product-media-thumbs .swiper-slide .item {
  position: relative;
  height: 100%;
  cursor: pointer;
}

.flat-single-product .tf-product-media-thumbs .swiper-slide .item img {
  border-radius: 8px;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flat-single-product .tf-product-media-thumbs .swiper-slide .item::after {
  position: absolute;
  content: "";
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  border: 1px solid transparent;
  transition: all 0.3s ease-in-out;
  border-radius: 8px;
}

.flat-single-product .tf-product-media-thumbs .swiper-slide:not(.swiper-slide-thumb-active) .item {
  opacity: 0.6;
}

.flat-single-product .tf-product-media-thumbs .swiper-slide.swiper-slide-thumb-active .item::after {
  border-color: rgba(0, 0, 0, 0.4);
}

/* Main Product Images */
.flat-single-product .flat-wrap-media-product {
  width: calc(100% - 132px);
  position: relative;
}

.flat-single-product .flat-wrap-media-product .tf-product-media-main {
  border-radius: 12px;
  height: 100%;
}

.flat-single-product .flat-wrap-media-product .tf-product-media-main .item {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  max-height: 758px;
  border-radius: 12px;
}

.flat-single-product .flat-wrap-media-product .tf-product-media-main .item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

/* Navigation Buttons */
.flat-single-product .nav-swiper {
  background-color: var(--pg-white);
  border-radius: 999px;
  transition: all 0.3s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--pg-line);
  color: var(--pg-dark);
  cursor: pointer;
  position: absolute;
  z-index: 10;
}

.flat-single-product .nav-swiper::after {
  font-size: 12px;
  color: var(--pg-dark);
  font-weight: 600;
  transition: all 0.3s ease-in-out;
}

.flat-single-product .nav-swiper:hover {
  background-color: var(--pg-rgba-dark-2);
  border-color: var(--pg-rgba-dark-2);
}

.flat-single-product .nav-swiper:hover::after {
  color: var(--pg-white);
}

.flat-single-product .nav-swiper.swiper-button-disabled {
  background-color: rgba(0, 0, 0, 0.4);
  border-color: transparent;
  cursor: not-allowed;
  opacity: 0.5;
}

/* Navigation for thumbnails (vertical by default) */
.flat-single-product .thumbs-next {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.flat-single-product .thumbs-prev {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

/* Navigation for main slider - left and right positioning */
.flat-single-product .flat-wrap-media-product .swiper-button-next,
.flat-single-product .flat-wrap-media-product .swiper-button-prev {
  top: 50%;
  transform: translateY(-50%);
}

.flat-single-product .flat-wrap-media-product .swiper-button-next {
  right: 10px;
  left: auto;
}

.flat-single-product .flat-wrap-media-product .swiper-button-prev {
  left: 10px;
  right: auto;
}

/* Zoom container */
.flat-single-product .tf-zoom-main {
  position: sticky;
  top: 30px;
  z-index: 60;
  pointer-events: none;
}

.flat-single-product .section-image-zoom.zoom-active .tf-zoom-main {
  pointer-events: auto;
}

.flat-single-product .tf-zoom-main .drift-zoom-pane {
  top: 0;
  left: 0;
  height: 520px;
  max-width: 520px;
  width: 100%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(127, 127, 127, 0.02), 0 5px 18px rgba(127, 127, 127, 0.2);
  z-index: 3;
  border-radius: 12px;
  overflow: hidden;
}

/* Изображение внутри zoom линзы - сохраняем пропорции */
.flat-single-product .tf-zoom-main .drift-zoom-pane img {
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  object-fit: contain;
}

.flat-single-product .drift-bounding-box.drift-open {
  background: rgba(255, 255, 255, 0.25);
}

/* Responsive */
@media (max-width: 1199px) {
  .flat-single-product .product-thumbs-slider {
    flex-direction: column;
  }
  
  .flat-single-product .tf-product-media-thumbs {
    width: 100%;
    max-height: none;
    order: 1;
  }
  
  .flat-single-product .flat-wrap-media-product {
    width: 100%;
  }
  
  /* Thumbnails navigation - horizontal on tablets */
  .flat-single-product .thumbs-next,
  .flat-single-product .thumbs-prev {
    top: 50%;
    transform: translateY(-50%);
  }
  
  .flat-single-product .thumbs-prev {
    left: 10px;
  }
  
  .flat-single-product .thumbs-next {
    left: auto;
    right: 10px;
  }
  
  /* Main slider navigation stays left/right on tablets */
  .flat-single-product .flat-wrap-media-product .swiper-button-next {
    right: 10px;
  }
  
  .flat-single-product .flat-wrap-media-product .swiper-button-prev {
    left: 10px;
  }
  
  /* Hide zoom on tablets */
  .flat-single-product .tf-zoom-main {
    display: none;
  }
}

@media (max-width: 767px) {
  .flat-single-product {
    padding: 20px 0;
  }
  
  .flat-single-product .tf-product-media-thumbs {
    display: none;
  }
  
  .flat-single-product .flat-wrap-media-product {
    width: 100%;
  }
  
  /* Main slider navigation on mobile - slightly inside the image */
  .flat-single-product .flat-wrap-media-product .swiper-button-next {
    right: 5px;
  }
  
  .flat-single-product .flat-wrap-media-product .swiper-button-prev {
    left: 5px;
  }
  
  /* Make navigation buttons smaller on mobile */
  .flat-single-product .nav-swiper {
    width: 36px;
    height: 36px;
  }
  
  .flat-single-product .nav-swiper::after {
    font-size: 10px;
  }
  
  /* Ensure zoom is hidden on mobile */
  .flat-single-product .tf-zoom-main {
    display: none;
  }
}
