/* ==========================================================================
   Modal Window Styles - Product Gallery
   Стили модального окна галереи товара
   ========================================================================== */

/* Переопределение Bootstrap модального окна для галереи */
#productModalGallery {
  padding-right: 0 !important;
  background: rgba(0, 0, 0, 0.85);
}

#productModalGallery .modal-dialog {
  margin: 30px auto;
  width: calc(100% - 20px);
  max-width: 1200px;
}

#productModalGallery .modal-content {
  height: 85vh;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#productModalGallery .modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-secondary);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
}

#productModalGallery .modal-body {
  padding: 0;
  height: calc(100% - 60px);
  overflow: hidden;
}

#productModalGallery .modal-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--primary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin: 0;
}

#productModalGallery .modal__header-close {
  border: none;
  background: transparent;
  padding: 8px;
  cursor: pointer;
  margin: 0 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 28px;
  line-height: 1;
}

#productModalGallery .modal__header-close:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* Галерея товара - Основной контейнер */
.product-gallery {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Основное изображение */
.product-gallery__main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

.product-gallery__main img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Миниатюры - Нижняя панель */
.product-gallery__thumbs {
  flex: 0 0 auto;
  height: 90px;
  padding: 10px 20px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-secondary);
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-gallery__thumbs .thumb-item {
  flex: 0 0 70px;
  height: 70px;
  border: 2px solid var(--border-secondary);
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  transition: all 0.2s ease;
}

.product-gallery__thumbs .thumb-item:hover {
  border-color: var(--secondary-color);
}

.product-gallery__thumbs .thumb-item.active {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(0, 113, 184, 0.15);
}

.product-gallery__thumbs .thumb-item img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Десктоп версия - миниатюры справа */
@media screen and (min-width: 992px) {
  .product-gallery {
    flex-direction: row;
  }

  .product-gallery__main {
    flex: 1;
    margin-right: 120px;
  }

  .product-gallery__thumbs {
    position: absolute;
    top: 0;
    right: 0;
    width: 110px;
    height: 100%;
    padding: 20px 10px;
    border-top: none;
    border-left: 1px solid var(--border-secondary);
    overflow-y: auto;
    overflow-x: hidden;
    flex-direction: column;
    gap: 10px;
  }

  .product-gallery__thumbs .thumb-item {
    width: 100%;
    height: 80px;
    flex: 0 0 auto;
  }
}

/* Навигационные кнопки */
.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  opacity: 0.8;
}

.gallery-btn:hover {
  opacity: 1;
  background: var(--bg-primary);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  color: var(--secondary-color);
}

.gallery-btn svg {
  width: 24px;
  height: 24px;
}

.gallery-btn-prev {
  left: 20px;
}

.gallery-btn-next {
  right: 20px;
}

@media screen and (min-width: 992px) {
  .gallery-btn-prev {
    left: 20px;
  }

  .gallery-btn-next {
    right: 140px;
  }
}

@media screen and (max-width: 768px) {
  .gallery-btn {
    width: 40px;
    height: 40px;
  }

  .gallery-btn svg {
    width: 20px;
    height: 20px;
  }

  .gallery-btn-prev {
    left: 10px;
  }

  .gallery-btn-next {
    right: 10px;
  }
}

/* Адаптивность для маленьких экранов */
@media screen and (max-width: 576px) {
  .product-gallery__main {
    padding: 10px;
  }

  .product-gallery__thumbs {
    height: 70px;
    padding: 8px 10px;
  }

  .product-gallery__thumbs .thumb-item {
    flex: 0 0 55px;
    height: 55px;
  }

  #productModalGallery .modal-header {
    padding: 12px 15px;
  }

  #productModalGallery .modal-title {
    font-size: 14px;
  }
}

/* Фокус и доступность */
#productModalGallery .modal__header-close:focus,
.gallery-btn:focus {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

/* Скрытие полос прокрутки в миниатюрах */
.product-gallery__thumbs::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.product-gallery__thumbs::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.product-gallery__thumbs::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 2px;
}

.product-gallery__thumbs::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
