/**
 * Niepołomicki Bartnik — UX katalogu, bez ingerencji w inne strony.
 * Selektory scope: body.bsux-shop i .nb-woo-catalog.
 */
body.bsux-shop .nb-app main.nb-woo-catalog .nb-woo-intro {
  margin: 0 0 25px;
}
body.bsux-shop .nb-app main.nb-woo-catalog .nb-woo-intro .nb-kicker {
  margin-bottom: 10px;
}
body.bsux-shop .nb-app main.nb-woo-catalog .nb-woo-intro h1 {
  max-width: 100%;
  font-size: clamp(2.3rem, 3.8vw, 3.75rem);
  line-height: 1.12;
  letter-spacing: -.035em;
  text-wrap: balance;
  margin: 0 0 14px;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-shop-lead {
  max-width: 75ch;
  font-size: clamp(.98rem, 1.2vw, 1.09rem);
  line-height: 1.65;
  color: #536b5e;
  margin: 0;
}

/* Zachowujemy natywne WooCommerce: formularz GET i automatyczne sortowanie. */
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin: 16px 0 22px;
  padding: 12px 17px;
  border: 1px solid #d9e4d8;
  background: #fffdf9;
  border-radius: 14px;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-results {
  min-width: 0;
}
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce-result-count {
  float: none !important;
  margin: 0 !important;
  font-size: .91rem;
  color: #587064;
  line-height: 1.5;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  margin-left: auto;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering label {
  color: #25493d;
  font-size: .86rem;
  font-weight: 700;
  white-space: nowrap;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering form.woocommerce-ordering {
  float: none !important;
  width: auto;
  margin: 0 !important;
  position: relative;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering form.woocommerce-ordering::after {
  content: '';
  position: absolute;
  pointer-events: none;
  right: 17px;
  top: calc(50% - 5px);
  width: 8px;
  height: 8px;
  border-right: 2px solid #25493d;
  border-bottom: 2px solid #25493d;
  transform: rotate(45deg);
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering select.orderby {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #b8ccbd;
  border-radius: 10px;
  background: #fff;
  color: #173c35;
  font-family: inherit;
  font-size: .93rem;
  font-weight: 650;
  line-height: 1.35;
  padding: 11px 43px 11px 15px;
  min-width: 235px;
  min-height: 46px;
  max-width: 100%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgb(22 62 45 / 4%);
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering select.orderby:hover {
  border-color: #6b9a79;
  background: #fcfdfb;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering select.orderby:focus-visible {
  outline: 3px solid #e7ae55;
  outline-offset: 2px;
}

/* Kluczowa zmiana: CTA trzyma się dołu, a cena pozostaje bezpośrednio pod nazwą. */
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products {
  align-items: stretch;
  clear: both;
}
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product {
  display: flex !important;
  flex-direction: column !important;
  height: 100%;
  min-width: 0;
}
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product .woocommerce-LoopProduct-link,
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product .woocommerce-loop-product__link {
  flex: 0 0 auto;
  min-width: 0;
}
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product :is(.price, span.price, .woocommerce-Price-amount) {
  margin-top: 0 !important;
}
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product .price {
  display: block;
  margin: 8px 0 0 !important;
}
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product > a.button,
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product > button.button,
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product > .add_to_cart_button {
  display: flex !important;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 44px;
  flex: 0 0 auto;
  margin-top: auto !important;
  margin-bottom: 0 !important;
  padding: 11px 12px !important;
  border-radius: 10px !important;
  text-align: center;
  font-weight: 750;
  transition: background-color .16s ease, box-shadow .16s ease;
}
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product > a.button:hover,
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product > button.button:hover {
  background-color: #285747;
  box-shadow: 0 5px 14px rgb(29 72 49 / 18%);
}
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product > a.button:focus-visible {
  outline: 3px solid #efb45b;
  outline-offset: 2px;
}
/* Bez elementu kompensującego — wszystkie karty mają wspólne dno w siatce CSS grid. */
body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product .added_to_cart {
  flex: 0 0 auto;
  margin-top: 8px;
  text-align: center;
  font-size: .82rem;
}

@media (max-width: 690px) {
  body.bsux-shop .nb-app main.nb-woo-catalog .nb-woo-intro h1 {
    font-size: clamp(2rem, 8.5vw, 2.75rem);
  }
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 13px;
  }
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    gap: 9px;
  }
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering label {
    font-size: .82rem;
  }
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering form.woocommerce-ordering {
    min-width: 0;
    flex: 1;
  }
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering select.orderby {
    min-width: 0;
    width: 100%;
    font-size: 16px; /* zapobiega automatycznemu zoomowi Safari/iOS */
  }
}
@media (max-width: 365px) {
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering {
    align-items: stretch;
    flex-direction: column;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.bsux-shop .nb-app main.nb-woo-catalog .woocommerce ul.products li.product > .button {
    transition: none;
  }
}

/* v1.1.0: autorski dropdown — natywne opcje nie są widoczne po uruchomieniu JS. */
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering form.woocommerce-ordering.bsux-enhanced::after {
  content: none !important;
  display: none !important;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering form.woocommerce-ordering.bsux-enhanced select.orderby {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  margin: 0 !important;
  border: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fffdf9;
  border: 1px solid #aec6b3;
  border-radius: 12px;
  min-height: 48px;
  min-width: 235px;
  width: 100%;
  max-width: 100%;
  padding: 11px 14px 11px 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  color: #173c35;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 2px 8px rgba(26, 61, 40, .05);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger:hover {
  background: #f6f9f2;
  border-color: #6d9874;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger:focus-visible {
  outline: 3px solid #e4ad57;
  outline-offset: 2px;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger.is-open {
  border-color: #426b50;
  box-shadow: 0 0 0 3px rgba(99, 134, 82, .12);
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-chevron {
  display: inline-flex;
  flex: 0 0 auto;
  color: #44674d;
  transition: transform .15s ease;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger.is-open .bsux-sort-chevron {
  transform: rotate(180deg);
}
/* Portal umieszczony poza siatką WooCommerce, by uniknąć przycinania listy. */
.bsux-sort-panel {
  box-sizing: border-box;
  position: fixed;
  z-index: 2147480000;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 7px;
  border: 1px solid #d6e3d7;
  border-radius: 14px;
  background: #fffefa;
  box-shadow: 0 18px 42px rgba(15, 45, 34, .17), 0 5px 14px rgba(15, 45, 34, .08);
}
.bsux-sort-panel[hidden] { display: none !important; }
.bsux-sort-option {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 43px;
  padding: 11px 12px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.3;
  color: #193c34;
  text-align: left;
  cursor: pointer;
  outline: none;
}
.bsux-sort-option:hover,
.bsux-sort-option:focus-visible {
  background: #edf4ea;
  color: #183c2f;
}
.bsux-sort-option[aria-selected="true"] {
  font-weight: 720;
  background: #e4eee1;
  color: #254c35;
}
.bsux-sort-option[aria-selected="true"]::after {
  content: '✓';
  flex: 0 0 auto;
  font-size: 18px;
  color: #386c46;
}
@media (max-width: 690px) {
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger {
    min-width: 0;
    width: 100%;
    font-size: 16px;
    padding-left: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger,
  body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-chevron {
    transition: none;
  }
}

/* Spójna typografia i strzałka również poza głównym kontenerem .nb-app. */
.bsux-sort-panel {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-chevron {
  display: block;
  width: 9px;
  height: 9px;
  margin-top: -4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s ease;
}
body.bsux-shop .nb-app main.nb-woo-catalog .bsux-ordering .bsux-sort-trigger.is-open .bsux-sort-chevron {
  transform: translateY(4px) rotate(225deg);
}
