/* ==========================================================
   CEH-TM — ГЛОБАЛЬНІ СТИЛІ САЙТУ
   ========================================================== */


/* ----------------------------------------------------------
   1. ЗАГАЛЬНЕ
   ---------------------------------------------------------- */

/* Колір фону всього сайту */
body {
  background-color: #1a1c18;
}


/* ----------------------------------------------------------
   2. КАТАЛОГ — КАРТКА ТОВАРУ
   ---------------------------------------------------------- */

/* Приховуємо секцію "Упакування" у картці */
.t-store__card .js-product-option.t-product__option {
  display: none !important;
}

/* Назва товару — обрізаємо з трьома крапками */
.js-product .t-store__card__title,
.js-product .t-store__card__title * {
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Картка: прибираємо зайву висоту і відступи */
.js-product { height: auto !important; min-height: 0 !important; }
.js-product .t-store__card__textwrapper,
.js-product .t-store__card__info {
  height: auto !important;
  min-height: 0 !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}
.js-product .t-product__option,
.js-product .t-product__option-variants {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}


/* ----------------------------------------------------------
   3. КАТАЛОГ — КНОПКА "В КОШИК"
   ---------------------------------------------------------- */

.t-store__card__btns-wrapper {
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  padding-top: 0 !important;
  margin-top: -14px !important;
  flex: 0 0 auto !important;
  align-self: stretch !important;
}
#allrecords .js-product .t-store__card__btns-wrapper .t-btn {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}


/* ----------------------------------------------------------
   4. КАТАЛОГ — SELECT РОЗМІРУ
   ---------------------------------------------------------- */

/* Ховаємо заголовок "Розмір" над селектом */
.js-product .t-product__option-title { display: none !important; }

/* Обгортка селекту + псевдоелемент "size |" зліва */
.js-product .t-product__option-variants {
  width: 100% !important;
  position: relative;
}
.js-product .t-product__option-variants::before {
  content: "size |";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #bfbfbf;
  font-size: 13px;
  pointer-events: none;
  z-index: 2;
  font-family: 'PT Sans', sans-serif;
  font-weight: 400;
}

/* Стилізація самого селекту */
.js-product .t-product__option-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100% !important;
  box-sizing: border-box !important;
  border: 1px solid #ccc;
  border-radius: 0;
  background-color: #2C2D2A;
  color: white;
  font-size: 18px;
  text-align: center !important;
  text-align-last: center !important;
  padding: 8px 40px !important;
}
.js-product .t-product__option-select::-ms-expand { display: none; }
.js-product .t-product__option-select:focus {
  outline: none;
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
}
#allrecords .js-product .t-product__option-select {
  text-align: center !important;
  text-align-last: center !important;
}


/* ----------------------------------------------------------
   5. КНОПКА СКРОЛУ ВГОРУ
   ---------------------------------------------------------- */

#ceh-scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 999999;
  width: 54px;
  height: 54px;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #DC143C;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  font-family: Arial, sans-serif;
  transform: rotate(-90deg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
@media (min-width: 768px) {
  #ceh-scroll-top { padding-top: 2px; }
}


/* ----------------------------------------------------------
   6. АДАПТИВ
   ---------------------------------------------------------- */

@media (max-width: 768px) {
  .t-name_xs, .t-descr_xxs { font-size: 18px; }
  .js-product .t-product__option-variants::before { left: 14px; font-size: 13px; }
  .js-product .t-product__option-select { padding: 8px 36px !important; }
  #allrecords .js-product .t-store__card__btns-wrapper .t-btn {
    font-size: 18px !important;
    letter-spacing: 0.6px !important;
    padding: 10px 12px !important;
  }
}
@media (max-width: 420px) {
  #allrecords .js-product .t-store__card__btns-wrapper .t-btn {
    font-size: 16px !important;
    letter-spacing: 0.5px !important;
  }
}
@media (max-width: 380px) {
  #allrecords .js-product .t-store__card__btns-wrapper .t-btn {
    font-size: 15px !important;
    letter-spacing: 0.4px !important;
  }
}


/* ==========================================================
   ФІЛЬТРИ — СТИЛІ КОМПОНЕНТІВ
   Безпечні без has-filters:
   всі ці класи існують тільки всередині #my-smart-filters
   ========================================================== */


/* ----------------------------------------------------------
   7. ФІЛЬТРИ — БАЗОВИЙ КОНТЕЙНЕР
   ---------------------------------------------------------- */

#my-smart-filters {
  width: 100%;
  max-width: 100%;
}

.my-loading {
  color: #888;
  text-align: center;
  padding: 20px;
  font-size: 14px;
}

.my-filter-desktop-block {
  padding: 16px 16px 16px 20px;
  background: #171717;
  margin-bottom: 4px;
}
.my-filter-desktop-block:nth-last-child(2) {
  margin-bottom: 0 !important;
}


/* ----------------------------------------------------------
   8. ФІЛЬТРИ — КОЛЬОРОВІ КВАДРАТИ
   ---------------------------------------------------------- */

.color-square.color-red    { background: #dc143c; }
.color-square.color-yellow { background: #f7b50f; }
.color-square.color-green  { background: #5ba81e; }
.color-square.color-blue   { background: #54a1d1; }
.color-square.color-violet { background: #4a265e; }
.color-square.color-pink   { background: #f9aae3; }
.color-square.color-beige  { background: #efdbb4; }
.color-square.color-brown  { background: #472915; }
.color-square.color-white  { background: #ffffff; }
.color-square.color-grey   { background: #616161; }
.color-square.color-gray   { background: #323230; }
.color-square.color-black  { background: #000000; }

/* SVG multicolor займає весь квадрат */
.multicolor-svg svg {
  width: 100%;
  height: 100%;
  display: block;
}


/* ==========================================================
   ФІЛЬТРИ — ГЛОБАЛЬНІ СТИЛІ TILDA
   Ізольовані через body.has-filters —
   JS додає цей клас тільки на сторінках де є фільтр
   ========================================================== */


/* ----------------------------------------------------------
   9. ФІЛЬТРИ — ГЛОБАЛЬНІ ФІКСИ (без медіа-запиту)
   ---------------------------------------------------------- */

/* Ховаємо стандартний фільтр Tilda */
body.has-filters .t-store__filter {
  display: none !important;
}

/* Прибираємо лівий відступ контейнера товарів */
body.has-filters .js-store-grid-cont.t-store__grid-cont {
  padding-left: 0 !important;
}

/* Верхній відступ блоку кольорів */
body.has-filters .my-color-desktop-block {
  margin-top: 10px !important;
}

/* Корекція відступів колонок Tilda */
body.has-filters [data-col-gap="40"] .t-store__stretch-col {
  padding: 0 10px !important;
}


/* ----------------------------------------------------------
   10. ФІЛЬТРИ — ДЕСКТОП (min-width: 769px)
   ---------------------------------------------------------- */

@media (min-width: 769px) {

  /* Скрол сторінки */
  body.has-filters {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
  }

  /* Обгортка: фільтри зліва + товари справа */
  body.has-filters .t-store__grid-cont_holder {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    align-items: flex-start !important;
    margin: 0 !important;
    position: relative !important;
    width: 100% !important;
  }

  /* Ліва колонка — липкі фільтри */
  body.has-filters #my-smart-filters {
    width: 270px !important;
    flex-shrink: 0 !important;
    margin-bottom: 0 !important;
    float: none !important;
    position: sticky !important;
    top: 76px !important;
    align-self: flex-start !important;
    z-index: 10 !important;
  }

  /* Права колонка — товари */
  body.has-filters .js-store-grid-cont.t-store__grid-cont {
    flex: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding-right: 10px !important;
    display: block !important;
    height: auto !important;
    position: relative !important;
    transform: translateZ(0) !important;
  }

  /* Грід товарів */
  body.has-filters .js-store-grid-cont.t-store__grid-cont .t-store__grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 12px !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
    pointer-events: auto !important;
  }

  /* Картки товарів — примусово видимі */
  body.has-filters .js-store-grid-cont.t-store__grid-cont .t-store__card {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    animation: none !important;
    transition: opacity 0.3s ease !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 1 !important;
  }

  /* Десктопний блок фільтра */
  body.has-filters .my-filter-desktop-block {
    padding: 16px 16px 16px 20px;
    background: #171717;
    margin-bottom: 10px;
  }
  body.has-filters .my-filter-desktop-block:nth-last-child(2) {
    margin-bottom: 0 !important;
  }

  /* Прибираємо обрізання товарної сітки */
  body.has-filters .js-store-grid-cont.t-store__grid-cont,
  body.has-filters .js-store-grid-cont.t-store__grid-cont * {
    overflow: visible !important;
    max-height: none !important;
  }
  body.has-filters .js-store-grid-cont.t-store__grid-cont {
    overflow: visible !important;
    -webkit-overflow-scrolling: auto !important;
  }

  /* Відступ зліва потрібного блока Tilda */
  body.has-filters .t-rec_pt_15 {
    padding-left: 20px !important;
  }

  /* --- Компонентні стилі (безпечні без префіксу) --- */

  .my-filters-container { overflow: hidden; width: 100%; }

  .my-filter-desktop-title {
    color: #fff;
    font-size: 16px;
    display: none;
    font-weight: 600;
    margin-bottom: 12px;
    font-family: Arial, Helvetica, sans-serif;
  }

  .my-filter-desktop-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .my-filter-desktop-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
    font-family: "PT Sans", sans-serif;
    transition: opacity 0.2s;
  }
  .my-filter-desktop-option:hover { opacity: 0.8; }

  .my-filter-desktop-option .filter-square {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid #888;
    background: transparent;
    transition: all 0.2s;
  }
  .my-filter-desktop-option.active .filter-square {
    background: #E53935;
    border-color: white;
  }

  .my-color-desktop-block {
    padding: 16px 16px 16px 20px;
    background: #171717;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .my-color-desktop-title {
    color: #fff;
    font-size: 16px;
    display: none;
    font-weight: 600;
    margin-bottom: 12px;
    font-family: Arial, Helvetica, sans-serif;
    text-align: center;
    width: 100%;
  }

  .my-color-desktop-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin: 0 auto;
  }

  .my-color-desktop-option {
    cursor: pointer;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255,255,255,0.3);
    transition: border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .my-color-desktop-option:hover  { border-color: rgba(255,255,255,0.5); }
  .my-color-desktop-option.active { border-color: white; }

  .my-color-desktop-option .color-square { width: 100%; height: 100%; display: block; }
  .my-color-desktop-option .multicolor-svg { display: block; }

  /* Мобільні ряди на десктопі — приховані */
  .my-filter-row,
  .my-color-row,
  .my-color-slider-row {
    display: none;
  }

  /* Кнопка Reset */
  #reset-filters-btn {
    display: block;
    background: #171717;
    padding: 11px 20px 14px 20px;
    margin-top: 10px;
    color: #888;
    font-size: 14px;
    font-family: "PT Sans", sans-serif;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 2px;
    cursor: pointer;
    transition: color 0.2s;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    border: none;
  }
  #reset-filters-btn:hover { color: #dc143c; }
}


/* ----------------------------------------------------------
   11. ФІЛЬТРИ — МОБІЛЬНА (max-width: 768px)
   ---------------------------------------------------------- */

@media (max-width: 768px) {

  /* Верхній відступ блоку магазину */
  body.has-filters .t051 {
    margin-top: 54px !important;
  }

  /* Прибираємо відступи потрібного блока */
  body.has-filters .t-rec_pt_15 {
    padding-top: 0 !important;
    padding-left: 0 !important;
  }

  /* Обгортка — блочна на мобільному */
  body.has-filters .t-store__grid-cont_holder {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
  }

  /* Контейнер фільтрів */
  body.has-filters #my-smart-filters {
    width: 100% !important;
    margin-bottom: 20px !important;
  }

  /* Контейнер товарів */
  body.has-filters .js-store-grid-cont.t-store__grid-cont {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: visible !important;
    height: auto !important;
    padding-right: 0 !important;
    pointer-events: auto !important;
  }

  /* Грід товарів */
  body.has-filters .js-store-grid-cont.t-store__grid-cont .t-store__grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 12px !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
  }

  /* --- Компонентні стилі (безпечні без префіксу) --- */

  /* Ряди мобільних фільтрів */
  .my-filter-row,
  .my-color-slider-row {
    background: #171717;
    padding: 8px 0;
    margin-bottom: 2px;
  }
  .my-filter-row:nth-last-child(2),
  .my-color-slider-row:nth-last-child(2) {
    margin-bottom: 0;
  }

  /* Контейнер слайдера: [←] [scroll] [→] */
  .my-slider-container {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
  }

  /* Кнопки-стрілки слайдера */
  .my-slider-btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #dc143c;
    background: transparent;
    border: none;
  }
  .my-slider-btn svg { width: 24px; height: 24px; stroke-width: 3; }
  .my-slider-btn.disabled { opacity: 0.2; pointer-events: none; }

  /* Область горизонтального скролу */
  .my-slider {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .my-slider::-webkit-scrollbar { display: none; }

  /* Ряд текстових фільтрів */
  .my-slider-items {
    display: flex;
    gap: 12px;
    align-items: center;
    white-space: nowrap;
    padding: 4px 0;
    justify-content: flex-start;
  }

  /* Текстовий фільтр-елемент */
  .my-filter-item-text {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #fff;
    font-size: 15px;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: "PT Sans", sans-serif;
  }
  .my-filter-item-text .filter-square {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid #888;
    background: transparent;
  }
  .my-filter-item-text.active .filter-square {
    background: #E53935;
    border-color: white;
  }

  /* Ряд кольорових фільтрів */
  .my-color-slider-items {
    display: flex;
    gap: 15px;
    align-items: center;
    white-space: nowrap;
    padding: 4px 0;
    justify-content: flex-start;
  }

  /* Кольоровий фільтр-елемент */
  .my-filter-item-color-slider {
    cursor: pointer;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s;
  }
  .my-filter-item-color-slider:hover  { border-color: rgba(255,255,255,0.5); }
  .my-filter-item-color-slider.active { border-color: white; }
  .my-filter-item-color-slider .color-square,
  .my-filter-item-color-slider .multicolor-svg {
    width: 100%;
    height: 100%;
    display: block;
  }

  /* Старий блок кольорів Tilda — прихований */
  .my-color-row { display: none; }

  /* Десктопні блоки на мобільному — приховані */
  .my-filter-desktop-block,
  .my-color-desktop-block {
    display: none;
  }
}