/* === СТРАНИЦА ТОВАРА === */
#product-page {
  padding: 60px 10%;
  background: var(--bg-body);
  min-height: 100vh;
}

.product-container {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: flex-start;
}

/* === ГАЛЕРЕЯ === */
.product-gallery {
  flex: 1;
  min-width: 300px;
}

.product-gallery h1 {
  font-size: 28px;
  color: var(--text-heading);
  margin-bottom: 16px;
  font-weight: 700;
}

.main-image {
  width: 100%;
  height: auto;
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.main-image img:hover {
  transform: scale(1.05);
}

/* Модальное окно галереи */
.gallery-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.gallery-modal.active {
  display: flex;
}

/* Контейнер для большого изображения */
.modal-image-container {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
}

/* Большое изображение в модальном окне */
.modal-image {
  transition: transform 0.3s ease;
  transform-origin: center center;
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
  object-fit: contain;
}

/* Кнопки навигации */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.7);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.9);
}

.prev-btn {
  left: -60px;
}

.next-btn {
  right: -60px;
}

/* Индикатор текущего изображения */
.image-counter {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 14px;
}

/* Кнопка закрытия */
.close-btn {
  position: absolute;
  top: -50px;
  right: 0;
  background: none;
  border: none;
  color: white;
  font-size: 30px;
  cursor: pointer;
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
  .modal-image-container {
    max-width: 95%;
    max-height: 90vh;
  }

  .nav-btn {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }

  .prev-btn {
    left: 10px; /* Сдвигаем внутрь экрана */
  }

  .next-btn {
    right: 10px; /* Сдвигаем внутрь экрана */
  }

  .image-counter {
    bottom: -40px;
    font-size: 16px;
  }

  .close-btn {
    top: -60px;
    right: 15px;
  }

  /* Скрываем стрелки на мобильных — будем использовать свайпы */
  .nav-btn {
    display: none;
  }
}

/* Стиль для заглушки отсутствия фото */
.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 24px;
  color: #999;
  background: #f5f5f5;
}

/* Корректировка контейнера миниатюр — чтобы не было лишнего места */
.thumbnails {
  padding-bottom: 8px;
}

.thumbnails {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.thumbnails::-webkit-scrollbar {
  height: 6px;
}

.thumbnails::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail.active {
  border-color: #e44247;
}

.thumbnail:hover {
  border-color: #e44247;
}

/* === ЦЕНА И КНОПКА ПОД ГАЛЕРЕЕЙ === */
.gallery-footer {
  margin-top: 20px;
  text-align: center;
}

.price-and-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.price {
  font-size: 28px;
  font-weight: bold;
  color: #e44247;
  flex-shrink: 0;
}

.add-to-cart {
  background: #e44247;
  color: white;
  border: none;
  padding: 14px 28px;
  font-size: 18px;
  border-radius: 25px;
  cursor: pointer;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.add-to-cart:hover {
  background: #c73a3e;
  transform: translateY(-2px);
}

/* Цена, старая цена и скидка в одну строку */
.price-block-inline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.old-price-inline {
  font-size: 18px;
  color: #999;
  text-decoration: line-through;
  white-space: nowrap;
}

.discount-badge-inline {
  background: #e44247;
  color: #fff;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

/* Кнопки избранного и сравнения */
.product-extra-actions {
  display: flex;
  gap: 10px;
}

.extra-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ddd;
  border-color: var(--border-input);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.extra-btn:hover {
  border-color: #e44247;
  transform: scale(1.1);
}

.extra-btn.active {
  background: #e44247;
  border-color: #e44247;
  color: #fff;
}

/* Плашка на главном фото */
.main-image {
  position: relative;
}

/* Контейнер плашек на фото */
#product-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

/* Плашки внутри контейнера */
#product-badges .product-page-badge {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  background: linear-gradient(135deg, #e44247, #c73a3e);
}

/* Скидка — можно сделать другого цвета */
#product-badges .badge-discount {
  background: #e44247;
}

.measurer-btn {
  width: 100%;
  margin-top: 12px;
  padding: 14px 20px;
  background: var(--bg-measurer-btn);
  color: #e44247;
  border: 2px solid #e44247;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.measurer-btn:hover {
  background: #e44247;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(228, 66, 71, 0.3);
}

/* ===== Плавающая кнопка «Вызвать замерщика» ===== */
.floating-measurer {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 999;
}

.floating-measurer-btn {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: #e44247;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(228, 66, 71, 0.35);
  white-space: nowrap;
  overflow: hidden;
  width: auto;
  height: auto;
  transition: 
    border-radius 0.5s ease,
    padding 0.5s ease,
    width 0.5s ease,
    box-shadow 0.3s ease,
    background 0.3s ease,
    transform 0.3s ease;
}

.floating-measurer-btn:hover {
  background: #c73a3e;
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(228, 66, 71, 0.45);
}

.floating-measurer-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.floating-measurer-text {
  display: inline-block;
  max-width: 200px;
  margin-left: 10px;
  opacity: 1;
  transition: 
    max-width 0.5s ease,
    margin-left 0.5s ease,
    opacity 0.3s ease 0.2s;
  overflow: hidden;
  white-space: nowrap;
}

/* Свёрнутое состояние */
.floating-measurer.collapsed .floating-measurer-btn {
  border-radius: 50%;
  padding: 14px;
}

.floating-measurer.collapsed .floating-measurer-text {
  max-width: 0;
  margin-left: 0;
  opacity: 0;
  transition: 
    max-width 0.5s ease,
    margin-left 0.5s ease,
    opacity 0.15s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
  .floating-measurer {
    bottom: 20px;
    right: 20px;
  }
  
  .floating-measurer-btn {
    padding: 12px 20px;
    font-size: 14px;
  }
  
  .floating-measurer.collapsed .floating-measurer-btn {
    padding: 12px;
  }
}
/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .price-and-button {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .add-to-cart {
    width: 100%;
    justify-content: center;
  }
}

/* Ширина, высота и глубина */
.size-selectors {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.size-selector {
  display: flex; /* Размещаем label и select в одной строке */
  align-items: center; /* Выравниваем по вертикали */
  gap: 8px; /* Отступ между label и select */
  position: relative; /* Для позиционирования стрелки */
  width: 100%;
}

.size-selector label {
  font-size: 16px;
  line-height: 25px;
  color: var(--text-primary);
  margin: 0; /* Убираем стандартные отступы */
  user-select: none; /* Запрещаем выделение текста */
  min-width: 80px; /* Фиксированная ширина label */
  text-align: left; /* Выравнивание текста по правому краю */
  white-space: nowrap; /* Запрещаем перенос текста */
}

.size-selector select {
  /* Переносим все ключевые стили на select */
  flex: 1; /* Занимает оставшееся пространство */
  padding: 8px 48px 8px 16px; /* Увеличили правый отступ под стрелку */
  font-size: 16px;
  line-height: 25px;
  border: 1px solid #e1e5e9;
  border-color: var(--border-input);
  border-radius: 6px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  appearance: none; /* Убираем стандартные стрелки браузера */
  -moz-appearance: none;
  -webkit-appearance: none;
  min-width: 0; /* Минимальная ширина для унификации */
  box-sizing: border-box;
}

.size-selector select:hover {
  border-color: var(--text-secondary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.size-selector select:focus {
  outline: none;
  border-color: #e44247;
  box-shadow: 0 0 0 3px rgba(228, 66, 71, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  background-color: var(--bg-card);
  max-width: 100%;
}

/* Кастомная стрелка — оборачиваем select в контейнер для стрелки */
.size-selector::after {
  content: '▼'; /* Стрелка вниз (закрытое состояние) */
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 14px;
  pointer-events: none;
  transition: transform 0.3s ease, color 0.3s ease;
  z-index: 1;
}

/* Стрелка для открытого состояния */
.size-selector.open::after {
  content: '▲'; /* Стрелка вверх (открытое состояние) */
  transform: translateY(-50%) rotate(180deg); /* Анимация вращения */
  color: #e44247; /* Совпадает с цветом фокуса */
}

/* Анимация при клике/раскрытии (добавляется через JS) */
.size-selector.active::after {
  transform: translateY(-50%) rotate(180deg);
  color: #e44247;
}

.modules-info {
  margin: 15px 0;
}

.modules-info h3 {
  color: var(--text-heading);
  font-size: 18px;
  margin-bottom: 8px; /* уменьшили отступ под заголовком */
}

.module-label {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4; /* межстрочный интервал */
  display: inline-block; /* чтобы line-height работал корректно */
  margin-bottom: 2px; /* небольшой отступ снизу */
}

.module-value {
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.4;
}

.modules-list {
  list-style-type: disc;
  padding-left: 20px;
  margin: 0;
  line-height: 1.4; /* регулирует межстрочный интервал внутри пунктов */
}

.modules-list li {
  margin-bottom: 4px; /* уменьшили расстояние между пунктами */
  font-size: 14px;
  color: var(--text-secondary);
  padding: 2px 0; /* добавляет небольшой внутренний отступ сверху и снизу */
}

/* Скрываем оба блока по умолчанию */
.modules-info,
.size-selectors {
  display: none;
}

/* Показываем блок модулей, если контейнер имеет класс show-modules */
.show-modules .modules-info {
  display: block;
}

/* Показываем блок размеров, если контейнер имеет класс show-sizes */
.show-sizes .size-selectors {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* === ОПИСАНИЕ И ХАРАКТЕРИСТИКИ === */
.product-details {
  flex: 1;
  min-width: 300px;
  text-align: left;
}

.product-details .description {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 24px;
}
.description-section {
  margin: 24px 0; /* отступ вокруг блока описания */
}

.product-description {
  margin: 20px 0;
}

.product-description p {
  margin-bottom: 8px; /* Отступ между абзацами */
  line-height: 1.4; /* Межстрочный интервал */
  color: var(--text-secondary); /* Цвет текста */
  font-size: 14px;
}

.description-separator {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ccc, transparent);
  margin: 28px 0 16px 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.description-separator::before {
  content: "Описание";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-description-sep); /* фон текста, чтобы перекрывал линию */
  padding: 0 15px; /* отступ вокруг текста */
  color: var(--text-primary); /* цвет текста */
  font-size: 16px; /* размер текста */
  font-weight: 600; /* жирность */
  white-space: nowrap; /* предотвращаем перенос текста */
}

.specs {
  list-style: none;
  padding: 0;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 2;
}

.specs strong {
  color: var(--text-primary);
}

/* === ЦВЕТОВАЯ ПАЛИТРА === */
.color-configurator {
  max-width: 1200px;
  margin: 60px auto 0;
  padding: 30px;
  background: var(--bg-filter);
  border-radius: 15px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.color-configurator h2 {
  font-size: 28px;
  color: var(--text-heading);
  margin-bottom: 20px;
  text-align: center;
}

.color-group {
  margin-bottom: 24px;
}

.color-group h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* Контейнер палитры */
.color-palette {
  display: grid;
  grid-template-columns: repeat(10, 100px);
  grid-auto-rows: 120px;
  grid-auto-flow: row;
  gap: 12px;
  padding: 10px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.color-palette.three-rows {
  grid-template-rows: repeat(3, 120px);
  grid-auto-flow: column;
}

#color-2door .color-option-label,
#color-3door .color-option-label {
  display: none;
}

@media (min-width: 769px) {
  #color-3door {
    grid-template-columns: repeat(10, 100px);
    grid-template-rows: 120px;
    grid-auto-flow: row;
  }

  #color-3door.three-rows {
    grid-template-rows: 120px;
    grid-auto-flow: row;
  }
}

/* Скроллбар */
.color-palette::-webkit-scrollbar {
  height: 8px;
}

.color-palette::-webkit-scrollbar-track {
  background: var(--bg-category);
  border-radius: 4px;
}

.color-palette::-webkit-scrollbar-thumb {
  background: var(--text-secondary);
  border-radius: 4px;
}

.color-palette::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Ячейка палитры */
.color-option {
  width: 100px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-color-option);
}

.color-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-option.selected {
  border-color: #e44247;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(228, 66, 71, 0.2);
}

.color-option-image {
  width: 90px;
  height: 90px;
  margin: 5px;
  border-radius: 6px;
  overflow: hidden;
}

.color-option-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.color-option-label {
  font-size: 10px;
  text-align: center;
  color: var(--text-color-label);
  line-height: 1.2;
  padding: 0 5px;
  flex: 1;
  display: flex;
  align-items: center;
}

/* Адаптивность */
@media (max-width: 768px) {
  .color-configurator {
    padding: 20px 15px;
    margin: 40px auto 0;
  }

  .color-configurator h2 {
    font-size: 22px;
  }

  .color-palette {
    grid-template-columns: repeat(5, 80px);
    grid-auto-rows: 100px;
    gap: 8px;
  }

  .color-palette.three-rows {
    grid-template-rows: repeat(3, 100px);
  }

  .color-option {
    width: 80px;
    height: 100px;
  }

  .color-option-image {
    width: 70px;
    height: 70px;
  }

  .color-option-label {
    font-size: 9px;
  }
}

@media (max-width: 480px) {
  .color-configurator {
    padding: 15px 10px;
    margin: 30px auto 0;
  }

  .color-palette {
    grid-template-columns: repeat(3, 75px);
    grid-auto-rows: 95px;
    gap: 6px;
  }

  .color-palette.three-rows {
    grid-template-rows: repeat(3, 95px);
  }

  .color-option {
    width: 75px;
    height: 95px;
  }

  .color-option-image {
    width: 65px;
    height: 65px;
    margin: 4px;
  }

  .color-option-label {
    font-size: 8px;
  }
}

/* === ПРЕВЬЮ ПАЛИТРЫ === */
.palette-preview {
  position: fixed;
  z-index: 9999;
  background: var(--bg-card);
  border: 2px solid #e44247;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  overflow: hidden;
  width: 240px;
  height: 285px;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  transition: opacity 0.15s;
}

.palette-preview.clicked {
  pointer-events: auto;
}

.palette-preview-image {
  width: 100%;
  height: 240px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
}

.palette-preview-image img {
  height: 100%;
  object-fit: contain;
}

.palette-preview-footer {
  height: 45px;
  flex-shrink: 0;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-primary);
  border-top: 1px solid var(--border-card);
}

.palette-preview-footer span:first-child {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 6px;
}

.palette-preview-footer span:last-child {
  color: #e44247;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Блок "Вы недавно смотрели" ===== */
.recently-viewed {
  margin-top: 30px;
  padding: 0 20px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.recently-viewed h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
  border-bottom-color: var(--border-card);
}

.recently-viewed-grid {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.recently-viewed-grid::-webkit-scrollbar {
  height: 6px;
}

.recently-viewed-grid::-webkit-scrollbar-track {
  background: transparent;
}

.recently-viewed-grid::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.recently-viewed-grid::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.recently-viewed-card {
  flex: 0 0 200px;
  min-width: 200px;
  background: var(--bg-recently-card);
  border: 1px solid #eee;
  border-radius: 8px;
  border-color: var(--border-card);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.recently-viewed-card:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.recently-viewed-card-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  background: #f9f9f9;
}

.recently-viewed-card-body {
  padding: 10px 12px;
}

.recently-viewed-card-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-recently-name);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.recently-viewed-card-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-price);
}

/* Адаптив */
@media (max-width: 768px) {
  .recently-viewed {
    padding: 0 10px;
  }
  
  .recently-viewed h2 {
    font-size: 18px;
  }
  
  .recently-viewed-card {
    flex: 0 0 160px;
    min-width: 160px;
  }
  
  .recently-viewed-card-image {
    height: 120px;
  }
  
  .recently-viewed-card-name {
    font-size: 13px;
  }
  
  .recently-viewed-card-price {
    font-size: 14px;
  }
}

