/* Глобальные переменные (тема) */
:root {
  --primary-dark: #343B29;
  --secondary-dark: #49543a;
  --accent-green: #689F38;
  --accent-beige: #F8F5F2;
  --text-dark: #333333;
  --text-light: #FFFFFF;
  --alert-red: #D32F2F;
  --hover-green: #558B2F;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Основной контейнер карточки товара */
.product-card-container {
  display: flex;
  gap: 5px;
  padding: 20px;
  max-width: 1200px;
  margin: 20px auto;
}

/* Левая колонка — галерея */
.product-gallery {
  flex: 1;
  min-width: 300px;
}

/* Правая колонка — информация */
.product-info {
  flex: 1;
  padding: 0 20px;
}

/* Главный слайдер Swiper */
.main-swiper {
  height: 500px;
  margin-bottom: 10px;
}

.main-swiper img {
  width: 100%;
  height: 90%;
  object-fit: contain;
}

/* Блок с ценой */
.price-block {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e0e0e0
}

.price {
  font-size: 24px;
  color: #dc3545;
  font-weight: bold;
  margin-bottom: 15px;
  display: block;
}

/* Выбор количества */
.quantity-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: center;
}

.quantity-selector button {
  padding: 5px 15px;
  border: 1px solid #ddd;
  background: #fff;
  justify-content: center;
  cursor: pointer;
}

.quantity-input {
  width: 60px;
  text-align: center;
  padding: 5px;
}

/* Кнопка "В корзину" */
.add-to-cart {
  width: 100%;
  padding: 12px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

/* Табы (описание, характеристики) */
.tabs {
  display: flex;
  border-bottom: 2px solid #eee;
  margin-bottom: 20px;
}

.tab-link {
  padding: 12px 25px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #666;
  position: relative;
}

.tab-link.active {
  color: var(--accent-green);
  font-weight: bold;
}

.tab-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-green);
}

.tab-pane {
  display: none;
  line-height: 1.6;
}

.tab-pane.active {
  display: block;
}

/* Адаптив: планшеты */
@media (max-width: 768px) {
  .product-card-container {
    flex-direction: column;
    padding: 10px;
  }

  .main-swiper {
    height: 300px;
  }

  .thumbnail-swiper {
    height: 70px;
  }

  .product-info {
    padding: 0;
  }

  .price {
    font-size: 20px;
  }

  .main-swiper img {
    height: 41%;
  }
  .price-block {
    align-items: center;text-align: center;
  }
}

/* Адаптив: телефоны */
@media (max-width: 480px) {
  .product-card-container {
    padding: 10px;
  }

  .main-swiper {
    height: 250px;
  }

  .thumbnail-swiper {
    height: 50px;
  }

  .tab-link {
    padding: 10px 15px;
    font-size: 14px;
  }
}

/* Детали цены */
.price-details {
  margin: 10px 0;
  text-align: center;
}

.price-per-pack {
  display: block;
  color: #666;
  font-size: 16px;
}

.total-price {
  margin-top: 15px;
  font-weight: bold;
  font-size: 18px;
}

.totalSum {
    color: var(--text-dark);
    padding: 10px;
    border-radius: 4px;
}

/* Доп. адаптив для деталей цены */
@media (max-width: 480px) {
  .price-details {
    text-align: center;
  }

  .quantity-selector {
    align-items: center;
    justify-content: center;
  }

  .total-price {
    text-align: center;
    margin: 15px 0;
  }

  .add-to-cart {
    font-size: 14px;
  }
}

/* Миниатюры (свайпер) */
.thumbnail-swiper {
  width: 100%;
  margin-top: 10px;
  height: 100px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail-swiper .swiper-slide {
  width: 100px !important;
  height: 100px !important;
  opacity: 0.9;
  cursor: pointer;
  transition: opacity 0.3s;
}

.thumbnail-swiper .swiper-slide-thumb-active {
  opacity: 1;
}

.thumbnail-swiper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 2px solid transparent;
}

.thumbnail-swiper .swiper-slide-thumb-active img {
  border-color: #ff4444;
}

/* Стрелки навигации для миниатюр */
.swiper-button-next-thumb,
.swiper-button-prev-thumb {
  background-color: rgba(0, 0, 0, 0.5);
  color: rgb(0, 0, 0);
  top: 50%;
  transform: translateY(-50%);
}

.swiper-button-next-thumb {
  right: 0;
}

.swiper-button-prev-thumb {
  left: 0;
}

/* Блок "Рекомендуемые товары" */
.recommended-section {
  margin: 40px 0;
  padding: 20px 0;
  border-top: 1px solid #eee;
}

.recommended-title {
  font-size: 24px;
  margin-bottom: 20px;
}

.recommended-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.recommended-item {
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.recommended-item:hover {
  transform: translateY(-5px);
}

.recommended-image {
  width: 100%;
  height: 200px;
  object-fit: contain;
}

.recommended-info {
  padding: 15px;
}

.recommended-name {
  font-size: 16px;
  margin: 0 0 10px 0;
}

.recommended-price {
  font-weight: bold;
  color: #333;
  margin: 0;
}

.recommended-pack-price {
  color: #666;
  font-size: 14px;
  margin: 5px 0 0 0;
}

/* Лупа для изображений */
.image-container {
  position: relative;
  overflow: hidden;
  cursor: none;
}

.magnifier {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
  display: none;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.magnifier-image {
  position: absolute;
  width: 400%;
  height: 400%;
  object-fit: cover;
  transform-origin: 0 0;
}

/* Отключаем лупу на мобильных */
@media (max-width: 768px) {
  .magnifier {
    display: none !important;
  }
}

/* Аксессуары (горизонтальная прокрутка) */
.accessories-section {
  padding: 20px;
  margin-top: 40px;
  border-top: 1px solid #eee;
  overflow-x: scroll;
}

.accessories-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.accessory-item {
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 8px;
}

.accessory-item img {
  width: 100%;
  height: 100px;
  object-fit: contain;
}

.accessory-quantity input {
  width: 50px;
  text-align: center;
}

@media (max-width: 768px) {
  .accessories-section {
    margin-top: 40px;
    border-top: 1px solid #eee;
  }

  .accessories-grid {
    overflow-x: scroll;
    gap: 5px;
    margin-top: 20px;
  }

  .accessory-item {
    padding: 5px;
  }
}

/* Заголовок товара */
.product-title {
  text-align: center;
}

/* Кнопка добавления аксессуара */
.add-accessory-btn {
  margin: 5px;
  margin-top: auto;
  width: 100%;
  height: 32px;
  background: var(--accent-green);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.accessory-quantity {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 12px;
  bottom: 0;
}

.accessory-quantity button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent-green);
  background: #f8f8f8;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.accessory-info h3 {
  height: 170px;
  color: var(--primary-dark);
}

.accessory-quantity button:hover {
  background: var(--hover-green);
}

.accessory-quantity input {
  width: 50px;
  text-align: center;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  -moz-appearance: textfield;
}

.accessory-quantity input::-webkit-outer-spin-button,
.accessory-quantity input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.accessory-image {
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: 8px;
}

/* Управление количеством (общий блок) */
.quantity-control {
  display: flex;
  align-items: center;
  border-radius: 4px;
  margin: 10px 0;
  text-align: center;
}

.quantity-btn {
  padding: 5px 12px;
  background: #f8f8f8;
  border: none;
  cursor: pointer;
}

.quantity-input {
  width: 50px;
  text-align: center;
  border: none;
  border-left: 1px solid #ddd;
  border-right: 1px solid #ddd;
}

.total-sum {
  text-align: center;
  font-weight: 600;
  margin: 10px 0;
  color: var(--primary-dark);
}

.add-to-cart {
  background: #4CAF50;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
}

/* Модальное окно для увеличенного изображения */
.image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  overflow: auto;
  padding: 20px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-modal.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-modal.active .modal-content {
  transform: scale(1);
  opacity: 1;
}

.close-modal {
  position: fixed;
  top: 25px;
  right: 25px;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  z-index: 10001;
  transition: opacity 0.3s;
  background: none;
  border: none;
  padding: 0;
}

.close-modal:hover {
  opacity: 0.8;
}

body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

@media (max-width: 768px) {
  .modal-content {
    max-width: 95%;
    max-height: 85vh;
  }

  .close-modal {
    top: 15px;
    right: 15px;
    font-size: 35px;
  }
}

/* Секция "Укладка" (ukladka) */
#ukladka .ukladka-section {
  padding: 20px 0;
}

.ukladka-title {
  font-size: 20px;
  margin-bottom: 25px;
  color: #333;
  text-align: center;
}

.ukladka-variants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 20px;
}

.ukladka-variant {
  position: relative;
  transition: all 0.3s ease;
}

.ukladka-image-wrapper {
  position: relative;
  height: 120px;
  margin: -20px -20px 0 -20px;
  display: flex;
  justify-content: center;
}

.ukladka-variant img {
  background-color: var(--accent-beige);
  width: 120px;
  height: 120px;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  backface-visibility: hidden;
}

.ukladka-variant:hover {
  z-index: 1000;
}

.ukladka-variant:hover img {
  z-index: 1000;
  transform: scale(1.8);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.ukladka-meta {
  background: #f9f9f9;
  position: relative;
  z-index: 2;
  text-align: center;
}

.variant-title {
  font-weight: 500;
  margin-bottom: 5px;
  color: #444;
}

.variant-percent {
  font-size: 14px;
  color: #666;
}

@media (max-width: 768px) {
  .ukladka-image-wrapper {
    height: 120px;
  }

  .ukladka-variant:hover img {
    transform: scale(1.5);
  }
}

/* Блок скидок */
.discounts-block {
  margin-top: 20px;
  padding: 15px;
  background: #f8f8f8;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.discounts-block h3 {
  margin-top: 0;
  color: #333;
  font-size: 16px;
  margin-bottom: 10px;
}

.discounts-list {
  list-style: none;
  padding-left: 15px;
  margin: 0;
}

.discounts-list li {
  margin-bottom: 8px;
  color: var(--text-dark);
  position: relative;
  padding-left: 20px;
}

.discounts-list li:before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent-green);
}

.discounts-block p {
  text-align: center;
  font-size: 14px;
  color: var(--text-dark);
}

/* Выбор ширины и высоты */
.width-selection,
.height-selection {
  margin: 20px 0;
  padding: 15px;
  background: #f8f8f8;
  border-radius: 8px;
}

.width-selection h3,
.height-selection h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}

.width-options,
.height-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.width-option,
.height-option {
  position: relative;
  padding: 10px 15px;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.width-option:hover,
.height-option:hover {
  border-color: #4CAF50;
}

.width-option input,
.height-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.width-option label,
.height-option label {
  cursor: pointer;
  font-weight: 500;
  color: #444;
}

.width-option.selected,
.height-option.selected {
  border-color: #4CAF50;
  background: #e8f5e9;
}