/* =========================   CATALOG PAGE   ========================= */

.catalog-page {
  padding: 15px 0;
  background: #f9f9f9;
}

.catalog-container {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

/* =========================  SIDEBAR FILTERS   ========================= */
.filters-sidebar {
  flex: 0 0 280px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.05);
  padding: 25px;
}

.filters-sidebar h3 {
  font-size: 20px;
  margin-bottom: 20px;
  font-weight: 600;
}

.filter-group {
  margin-bottom: 25px;
}

.filter-group h4 {
  font-size: 16px;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
}

/* звичайні фільтри */
.filter-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 15px;
  color: #333;
  cursor: pointer;
}

.filter-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #790000;
  cursor: pointer;
}

.show-more {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  background: none;
  border: none;
  color: #031acb;
  cursor: pointer;
  transition: color 0.3s;
}

.show-more:hover {
  color: #000;
}

/* ========  COLOR SWATCHES ================ */
.color-swatches {
  display: flex;
  flex-direction: column; /* вертикальний список */
  margin-top: 8px;
}

/* Highlight product-cards missing add-to-cart (debug helper) */
.missing-cart .product-info {
  outline: 2px dashed #e53935;
}

.color-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  position: relative;
}

.color-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #ccc;
  transition:
    transform 0.2s,
    border-color 0.2s;
}

.color-option:hover .color-swatch {
  transform: scale(1.1);
  border-color: #000;
}
/* Виділення вибраного кольору */
.color-option:has(input:checked) .color-swatch {
  outline: 1px solid #790000;
  outline-offset: 3px;
  transform: scale(1.1);
}

.color-option:has(input:checked) .color-name {
  color: #790000;
  font-weight: 600;
}
/* Приклади кольорів */
.color-swatch.beige {
  background: #f5e1b9;
}
.color-swatch.lightblue {
  background: #89cff0;
}
.color-swatch.burgundy {
  background: #b61c05;
}
.color-swatch.white {
  background: #ffffff;
  border: 1px solid #ccc;
}
.color-swatch.yellow {
  background: #fde10e;
}
.color-swatch.green {
  background: #35b84f;
}
.color-swatch.brown {
  background: #b06407;
}
.color-swatch.orange {
  background: #ff7c0a;
}
.color-swatch.pink {
  background: #ff66b0;
}
.color-swatch.multicolor {
  background: linear-gradient(55deg, red, orange, yellow, green, blue, purple);
}
.color-swatch.blue {
  background: #3843e3;
}
.color-swatch.gray {
  background: #9ca3af;
}
.color-swatch.purple {
  background: #8a2be2;
}
.color-swatch.red {
  background: #ef4444;
}
.color-swatch.black {
  background: #000000;
}
/* ==== ПЛАВНЕ ПРИХОВАННЯ ======= */
.filter-group .hidden {
  display: none;
}

/* ===========   MAIN CATALOG CONTENT   ========== */
.catalog-content {
  flex: 1;
}

/* SORT BAR */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 20px;
}

.sort-bar label {
  font-size: 15px;
  color: #555;
}

.sort-bar select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  font-size: 15px;
  cursor: pointer;
}

/* =====  PRODUCTS сітка товарів ============== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
  background: #fff;
  border-radius: 6px;
  position: relative;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* ЗМІНЕНО: дуже плавна крива */
  will-change: transform, box-shadow;
}
/* Ефект підняття картки */
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

/* ЗМІНЕНО: ._image */
.product-card__image-link {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* ЗМІНЕНО: дуже плавне масштабування */
  will-change: transform;
}

.product-card:hover .product-card__image {
  transform: scale(1.05);
  cursor: pointer;
}

.product-card__info {
  padding: 12px 10px;
  position: relative;
  min-width: 0;
}

.product-card__title {
  text-align: left;
  font-size: 16px;
  margin-bottom: 6px;
}

.product-card__title a {
  color: #222222;
  text-decoration: none;
  transition: color 0.3s;
}

.product-card__title a:hover {
  color: #790000;
}

/* ЗМІНЕНО: .product-stock → .product-stock--in */
.product-stock--in {
  color: #2e7d32;
  font-size: 14px;
  margin-bottom: 8px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* price-cart-container - ЗАЛИШИЛОСЬ */
.price-cart-container {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

/* ЗМІНЕНО: .product-price → .product-card__price */
.product-card__price {
  font-size: 16px;
  font-weight: 600;
  color: #790000;
  margin: 0;
  margin-right: auto;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

/*  одиниця виміру ціни в каталозі та картці товару*/
.product-card__price-unit {
  font-size: 16px;
  font-weight: 600;
  color: #790000;
}

/* add-to-cart - ЗАЛИШИЛОСЬ (але змінено SVG шлях) */
.add-to-cart {
  flex-shrink: 0;
  background: #790000;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-to-cart:hover {
  background: #af0b0b;
}

.add-to-cart svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* ===== БЕЙДЖ "АКЦІЯ" ДЛЯ КАРТОК КАТАЛОГУ ===== */
.sale__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #b22222;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2; /* вище зображення */
}

/* =====================================================
   Toast повідомлення "Додано до кошика"
   ===================================================== */
.hilp-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;

  display: flex;
  align-items: center;
  gap: 8px;

  background: #2e7d32;
  color: #fff;

  padding: 10px 14px;
  border-radius: 8px;

  font-size: 14px;
  font-weight: 500;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

  opacity: 0;
  transform: translateY(10px); /* 👈 ТУТ */
  transition: all 0.3s ease;

  z-index: 99999;
  pointer-events: none;
}

.hilp-toast.show {
  opacity: 1;
  transform: translateY(0); /* 👈 тільки це */
}

/* =======   приховуємо повідомлення "Товар додано до кошика"    ============ */
.product-card .added_to_cart {
  display: none;
}

/* =======   PAGINATION    ============ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
}

.pagination a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #790000;
  color: #333;
  text-decoration: none;
  transition:
    background 0.3s,
    color 0.3s;
}

.pagination a.active {
  background: #d9d9d9;
  color: #fff;
  border-color: #000;
}

.pagination a:hover {
  background: #af0b0b;
  color: #fff;
}

/* ====================== ІНШІ АДАПТИВНІ СТИЛІ ====================== */
/* при ширині екрану меншій за 440 ховаємо слово "сортувати" */
@media (max-width: 440px) {
  .sort-bar label {
    display: none;
  }
}

/* 768+ */
@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

/* Закрити-фільтри: прихована за замовчуванням */
.close-filters {
  display: none;
}

/*  1023 - */
@media (max-width: 1023px) {
  .catalog-container {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
  }

  /* Controls bar: sort and filters button */
  .controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
  }

  .sort-bar {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }

  .catalog-content {
    margin-top: 0;
  }

  /* Sidebar becomes a fixed overlay panel */
  .filters-sidebar {
    position: fixed;
    top: 0;
    left: -100%; /* hidden off-canvas */
    height: 100vh;
    width: 86%;
    max-width: 360px;
    z-index: 1001;
    background: #fff;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    border-radius: 0 8px 8px 0;
    transition: left 0.28s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
  }

  /* When aria-hidden is false the panel is visible */
  .filters-sidebar[aria-hidden="false"] {
    left: 0;
  }

  /* Overlay behind the panel */
  .filters-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 1;
  }

  .filters-overlay.hidden {
    display: none;
    opacity: 0;
  }

  /* Prevent body scroll when filters open */
  body.filters-open {
    overflow: hidden;
    touch-action: none;
    height: 100vh;
  }

  /* Show close button inside the panel on mobile/tablet */
  .close-filters {
    display: block;
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    padding: 6px;
  }
}

/* 1024+ */
@media (min-width: 1024px) {
  .controls-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
  }

  .sort-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 0;
  }

  .filters-overlay {
    display: none !important;
  }

  .filters-sidebar {
    position: static;
    width: 280px;
    flex: 0 0 280px;
    box-shadow: none;
    border-radius: 10px;
    transition: none;
    overflow: visible;
    padding: 25px;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

/* 1260+ */
@media (min-width: 1260px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
