/* Главный контейнер карточки товара (одна на всю ширину ряда) */
.tx-row {
  background-color: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 25px;
  font-family: var(--font-main);
  box-sizing: border-box;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  width:100%;
}

.tx-row:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

/* Основной горизонтальный блок */
.tx-main {
  display: flex;
  gap: 30px;
}

/* ================= ЛЕВАЯ СТОРОНА (Визуал) ================= */
/* Левая часть: теперь элементы идут вертикально (картинка сверху, описание снизу) */
.tx-visual {
  flex: 0 0 30%; /* Слегка корректируем ширину левой части под вертикальный контент */
  display: flex;
  flex-direction: column; /* Элементы встают друг под друга */
  gap: 15px; /* Отступ между картинкой и описанием */
  align-items: center; /* Центрируем контент по горизонтали */
  position: relative;
}

/* Фотография товара сверху */
.tx-img {
  width: 100%;
  max-width: 260px; /* Ограничиваем максимальный размер картинки для баланса */
  height: 200px; /* Одинаковая фиксированная высота области фотографии */
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fafafa;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.tx-img img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

/* Краткое описание под картинкой */
.tx-desc-small {
  width: 100%;
  text-align: left; /* Описание выравниваем по левому краю (или по центру через center) */
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.tx-desc-small p {
  margin: 0;
}

/* Корректируем правую сторону (параметры), чтобы они занимали оставшееся место */
.tx-panel {
  flex: 1; /* Занимает всю правую сторону */
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-left: 1px solid #f0f0f0;
  padding-left: 30px;
}

/* ================= АДАПТИВНОСТЬ НА МОБИЛЬНЫХ ================= */
@media (max-width: 992px) {
  .tx-panel {
    border-left: none;
    padding-left: 0;
  }
}

/* Ссылка-заголовок */
.tx-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  text-decoration: none;
  line-height: 1.3;
  transition: color 0.2s ease;
}

.tx-title:hover {
  color: var(--primary-color);
}

/* Блок цены */
.tx-price-block {
  font-size: 15px;
  color: var(--text-muted);
  display: flex;
  align-items: baseline;
}

.tx-price-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
  margin-left: 8px;
}

/* Сетка для выпадающих списков селектора */
.tx-inputs-area {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Поля выбора выстраиваются по 2 в ряд */
  gap: 15px;
  background-color: #fcfcfc;
  padding: 15px;
  border: 1px solid #f0f0f0;
  border-radius: var(--border-radius);
}

/* Одиночное поле выбора (Группа: Метка + Выпадающий список) */
.tx-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tx-colors {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Поле количества растягивается на всю ширину сетки параметров */
.tx-field-full {
  grid-column: span 2;
}

.tx-label, .cr-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Стилизация выпадающих списков select и инпута количества */
.tx-field select,
.tx-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-dark);
  background-color: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.tx-field select:focus,
.cr-input:focus {
  border-color: var(--primary-color);
}

/* Блок кнопок внизу */
.tx-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}

/* Кнопка "Подробнее" */
.tx-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
  cursor: pointer;
}

.tx-more-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 0.3s ease;
}

/* Класс-активатор для развернутой стрелочки */
.tx-more-btn.active svg {
  transform: rotate(180deg);
}

/* Кнопка добавления заказа */
.tx-buy {
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.tx-buy:hover {
  background-color: var(--secondary-bg);
}

/* ================= СКРЫТЫЙ БЛОК ОПИСАНИЯ ================= */
.tx-hidden-text {
  max-height: 0; /* Изначально блок свернут по высоте */
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out, margin-top 0.3s ease;
  opacity: 0;
  border-top: 1px solid transparent;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Класс-активатор для отображения большого описания (добавляется через JS) */
.tx-hidden-text.open {
  max-height: 1000px; /* Достаточная высота для плавного раскрытия */
  opacity: 1;
  margin-top: 20px;
  padding-top: 20px;
  border-top-color: #eee;
}

/* ================= АДАПТИВНОСТЬ НА МОБИЛЬНЫХ ================= */
@media (max-width: 992px) {
  .tx-main {
    flex-direction: column;
    gap: 20px;
  }
  .tx-visual, .tx-panel {
    flex: none;
    width: 100%;
  }
  .tx-panel {
    border-left: none;
    padding-left: 0;
  }
}

@media (max-width: 576px) {
  .tx-visual {
    flex-direction: column;
    align-items: center;
  }
  .tx-img {
    width: 100%;
    flex: none;
  }
  .tx-inputs-area {
    grid-template-columns: 1fr; /* Поля выбора выстраиваются в один ряд */
  }
  .tx-field-full {
    grid-column: span 1;
  }
  .tx-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
  .tx-buy {
    width: 100%;
    text-align: center;
  }
}


/* Контейнер всей таблицы-шапки */
table.colorsresult {
  border-collapse: collapse;
  margin-bottom: 15px;
  font-family: var(--font-main);
  width: 100%;
}

/* Ячейка с заголовком "Выберите цвет (RAL)" */
table.colorsresult td strong {
  font-size: 16px !important; /* Делаем заголовок аккуратным */
  font-weight: 700;
  color: var(--text-dark);
}

/* Кнопка закрытия (крестик) */
.closect {
  width: 28px;
  height: 28px;
  background-color: #f5f5f5;
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  padding: 0;
}

.closect:hover {
  background-color: #e82a2a;
  border-color: #e82a2a;
}

/* Рисуем аккуратный крестик внутри кнопки закрытия через CSS */
.closect::before,
.closect::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  background-color: var(--text-muted);
  transition: background-color 0.2s ease;
}
.closect::before { transform: translate(-50%, -50%) rotate(45deg); }
.closect::after { transform: translate(-50%, -50%) rotate(-45deg); }

.closect:hover::before,
.closect:hover::after {
  background-color: var(--white); /* Крестик становится белым при наведении */
}

/* ================= СЕТКА ЦВЕТОВ ================= */

/* Контейнер с кнопками-цветами */
.colors {
  display: grid;
  /* Кнопки будут адаптивными, минимум 55px в ширину */
  grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
  gap: 8px; /* Расстояние между цветными плашками */
  padding: 10px 0;
  font-family: var(--font-main);
}

/* Сами кнопки цветов */
.clrbt {
  aspect-ratio: 1 / 1; /* Делает кнопки идеально квадратными */
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12); /* Едва заметная рамка для отделения цветов */
  border-radius: var(--border-radius);
  font-size: 12px;
  font-weight: 600;
  color: var(--white); /* По умолчанию текст белый (для темных цветов) */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); /* Тень для лучшей читаемости цифр */
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 0px rgba(255,255,255,0);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Эффект при наведении на цветную плашку */
.clrbt:hover {
  transform: scale(1.08); /* Легкое увеличение */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); /* Тень вокруг */
  z-index: 2;
}

/* Специфичный класс для светлых цветов (чтобы текст не сливался) */
.clrbt.bellz {
  color: #222 !important; /* Темный текст для светлых фонов */
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8); /* Светлая подложка под текст */
}








/* Главный контейнер всплывающего окна */
.popupcolor {
  background-color: var(--white);
  border-radius: calc(var(--border-radius) * 2);
  padding: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  max-width: 480px;
  width: 90%;
  box-sizing: border-box;
  font-family: var(--font-main);
  display: none;
  flex-direction: column;
  gap: 15px;
  position:absolute;
}

/* Линия с кнопкой закрытия */
.closeline {
  display: flex;
  justify-content: flex-end; /* Смещает кнопку закрытия в правый угол */
  width: 100%;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 8px;
}

/* Кнопка закрытия "х" */
.closect {
  background-color: #f5f5f5;
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0 0 2px 0; /* Небольшая корректировка для центрирования символа "х" */
}

/* Добавляем контент "Х" через псевдоэлемент */
.closect::before {
  content: "?"; /* Используем правильный типографский знак умножения/крестика */
  font-size: 20px; /* Оптимальный размер для крестика */
  font-weight: 400;
  font-family: Arial, sans-serif; /* Стандартный шрифт для предсказуемого отображения знака */
  line-height: 1;
}

/* Эффект при наведении */
.closect:hover {
  background-color: #e82a2a;
  border-color: #e82a2a;
  color: var(--white);
}

/* Сетка цветов RAL */
.colors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 8px;
  max-height: 280px; /* Скролл на случай длинного списка цветов */
  overflow-y: auto;
  padding-right: 4px;
}

/* Кастомизация встроенного скроллбара палитры */
.colors::-webkit-scrollbar {
  width: 5px;
}
.colors::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}
.colors::-webkit-scrollbar-thumb {
  background: var(--light-gray);
  border-radius: 10px;
}

/* Кубики цветов */
.clrbt {
  aspect-ratio: 1 / 1;
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--border-radius);
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.clrbt:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
  z-index: 5;
}

/* Корректировка шрифта для светлых цветов */
.clrbt.bellz {
  color: #222 !important;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
}

/* Нижний блок сброса */
.sbros {
  display: flex;
  justify-content: center; /* Центрируем кнопку "Сбросить" */
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
  margin-top: 5px;
}

/* Кнопка "Сбросить" */
.sbrosbtn {
  background-color: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--border-radius);
  color: var(--text-dark);
  font-size: 14px;
  font-weight: 600;
  height: 36px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sbrosbtn:hover {
  background-color: #f5f5f5;
  border-color: var(--text-muted);
  color: var(--primary-color);
}
