/*
 * Listy produktów: /sklep, kategorie, wyszukiwarka, nowości, promocje, bestsellery, marki.
 * Ładowane z catalog/listing/product-list.tpl (blok „head”) oraz – dla kart produktów – z catalog/product.tpl.
 * Białe tło strony i kart, nacisk na produkty: zwarty nagłówek, kategorie jako pigułki,
 * jeden pasek narzędzi, siatka 2 / 3 / 4 kolumny.
 * Panel filtrów ma osobny arkusz: category-filters.css.
 */

/* ---------- Strona ---------- */
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) {
  background: #fff;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) :is(#wrapper, .breadcrumb__wrapper, #center-column) {
  background: #fff;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) .breadcrumb__wrapper {
  margin-bottom: .25rem;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) .breadcrumb {
  --bs-breadcrumb-padding-y: .625rem;
  font-size: .8125rem;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #products {
  scroll-margin-top: 5.5rem;
}

/* Poniżej 1200 px lewa kolumna nie zajmuje miejsca: zostaje w niej tylko wysuwany panel filtrów. */
@media (max-width: 1199.98px) {
  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #left-column {
    display: contents;
  }

  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #left-column > :not(#offcanvas-faceted) {
    display: none;
  }

  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #center-column {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
  }
}

/* Od 1200 px: wąska kolumna filtrów i szeroka lista, wyrównane do szerokości nagłówka. */
@media (min-width: 1200px) {
  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #wrapper > :is(.columns-container, .breadcrumb__wrapper, #notifications).container,
  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #wrapper > :is(.breadcrumb__wrapper, #notifications) > .container {
    max-width: 84rem;
    padding-inline: 2rem;
  }

  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) .columns-container > .row {
    display: grid;
    grid-template-columns: 17.5rem minmax(0, 1fr);
    align-items: start;
    gap: 0 2.5rem;
    margin: 0;
  }

  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) .columns-container > .row > * {
    flex: none;
    width: auto;
    max-width: none;
    padding: 0;
  }

  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #left-column {
    align-self: stretch;
    min-width: 0;
  }

  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #left-column > :not(#offcanvas-faceted) {
    display: none;
  }

  /* Lista bez filtrów (np. pusta) zajmuje całą szerokość. */
  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) .columns-container > .row:not(:has(#offcanvas-faceted)) {
    grid-template-columns: minmax(0, 1fr);
  }

  body.layout-left-column:is(#category, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #left-column:not(:has(#offcanvas-faceted)) {
    display: none;
  }
}

/* ---------- Nagłówek listy ---------- */
.os-listing-header {
  margin: 0 0 1rem;
}

.category__header {
  margin: 0;
}

.os-listing-header__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .625rem;
}

.os-listing-header .page-title-section {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-transform: none;
}

.os-listing-header__count {
  margin: 0;
  color: #64748b;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.os-listing-header__intro {
  max-width: 70ch;
  margin: .5rem 0 0;
  color: #475569;
  font-size: .9375rem;
  line-height: 1.55;
}

.os-listing-header__intro > :last-child {
  margin-bottom: 0;
}

/* Długi opis: dwa wiersze i „Czytaj więcej” (klasę nadaje category-filters.js; bez skryptu opis jest pełny). */
.os-listing-header__intro.is-clamped {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.os-listing-header__more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: #94470c;
  font-size: .875rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .2em;
}

/* ---------- Kategorie jako pigułki ---------- */
.os-chips {
  display: grid;
  gap: .5rem;
  margin: .875rem 0 0;
}

.os-chips__list {
  display: flex;
  gap: .5rem;
  margin: 0 -.75rem;
  padding: .1875rem .75rem;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: .75rem;
  scrollbar-width: none;
}

.os-chips__list::-webkit-scrollbar {
  display: none;
}

.os-chips__list > li {
  flex: none;
  scroll-snap-align: start;
}

.os-chips__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .5rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.os-chips__link:hover {
  border-color: #fdba74;
  background: #fff7ed;
  color: #0f172a;
}

.os-chips__link.is-active {
  border-color: #0f172a;
  background: #0f172a;
  color: #fff;
}

.os-chips__link--sub {
  border-color: #e2e8f0;
  color: #334155;
  font-size: .875rem;
  font-weight: 400;
}

.os-chips__link--sub.is-active {
  border-color: #f5831f;
  background: #fff7ed;
  color: #94470c;
  font-weight: 700;
}

.os-chips__link:focus-visible {
  outline: 3px solid #b45a0d;
  outline-offset: 2px;
}

/* ---------- Pasek narzędzi: filtry i sortowanie ---------- */
.os-toolbar.products__selection {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin: 1rem 0;
}

.os-toolbar__filters.btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .5rem 1rem;
  border: 1px solid #334155;
  border-radius: .75rem;
  background: #fff;
  color: #0f172a;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.2;
}

.os-toolbar__filters.btn:hover,
.os-toolbar__filters.btn:focus-visible {
  border-color: #0f172a;
  background: #f1f5f9;
  color: #0f172a;
}

.os-toolbar__filters svg {
  flex: none;
}

.os-toolbar__badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 .3rem;
  border-radius: 999px;
  background: #f5831f;
  color: #0f172a;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.os-toolbar__badge[hidden] {
  display: none;
}

.os-toolbar__sort.products__sort {
  display: flex;
  flex: 0 1 auto;
  order: 0;
  min-width: 0;
  margin-left: auto;
}

.os-sort {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  margin: 0;
}

.os-sort__label {
  color: #64748b;
  font-size: .875rem;
  white-space: nowrap;
}

.os-sort__select.form-select {
  width: auto;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: .5rem 2.25rem .5rem .875rem;
  border: 1px solid #cbd5e1;
  border-radius: .75rem;
  background-color: #fff;
  color: #0f172a;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  cursor: pointer;
}

.os-sort__select.form-select:hover {
  border-color: #94a3b8;
}

.os-sort__select.form-select:focus-visible {
  border-color: #bd5b08;
  outline: 3px solid #b45a0d;
  outline-offset: 2px;
  box-shadow: none;
}

/* ---------- Aktywne filtry ---------- */
.active-filters__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.active-filters__link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .375rem .75rem .375rem 1rem;
  border: 1px solid #fdba74;
  border-radius: 999px;
  background: #fff7ed;
  color: #0f172a;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.active-filters__facet {
  color: #64748b;
  font-weight: 400;
}

.active-filters__link svg {
  flex: none;
  color: #94470c;
}

.active-filters__link:hover {
  border-color: #bd5b08;
  background: #ffedd5;
  color: #0f172a;
}

.active-filters__clear {
  min-height: 44px;
  padding: .375rem .5rem;
  border: 0;
  background: none;
  color: #94470c;
  font-size: .875rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .2em;
}

/* ---------- Siatka produktów: 2 / 3 / 4 kolumny ---------- */
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #js-product-list .products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

@media (min-width: 768px) {
  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #js-product-list .products {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  .os-chips__list {
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
}

@media (min-width: 1200px) {
  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) #js-product-list .products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .os-toolbar__filters.btn {
    display: none;
  }
}

/* ---------- Karta produktu na liście (także „produkty z tej samej kategorii” na karcie produktu) ---------- */
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature {
  min-width: 0;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  background: #fff;
  box-shadow: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

/* Reaguje cała karta: lekkie uniesienie, pomarańczowa ramka i cień. Zdjęcie się nie powiększa i nie jest przycinane. */
@media (hover: hover) {
  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner:hover {
    border-color: #fdba74;
    box-shadow: 0 14px 30px -14px rgb(15 23 42 / .28);
    transform: translateY(-3px);
  }
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner:focus-within {
  border-color: #fdba74;
  box-shadow: 0 14px 30px -14px rgb(15 23 42 / .28);
  transform: translateY(-3px);
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__top,
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner:hover .product-miniature__top,
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner:has(:focus-visible) .product-miniature__top {
  border-radius: .625rem;
  background: #fff;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__image-container {
  background: #fff;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__image-link {
  display: block;
  aspect-ratio: 1;
  border-radius: .625rem;
  background: #fff;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__image-link picture {
  display: block;
  width: 100%;
  height: 100%;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__image,
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner:hover .product-miniature__image {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  object-fit: contain;
  transform: none;
  transition: none;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature .product-flags {
  gap: .25rem;
  padding: 0 2rem 0 0;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature .product-flags .badge {
  border-radius: .5rem;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.2;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__bottom {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: .625rem;
  min-width: 0;
  padding: .75rem 0 0;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__infos {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: .375rem;
  min-width: 0;
}

.product-miniature__meta {
  display: flex;
  gap: .375rem;
  min-width: 0;
  margin: 0;
  color: #64748b;
  font-size: .75rem;
  line-height: 1.4;
  white-space: nowrap;
}

.product-miniature__brand {
  flex: none;
  color: #475569;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.product-miniature__reference {
  min-width: 0;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.product-miniature__brand + .product-miniature__reference::before {
  content: '· ';
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__title {
  display: -webkit-box;
  overflow: hidden;
  color: #0f172a;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow-wrap: anywhere;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__title:hover {
  color: #94470c;
}

/* Cena, dostępność i przycisk trzymają się dołu karty, więc karty w wierszu mają równy układ. */
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__prices {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .125rem .5rem;
  margin-top: auto;
  padding-top: .25rem;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__price {
  color: #0f172a;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__prices:has(.product-miniature__regular-price) .product-miniature__price {
  color: #b91c1c;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__regular-price {
  color: #64748b;
  font-size: .875rem;
}

.product-miniature__stock {
  display: flex;
  align-items: center;
  gap: .4375rem;
  margin: 0;
  color: #475569;
  font-size: .8125rem;
  line-height: 1.3;
}

.product-miniature__stock-dot {
  flex: none;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
}

.product-miniature__stock-dot--in { background: #15803d; }
.product-miniature__stock-dot--order { background: #b45309; }
.product-miniature__stock-dot--out { background: #b91c1c; }

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__actions {
  margin-top: 0;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__form {
  display: block;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature .product-miniature__add--simple,
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__details.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  max-width: none;
  min-height: 44px;
  padding: .5625rem .625rem;
  border-radius: .75rem;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__details.btn {
  border: 1px solid #334155;
  background: #fff;
  color: #0f172a;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__details.btn:hover {
  border-color: #0f172a;
  background: #f1f5f9;
}

/* Wąska karta (telefon, 2 kolumny): sam napis, bez ikony koszyka. */
@container product-miniature (width < 12.5rem) {
  .product-miniature .product-miniature__add--simple svg {
    display: none;
  }

  .product-miniature .product-miniature__add--simple {
    font-size: .875rem;
  }
}

@media (max-width: 575.98px) {
  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner {
    padding: .625rem;
    border-radius: .875rem;
  }

  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__title {
    font-size: .875rem;
  }

  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__price {
    font-size: 1.125rem;
  }

  .os-toolbar.products__selection {
    margin: .875rem 0;
  }

  .os-sort__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .os-sort__select.form-select {
    max-width: 12.5rem;
  }
}

/* ---------- Stronicowanie ---------- */
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) .products__pagination {
  margin: 2rem 0 0;
}

.os-pagination__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.os-pagination__link {
  display: inline-grid;
  place-items: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 .5rem;
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  background: #fff;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

a.os-pagination__link:hover {
  border-color: #fdba74;
  background: #fff7ed;
  color: #0f172a;
}

.os-pagination__link.is-current {
  border-color: #0f172a;
  background: #0f172a;
  color: #fff;
}

.os-pagination__link.is-disabled {
  border-color: #f1f5f9;
  color: #cbd5e1;
}

.os-pagination__item--gap {
  display: grid;
  place-items: center;
  min-width: 1.5rem;
  color: #64748b;
}

/* ---------- Dół listy ---------- */
body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) .category__footer:not(:empty) {
  margin-top: 2rem;
}

body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier) .category__additional-description {
  max-width: 70ch;
  color: #475569;
  line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner,
  .os-chips__link {
    transition: none;
  }

  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner:hover,
  body:is(#category, #search, #new-products, #prices-drop, #best-sales, #manufacturer, #supplier, #product) .product-miniature__inner:focus-within {
    transform: none;
  }
}

@media(max-width:399.98px) {
  body:is(#category,#search,#new-products,#prices-drop,#best-sales,#manufacturer,#supplier) #js-product-list .products { grid-template-columns:minmax(0,1fr); }
}
