/* ==========================================================================
   Hookah-Baza 2026 — Категория (товарная страница)
   Источник: Figma node 121:252
   ========================================================================== */

/* Breadcrumbs: B1 18px add-text color */
.breadcrumbs {
  font-size: 18px; font-weight: 500;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
}
.breadcrumbs a {
  color: inherit;
  text-decoration: none;
  transition: color var(--tr);
}
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs__sep { margin: 0 8px; opacity: 0.6; }
.breadcrumbs__current { color: var(--text); }

/* ==========================================================================
   Page head: H1 + count + sort row
   Figma: title and count sit on the same line, separated by a dot.
   ========================================================================== */
.category-head {
  display: flex;
  align-items: baseline;
  gap: 32px;
}
.category-head__title {
  font-size: 36px; font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  margin: 0;
}
.category-head__count {
  font-size: 18px; font-weight: 500;
  line-height: 1.5;
  color: var(--text-muted);
}

.category-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.category-toolbar__filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* Sort select — same pattern as header city-select, 285px wide */
.sort-select { position: relative; display: inline-flex; width: 285px; }
.sort-select__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--text);
  font-size: 18px; font-weight: 500;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--tr);
}
.sort-select__trigger:hover { border-color: var(--red); }
.sort-select__arrow { width: 27px; height: 27px; transition: transform var(--tr); }
.sort-select[aria-expanded="true"] .sort-select__trigger { border-color: var(--red); }
.sort-select[aria-expanded="true"] .sort-select__arrow { transform: scaleY(-1); }
.sort-select__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
  display: none;
}
[data-theme="light"] .sort-select__trigger,
[data-theme="light"] .sort-select__menu,
[data-theme="light"] .filter-btn {
  background: #FDF9F8;
}
.sort-select[aria-expanded="true"] .sort-select__menu { display: block; }
.sort-select__option {
  padding: 16px;
  box-shadow: inset 0 -1px 0 var(--stroke);
  font-size: 16px; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--tr);
}
.sort-select__option:last-child { box-shadow: none; }
.sort-select__option:hover { background: rgba(143, 23, 67, 0.15); }
.sort-select__option[aria-selected="true"] { color: var(--red); }

/* ==========================================================================
   Product grid: 4 columns, gap 24
   1224 = 288*4 + 24*3 → exact fit
   ========================================================================== */
.products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  align-items: stretch;
}
/* Override ui-kit fixed 288×484 so cards fill grid width, height by content */
.products .product-card {
  width: 100%;
  height: 100%;
  min-width: 0;
  align-self: stretch;
}

/* ==========================================================================
   Product card (303:512)
   Состояния: default | out-of-stock | in-cart | sale
   ========================================================================== */
.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  border-radius: var(--r-4);
  overflow: hidden;
  transition: border-color var(--tr);
}
.product-card:hover { border-color: var(--red); }

/* Cover: image fills the photo area (contain, no crop) */
.product-card__cover {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  height: 241px;
  background: var(--bg);
  overflow: hidden;
}
.product-card__cover-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.product-card__cover img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.product-card:hover .product-card__cover img { transform: scale(1.05); }

/* Body: padding 16 16 0 — height follows content */
.product-card__body {
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  flex: none;
}
.product-card__name {
  display: flex;
  align-items: flex-start;
  font-size: 18px; font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  text-decoration: none;
  transition: color var(--tr);
}
.product-card__name:hover { color: var(--green); }
.product-card__name-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Footer of card: padding 16, gap 20 */
.product-card__footer {
  padding: 16px;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.product-card__price-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.product-card__cart-icon { display: none; }
.product-card__cart-text { display: inline; }
.product-card__price {
  font-size: 22px; font-weight: 500;
  line-height: 1.1;
  color: var(--text);
}
.product-card__stock {
  font-size: 16px; font-weight: 500;
  line-height: 1.5;
  color: var(--green);
}
.product-card__stock--out { color: var(--red); }

/* Add-to-cart button — uses unified .btn-grad */
.product-card__cart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  font-size: 18px; font-weight: 500;
  line-height: 1.1;
  color: var(--text);
  background: var(--bg);
  text-decoration: none;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  /* reuse gradient border */
  position: relative;
  isolation: isolate;
  transition: color var(--tr);
}
.product-card__cart::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(116deg, #8F1743 38%, #0F9C4D 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
          mask-composite: exclude;
  pointer-events: none;
  transition: background 0.2s;
}
.product-card__cart:hover::before {
  background: conic-gradient(from var(--grad-angle),
    #8F1743 0%, #0F9C4D 25%, #8F1743 50%, #0F9C4D 75%, #8F1743 100%);
  animation: flow-along-border 4s linear infinite;
}
.product-card__cart > * { position: relative; z-index: 1; }

/* Light theme: add-to-cart fill + gradient border */
[data-theme="light"] .product-card__cart:not(.product-card__cart--in-cart):not(.product-card__cart--disabled) {
  background: #FDF9F8;
  color: #060814;
  transition: background var(--tr), color var(--tr);
}
[data-theme="light"] .product-card__cart:not(.product-card__cart--in-cart):not(.product-card__cart--disabled)::before {
  background: linear-gradient(92.9deg, #8F1743 38.27%, #0F9C4D 98.78%);
  animation: none;
}
[data-theme="light"] .product-card__cart:not(.product-card__cart--in-cart):not(.product-card__cart--disabled):hover {
  background: linear-gradient(92.9deg, #F9CADB 18.57%, #B2ECCC 65.01%);
}
[data-theme="light"] .product-card__cart:not(.product-card__cart--in-cart):not(.product-card__cart--disabled):hover::before {
  background: linear-gradient(92.9deg, #8F1743 38.27%, #0F9C4D 98.78%);
  animation: none;
}
[data-theme="light"] .product-card--out .product-card__cart {
  background: var(--bg-2);
  color: var(--text-muted);
}
[data-theme="light"] .product-card--out .product-card__cart::before {
  background: var(--stroke);
  animation: none;
}

/* ---- Состояние: В корзине ---- */
.product-card__cart--in-cart {
  background: #060814;
  border: 1px solid #605E7B;
  color: #fff;
}
.product-card__cart--in-cart::before { display: none; }
[data-theme="light"] .product-card__cart--in-cart {
  background: #BCBBCA;
  border-color: #605E7B;
  color: #060814;
}

/* ---- Состояние: Нет наличия ---- */
.product-card--out .product-card__cart {
  color: var(--text-muted);
  cursor: not-allowed;
}
.product-card--out .product-card__cart::before {
  background: var(--stroke);
}

/* ---- Состояние: Новая цена (sale) ---- */
.product-card__price-old {
  font-size: 12px; font-weight: 300;
  color: var(--text-muted);
  text-decoration: line-through;
}
.product-card__price-stack {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.category-page { gap: 24px; }     /* breadcrumbs → head → toolbar → grid */

/* Mobile-only "Фильтры" button — replaces sort-select on ≤767 */
.filter-btn {
  display: none;       /* shown via media query */
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color var(--tr);
}
.filter-btn:hover { border-color: var(--red); }
.filter-btn img { width: 20px; height: 20px; }

/* Pagination */
/* OpenCart default pagination markup */
.hb-pagination ul.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
}
.hb-pagination ul.pagination > li > a,
.hb-pagination ul.pagination > li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  background: var(--bg-2);
  box-sizing: border-box;
}
/* Nested link inside span (legacy OC markup) — no second border */
.hb-pagination ul.pagination > li > span > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: none;
}
.hb-pagination ul.pagination > li > a:hover,
.hb-pagination ul.pagination > li > span:hover {
  border-color: var(--red);
}
.hb-pagination ul.pagination > li.active > a,
.hb-pagination ul.pagination > li.active > span {
  background: linear-gradient(116deg, #8F1743 38%, #0F9C4D 100%);
  border-color: transparent;
  color: #fff;
  pointer-events: none;
  cursor: default;
}
[data-theme="light"] .hb-pagination ul.pagination > li.active > a,
[data-theme="light"] .hb-pagination ul.pagination > li.active > span {
  background: linear-gradient(92.9deg, #F9CADB 44.02%, #B2ECCC 95.23%);
  border-color: transparent;
  color: #060814;
}

.product-card__cart {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
}
.product-card__cart--in-cart {
  border: 1px solid #605E7B;
}
a.sort-select__option {
  display: block;
  text-decoration: none;
  color: inherit;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}
.pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  padding: 0 16px;
  background: var(--bg-2);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px; font-weight: 500;
  cursor: pointer;
  transition: border-color var(--tr);
}
.pagination__btn:hover { border-color: var(--red); }
.pagination__btn[aria-current="page"] {
  background: linear-gradient(116deg, #8F1743 38%, #0F9C4D 100%);
  border: 0;
  color: #fff;
}

/* ==========================================================================
   Responsive — Figma: 121:252 (desk), 886:6335 (tab), 510:2933 (mob)
   Breakpoints follow tokens.css: 1199 (tablet), 767 (mobile)
   ========================================================================== */

/* ---- TABLET (≤ 1199px) ---- */
@media (max-width: 1199px) {
  /* Breadcrumbs: B2 14px */
  .breadcrumbs { font-size: 14px; }
  .breadcrumbs__sep { margin: 0 6px; }

  /* Head: H2 28px, count 14px, gap 12 */
  .category-head { gap: 24px; }
  .category-head__title { font-size: 28px; }
  .category-head__count { font-size: 14px; }

  /* Toolbar */
  .category-toolbar { gap: 8px; }
  .category-toolbar__filters { gap: 8px; }
  .sort-select { flex: 1 1 calc(50% - 4px); width: auto; min-width: 200px; }
  .sort-select__trigger,
  .sort-select__option { padding: 12px 16px; font-size: 14px; }
  .sort-select__arrow { width: 20px; height: 20px; }

  /* Products: 2 columns, stretch full width */
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

  /* Card — tablet proportions (smaller paddings) */
  .products .product-card { width: 100%; height: 100%; border-radius: 16px; }
  .product-card__cover { height: 280px; padding: 24px; }
  .product-card__body { padding: 12px 12px 0; }
  .product-card__name { font-size: 14px; min-height: 0; }
  .product-card__footer { padding: 12px; margin-top: 12px; gap: 12px; }
  .product-card__price { font-size: 18px; }
  .product-card__stock { font-size: 12px; }
  .product-card__cart { padding: 12px; font-size: 14px; border-radius: 10px; }

  /* Pagination */
  .pagination { gap: 6px; margin-top: 24px; }
  .pagination__btn { min-width: 40px; height: 40px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
}

/* ---- MOBILE (≤ 767px) ---- */
@media (max-width: 767px) {
  /* Breadcrumbs: B3 12px */
  .breadcrumbs { font-size: 12px; }
  .breadcrumbs__sep { margin: 0 4px; }

  /* Head: H3 22px, count 12px, gap 8 */
  .category-head { gap: 16px; }
  .category-head__title { font-size: 22px; }
  .category-head__count { font-size: 12px; }

  /* Toolbar: Фильтры toggles sort + subcategory */
  .category-toolbar { width: 100%; }
  .filter-btn { display: inline-flex; }
  .category-toolbar__filters { display: none; flex-direction: column; width: 100%; gap: 8px; }
  .category-toolbar.is-filters-open .category-toolbar__filters { display: flex; }
  .category-toolbar .sort-select { flex: none; width: 100%; min-width: 0; }
  .filter-btn[aria-expanded="true"] { border-color: var(--red); }
  .sort-select__trigger { padding: 12px; font-size: 14px; }
  .sort-select__option { padding: 12px; font-size: 14px; }

  /* Products: 1 column */
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .products .product-card { width: 100%; height: 100%; }

  /* Card — mobile: cover shorter, text 14px */
  .product-card { border-radius: 16px; }
  .product-card__cover { height: 180px; padding: 16px; }
  .product-card__body { padding: 12px 12px 0; }
  .product-card__name { font-size: 14px; min-height: 0; line-height: 1.4; }
  .product-card__footer {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    padding: 12px;
    margin-top: 12px;
  }
  .product-card__price-meta {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 4px;
    flex: 1 1 auto;
    width: auto;
  }
  .product-card__price { font-size: 16px; }
  .product-card__stock { font-size: 11px; }
  .product-card__cart {
    flex: none;
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 0;
    border-radius: 10px;
    box-sizing: border-box;
  }
  .product-card__cart--in-cart {
    border: 1px solid #605E7B;
  }
  .product-card__cart-text { display: none; }
  .product-card__cart-icon {
    display: block;
    width: 24px;
    height: 24px;
    flex: none;
  }

  /* Pagination: tight — numbers only */
  .pagination { gap: 4px; margin-top: 20px; flex-wrap: wrap; }
  .pagination__btn { min-width: 36px; height: 36px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
  .hb-pagination ul.pagination > li.pagination-prev,
  .hb-pagination ul.pagination > li.pagination-next { display: none; }
}

/* ---- Very small phones (≤ 360px) ---- */
@media (max-width: 360px) {
  .category-head__title { font-size: 20px; }
  .product-card__cover { height: 200px; }
}

/* ==========================================================================
   404 page — vertical center between header and footer
   ========================================================================== */
.page:has(.not-found-page) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.page:has(.not-found-page) > main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.not-found-page {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 64px;
  padding-top: 64px;
  padding-bottom: 80px;
}
.not-found {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
.not-found__code {
  margin: 0 0 12px;
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
.not-found__title {
  margin: 0 0 16px;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}
.not-found__text {
  margin: 0 0 28px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-muted);
}
.not-found__btn {
  min-width: 200px;
  padding: 16px 32px;
  border-radius: 12px;
}
.not-found__populars {
  width: 100%;
}
@media (max-width: 767px) {
  .not-found-page {
    padding-top: 40px;
    padding-bottom: 48px;
    gap: 40px;
  }
  .not-found__code { font-size: 48px; }
  .not-found__title { font-size: 24px; }
  .not-found__text { font-size: 16px; }
}
