/* Новая структура галереи товара */
.product-gallery-new {
  width: 100%;
  margin-bottom: 20px;
}

/* Убираем старую галерею если она есть */
.product-gallery {
  display: none !important;
}

.gallery-container {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
}

/* Миниатюры слева */
.thumbnails-vertical {
  flex-shrink: 0;
  width: 100px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
}

.thumbnails-vertical::-webkit-scrollbar {
  width: 5px;
}

.thumbnails-vertical::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.thumbnails-vertical::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.thumbnails-vertical::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.thumbnail-vertical {
  width: 90px;
  height: 90px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

.thumbnail-vertical:hover {
  border-color: #007bff;
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.thumbnail-vertical.active {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.2);
}

.thumbnail-vertical img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.thumbnail-vertical:hover img {
  transform: scale(1.05);
}

/* Основное изображение справа на всю оставшуюся ширину */
.main-image-container-new {
  flex: 1;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #f8f9fa;
}

.main-image-new {
  width: 100%;
  text-align: center;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.main-image-new img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  background: white;
}

/* Принудительное переопределение для изображений в новой галерее */
.product-gallery-new .main-image-new img,
.product-gallery-new .main-image-new a img,
.product-gallery-new .main-image-container-new img {
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 500px !important;
  object-fit: contain !important;
  object-position: center !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border: none !important;
  display: block !important;
}

/* Бейдж скидки */
.discount-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #dc3545;
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Если нет миниатюр, основное изображение занимает всю ширину */
.gallery-container.no-thumbnails {
  display: block;
}

.gallery-container.no-thumbnails .main-image-container-new {
  width: 100%;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .gallery-container {
    flex-direction: column;
    padding: 10px;
  }
  
  .thumbnails-vertical {
    width: 100%;
    flex-direction: row;
    max-height: 80px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-right: 0;
    padding-bottom: 5px;
  }
  
  .thumbnails-vertical::-webkit-scrollbar {
    height: 5px;
    width: auto;
  }
  
  .thumbnail-vertical {
    width: 70px;
    height: 70px;
  }
  
  .thumbnail-vertical:hover {
    transform: translateY(-2px);
  }
  
  .main-image-new img {
    max-height: 400px;
  }
}

/* Стиль для лупы при наведении */
.main-image-new {
  cursor: zoom-in;
}

/* Блок с кнопками смены изображения (для тач-устройств) */
.gallery-nav {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  justify-content: space-between;
  padding: 0 10px;
  pointer-events: none;
}

.gallery-nav button {
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: all;
}

.gallery-nav button:hover {
  background: rgba(0,0,0,0.8);
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .gallery-nav {
    display: flex;
  }
}

/* Счетчик изображений */
.image-counter {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 500;
}
