/* ============================================================
   P84 Racing Gear Shop — Catalog
   Картки товарів побудовані на РЕАЛЬНОМУ компоненті сайту
   .cat-card / .cat-card--light (той самий, що на головній для категорій) —
   біла плитка, фото по центру, підпис + стрілка знизу, той самий hover.
   Тут лише додаткові класи для сітки каталогу і специфіки товару
   (ціна, бейдж, кнопка "в кошик"), решта успадковується з styles.css.
   ============================================================ */

/* ---- ширший, по центру контейнер саме для каталогу
   (сітці товарів затісно у стандартних 1480px сайту) ---- */
.page-catalog .page,
.page-catalog .header__card {
  max-width: 1720px;
}

.catalog {
  flex: 1;
  padding: 132px 0 80px;
}

/* сторінка каталогу трохи ширша за стандартний контейнер сайту (1480px) —
   на великих екранах даємо більше повітря сітці товарів */
body:has(.catalog) {
  --maxw: 1680px;
}

.catalog__head {
  text-align: center;
  margin-bottom: 44px;
}

.catalog__title {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: clamp(30px, 4vw, 46px);
  color: var(--violet-deep);
}

.catalog__subtitle {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.catalog__layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 52px;
  align-items: start;
}

/* ---------------- sidebar ---------------- */
.catalog__sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 189;
  background: rgba(12, 4, 30, .62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .38s var(--ease);
}

.catalog__sidebar-head,
.catalog__sidebar-apply,
.catalog__sidebar-close { display: none; }

.catalog__sidebar {
  position: sticky;
  top: 110px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-height: calc(100vh - 140px);
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(44, 15, 82, .14);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(44, 15, 82, .06);
}
.filter-search svg { width: 17px; height: 17px; color: var(--ink-soft); flex-shrink: 0; }
.filter-search input {
  border: none; outline: none; background: none;
  font-family: 'Manrope', sans-serif; font-size: 14px; color: var(--ink);
  width: 100%;
}
.filter-search input::placeholder { color: var(--ink-soft); }

.filter-toggle {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Manrope', sans-serif; font-size: 13.5px; font-weight: 600;
  color: var(--violet-deep); cursor: pointer; user-select: none;
}
.filter-toggle input { accent-color: var(--violet-deep); width: 16px; height: 16px; }

.filter-sections {
  display: flex; flex-direction: column; gap: 4px;
}
.filter-sections button {
  display: flex; align-items: center; justify-content: space-between;
  border: none; background: none; cursor: pointer;
  font-family: 'Manrope', sans-serif; font-size: 13.5px; font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink-soft);
  padding: 10px 12px; border-radius: 10px;
  transition: background .3s var(--ease), color .3s var(--ease);
}
.filter-sections button:hover { background: rgba(138, 63, 214, .08); color: var(--violet-deep); }
.filter-sections button.is-active {
  background: var(--violet-deep); color: #fff;
}
.filter-sections button .count { opacity: .65; font-weight: 500; }
.filter-sections button.is-active .count { opacity: .85; }

.filter-categories {
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding-right: 4px;
  border-top: 1px solid rgba(44, 15, 82, .1);
  padding-top: 14px;
}
.filter-categories::-webkit-scrollbar { width: 5px; }
.filter-categories::-webkit-scrollbar-thumb { background: rgba(138, 63, 214, .25); border-radius: 10px; }

.filter-categories button {
  display: flex; align-items: center; justify-content: space-between;
  border: none; background: none; cursor: pointer; text-align: left;
  font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 500;
  color: var(--ink);
  padding: 8px 12px; border-radius: 9px;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.filter-categories button:hover { background: rgba(229, 38, 155, .07); }
.filter-categories button.is-active {
  background: rgba(138, 63, 214, .14);
  color: var(--violet-deep);
  font-weight: 700;
}
.filter-categories button .count {
  font-size: 11.5px; color: var(--ink-soft); font-weight: 600;
  background: rgba(44,15,82,.06); padding: 1px 7px; border-radius: 999px;
}

/* ---------------- main / toolbar ---------------- */
.catalog__toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, .6);
  border: 1px solid rgba(44, 15, 82, .1);
  border-radius: 16px;
}

.catalog__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.catalog__chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--violet-deep); color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  padding: 6px 8px 6px 14px; border-radius: 999px;
}
.catalog__chip button {
  border: none; background: rgba(255,255,255,.22); color: #fff;
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: 12px; line-height: 1;
}

.catalog__filters-btn {
  display: none; /* показується лише на телефоні/планшеті, див. медіа-запит нижче */
  align-items: center; gap: 8px;
  font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--violet-deep);
  border: 1px solid rgba(44, 15, 82, .18);
  border-radius: 999px;
  padding: 10px 18px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.catalog__filters-btn svg { width: 16px; height: 16px; }
.catalog__filters-count {
  background: var(--violet-deep); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}

.catalog__sort {
  font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--violet-deep);
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}
.catalog__sort:hover { background: rgba(138, 63, 214, .08); }

/* ============================================================
   PRODUCT GRID — реальний .cat-card / .cat-card--light компонент,
   розкладений сіткою (замість flex-grow-on-hover, який годиться
   лише для 5 фіксованих плиток на головній).
   ============================================================ */
.catalog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 30px 24px;
}

/* товарна картка успадковує .cat-card .cat-card--light,
   тут лише те, що відрізняється від категорійної плитки */
.catalog__grid .cat-card {
  opacity: 1;
  transform: none;
  gap: 12px;
}

.catalog__grid .cat-card__visual {
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
}

.cat-card__badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--magenta); color: #fff;
  font-family: 'Manrope', sans-serif;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
}
.cat-card__badge--out { background: rgba(44, 15, 82, .55); }

.cat-card__add {
  position: absolute; bottom: 12px; right: 12px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: #fff; color: var(--violet-deep);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 6px 18px rgba(44, 15, 82, .22);
  opacity: 0; transform: translateY(6px);
  transition: opacity .3s var(--ease), transform .3s var(--ease), background .3s var(--ease), color .3s var(--ease);
}
.cat-card:hover .cat-card__add { opacity: 1; transform: translateY(0); }
.cat-card__add:hover { background: var(--violet-deep); color: #fff; }
.cat-card__add svg { width: 16px; height: 16px; }
.cat-card__add:disabled { opacity: .25 !important; pointer-events: none; }
.cat-card__add.is-added { background: var(--violet-deep); color: #fff; }

/* текстовий підпис товару — той самий .cat-card__label (рядок: текст | стрілка),
   але назва товару це речення, а не одне слово категорії,
   тож типографіка трохи спокійніша (без розрідження літер, 2 рядки) */
.catalog__grid .cat-card__label {
  align-items: flex-end;
  padding: 0 2px;
  gap: 10px;
}

.cat-card__text {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.cat-card__eyebrow {
  font-family: 'Manrope', sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.catalog__grid .cat-card__name {
  font-family: 'Manrope', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.catalog__grid .cat-card:hover .cat-card__name {
  color: var(--violet-deep);
  letter-spacing: normal;
}

.cat-card__price-row {
  display: flex; align-items: baseline; gap: 8px;
}
.cat-card__price {
  font-family: 'Unbounded', sans-serif;
  font-size: 15px; font-weight: 700;
  color: var(--violet-deep);
}
.cat-card__price::after { content: " ₴"; opacity: .7; font-weight: 600; }
.cat-card__old-price {
  font-family: 'Manrope', sans-serif;
  font-size: 12px; color: var(--ink-soft); text-decoration: line-through;
}

/* ---- вибір розміру прямо на картці каталогу ---- */
.cat-card__sizes {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-top: 2px;
}
.cat-card__size-btn {
  min-width: 30px; height: 26px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Manrope', sans-serif; font-size: 11.5px; font-weight: 700;
  color: var(--violet-deep);
  background: rgba(138, 63, 214, .07);
  border: 1px solid rgba(44, 15, 82, .14);
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.cat-card__size-btn:hover:not(:disabled) {
  background: var(--violet-deep); color: #fff; border-color: var(--violet-deep);
}
.cat-card__size-btn.is-added { background: #2e8b57; color: #fff; border-color: #2e8b57; }
.cat-card__size-btn:disabled {
  opacity: .35; text-decoration: line-through; cursor: not-allowed;
}
.cat-card__size-more {
  display: inline-flex; align-items: center;
  font-family: 'Manrope', sans-serif; font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); padding: 0 4px;
}

.catalog__empty {
  text-align: center; padding: 60px 0; color: var(--ink-soft); font-size: 14px;
  font-family: 'Manrope', sans-serif;
}

.catalog__pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; flex-wrap: wrap;
  margin: 48px auto 0;
}
.catalog__pagination:empty { margin: 0; }

.catalog__page-btn {
  min-width: 40px; height: 40px;
  padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Manrope', sans-serif; font-size: 13.5px; font-weight: 700;
  color: var(--violet-deep);
  background: #fff;
  border: 1px solid rgba(44, 15, 82, .16);
  border-radius: 999px;
  cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .2s var(--ease);
}
.catalog__page-btn:hover:not(:disabled):not(.is-active) {
  background: rgba(138, 63, 214, .08);
  border-color: rgba(138, 63, 214, .3);
}
.catalog__page-btn.is-active {
  background: var(--violet-deep);
  border-color: var(--violet-deep);
  color: #fff;
}
.catalog__page-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}
.catalog__page-btn--nav svg { width: 16px; height: 16px; }
.catalog__page-btn--nav { padding: 0; }

.catalog__page-ellipsis {
  min-width: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 600;
  color: var(--ink-soft);
}

@media (max-width: 480px) {
  .catalog__page-btn { min-width: 34px; height: 34px; font-size: 12.5px; }
}

/* ---------------- responsive ---------------- */

/* планшет: сайдбар лишається колонкою, трохи вужчою */
@media (max-width: 1180px) {
  .catalog__layout { grid-template-columns: 250px 1fr; gap: 32px; }
}

/* телефон/планшет — фільтри стають повноекранною панеллю (як кошик),
   товари одразу займають всю ширину під тулбаром */
@media (max-width: 980px) {
  .catalog { padding: 108px 0 60px; }
  .catalog__head { margin-bottom: 28px; }

  .catalog__layout { display: block; }

  .catalog__filters-btn { display: inline-flex; }

  .catalog__sidebar-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .catalog__sidebar {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 190;
    width: min(360px, 88vw);
    max-height: none;
    height: 100%;
    background: #fff;
    padding: 20px 20px 24px;
    box-shadow: -10px 0 48px rgba(12, 4, 30, .22);
    transform: translateX(100%);
    transition: transform .42s var(--ease);
    overflow-y: auto;
  }
  .catalog__sidebar.is-open { transform: none; }

  .catalog__sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
  }
  .catalog__sidebar-title {
    font-family: 'Unbounded', sans-serif; font-size: 18px; font-weight: 700;
    color: var(--violet-deep);
  }
  .catalog__sidebar-close {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    border: none; background: rgba(44,15,82,.06); color: var(--violet-deep);
    cursor: pointer;
  }
  .catalog__sidebar-close svg { width: 15px; height: 15px; }

  .filter-categories { flex: 1; }

  .catalog__sidebar-apply {
    display: block;
    margin-top: 8px;
    font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    color: #fff; background: var(--violet-deep);
    padding: 14px; border-radius: 999px; border: none; cursor: pointer;
    flex-shrink: 0;
  }

  .catalog__toolbar { margin-bottom: 20px; }
  .catalog__chips:empty { display: none; }
}

/* широка, зручна сітка по центру екрана на телефоні */
@media (max-width: 640px) {
  .catalog__grid { grid-template-columns: 1fr 1fr; gap: 16px 12px; }
  .catalog__toolbar { gap: 10px; }
  .catalog__sort { flex: 1; padding: 10px 14px; font-size: 12.5px; }
}

@media (max-width: 380px) {
  .catalog__grid { gap: 12px 8px; }
}
