/* =========================================== */
/* PRODUCT-VIEW.CSS — Галерея изображений товара */
/* =========================================== */

/* =========================================== */
/* 1. КОНТЕЙНЕР ГАЛЕРЕИ                        */
/* =========================================== */

.product-gallery {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* =========================================== */
/* 2. ОСНОВНОЕ ИЗОБРАЖЕНИЕ                    */
/* =========================================== */
.product-gallery-main {
  position: relative;
  margin-bottom: 1rem;
  cursor: pointer;
}

.product-gallery-main .img-aspect {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.product-gallery-main img {
  transition: transform 0.3s ease;
}

.product-gallery-main:hover img {
  transform: scale(1.02);
}

/* =========================================== */
/* 3. КНОПКА УВЕЛИЧЕНИЯ                       */
/* =========================================== */

.product-gallery-zoom {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.product-gallery-main:hover .product-gallery-zoom {
  opacity: 1;
}

.product-gallery-zoom:hover {
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.product-gallery-zoom i {
  font-size: 1.25rem;
  color: var(--c-gray-700);
}

/* =========================================== */
/* 4. КАРУСЕЛЬ ПРЕВЬЮ                         */
/* =========================================== */

.product-gallery-thumbs {
  position: relative;
  padding: 1rem 0;
  display: grid;
  grid-template-columns: 1rem 1fr 1rem;
  align-content: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.product-gallery-thumbs-list {
  grid-column: 1 / -1;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 80px;
  gap: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding: 0.5rem 1rem;
  margin: 0;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--c-gray-300) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-padding-right: 1rem;
  scroll-padding-left: 1rem;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: none;
}

.product-gallery-thumbs-list::-webkit-scrollbar {
  height: 6px;
}

.product-gallery-thumbs-list::-webkit-scrollbar-track {
  background: transparent;
}

.product-gallery-thumbs-list::-webkit-scrollbar-thumb {
  background: var(--c-gray-300);
  border-radius: 3px;
}

.product-gallery-thumbs-list::-webkit-scrollbar-thumb:hover {
  background: var(--c-gray-400);
}

/* =========================================== */
/* 5. ПРЕВЬЮ ИЗОБРАЖЕНИЯ                      */
/* =========================================== */

.product-gallery-thumb-item {
  scroll-snap-align: start;
  cursor: pointer;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
  opacity: 0.7;
}

.product-gallery-thumb-item:hover {
  opacity: 1;
  border-color: var(--c-gray-300);
}

.product-gallery-thumb-item.active {
  opacity: 1;
  border-color: var(--c-accent-d);
}

.product-gallery-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* =========================================== */
/* 6. КНОПКИ НАВИГАЦИИ КАРУСЕЛИ ПРЕВЬЮ       */
/* =========================================== */

.product-gallery-thumb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  background: white;
  border: 1px solid var(--c-gray-300);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

.product-gallery-thumb-btn.show {
  display: flex;
}

.product-gallery-thumb-btn:hover {
  background: var(--c-accent-d);
  border-color: var(--c-accent-d);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.product-gallery-thumb-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.product-gallery-thumb-btn i {
  font-size: 0.875rem;
  color: var(--c-gray-700);
  transition: color 0.2s ease;
}

.product-gallery-thumb-btn:hover i {
  color: white;
}

.product-gallery-thumb-btn-prev {
  left: 0.25rem;
}

.product-gallery-thumb-btn-next {
  right: 0.25rem;
}

/* =========================================== */
/* 7. МОДАЛЬНОЕ ОКНО ДЛЯ ИЗОБРАЖЕНИЯ          */
/* =========================================== */

/* Адаптивный размер - подстраивается под размер изображения */
.product-image-modal .modal-container {
  width: auto;
  max-width: 90vw;
  max-height: 90vh;
  margin: auto;
}

.product-image-modal .modal-content {
  background: transparent;
  box-shadow: none;
  padding: 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* Кнопка закрытия - абсолютно позиционирована, без заголовка */
.product-image-modal .modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.product-image-modal .modal-close:hover {
  background: rgba(0, 0, 0, 0.9);
  color: white;
  transform: scale(1.1);
}

/* Скрываем стандартный header */
.product-image-modal .modal-header {
  display: none;
}

.product-image-modal .modal-body {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.9);
  border-radius: var(--radius-lg);
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
}

/* Изображение адаптируется под свой размер, но не превышает размеры экрана */
.product-image-modal img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Кнопки навигации в модальном окне */
.product-image-modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  color: white;
  font-size: 1.5rem;
  transition: all 0.2s ease;
}

.product-image-modal-nav:hover {
  background: var(--c-accent-d);
  border-color: var(--c-accent-d);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.product-image-modal-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.product-image-modal-nav-prev {
  left: 1rem;
}

.product-image-modal-nav-next {
  right: 1rem;
}

.product-image-modal-nav:disabled,
.product-image-modal-nav.hidden {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* =========================================== */
/* 8. АДАПТИВНОСТЬ (МЕДИА-ЗАПРОСЫ)            */
/* =========================================== */

/* === Мобильные и планшеты (до 767.98px) === */
@media (max-width: 767.98px) {
  .product-gallery-thumb-btn {
    display: none !important;
  }

  .product-gallery-thumbs {
    padding: 0.5rem 0;
    grid-template-columns: 0.5rem 1fr 0.5rem;
  }

  .product-gallery-thumbs-list {
    grid-auto-columns: 70px;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    scroll-padding-right: 0.5rem;
    scroll-padding-left: 0.5rem;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
  }

  .product-image-modal .modal-container {
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
  }

  .product-image-modal .modal-content {
    border-radius: 0;
    max-height: 100vh;
  }

  .product-image-modal .modal-body {
    border-radius: 0;
  }
}
