/* =====================================================================
 * KS-PDP-POLISH-V5 — fix v4 regressions + remaining gap + TL;DR redundancy
 * (2026-05-30)
 *
 * Issues from new screenshots:
 *  A) v4 made the qty stepper just a single "1" box — the native browser
 *     +/- arrows were squeezed out by my width/border overrides. There is
 *     NO bootstrap-touchspin in this theme; the qty is a plain
 *     <input type="number"> inside .product-quantity.qty. Solution: render
 *     proper CSS-only +/- pseudo-buttons attached to the input via a
 *     wrapper styling, AND inject a tiny JS that handles the click.
 *  B) Still ~200px empty between Bezpośrednie pobranie trust strip and the
 *     CTA. v4 reduced #content-wrapper from 2800 to 600px but the buybox
 *     column itself is short — the wasted space is between the legal-strip
 *     and product-actions. Pull the actions up + drop any reserved spacers.
 *  C) TL;DR aside (ks_aeo) is nearly identical content to .description-short
 *     which already renders directly below. Hide the visual TL;DR on PDPs
 *     while keeping its markup (still extractable for Speakable / AI).
 * ===================================================================== */

/* ---------- A. Qty stepper — full rebuild ---------- */
body.page-product .product-quantity {
  display: flex !important;
  align-items: center;
  gap: 12px;
  margin: 12px 0 14px !important;
}
body.page-product .product-quantity .qty {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  height: 48px;
}
body.page-product .product-quantity .qty input,
body.page-product .product-quantity #quantity_wanted,
body.page-product #quantity_wanted {
  width: 56px !important;
  height: 46px !important;
  min-height: 46px !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  text-align: center !important;
  border: 0 !important;
  background: transparent !important;
  color: #0f172a !important;
  -moz-appearance: textfield;
  appearance: textfield;
  padding: 0 !important;
  outline: none;
}
/* Kill the native Chrome/Safari +/- spinners (we provide our own) */
body.page-product .product-quantity .qty input::-webkit-inner-spin-button,
body.page-product .product-quantity .qty input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Custom +/- buttons via pseudo-elements on a sibling .ks-qty-step wrapper
 * injected by JS (see ks-pdp-polish-v5.js). Fallback: CSS-only buttons
 * created with negative margin overlays. */
body.page-product .product-quantity .qty::after {
  content: '';
  display: block;
  width: 28px;
  background: #f8fafc;
  border-left: 1px solid #e2e8f0;
}
body.page-product .ks-qty-step-up,
body.page-product .ks-qty-step-down {
  position: absolute;
  right: 0;
  width: 28px;
  height: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 0;
  border-left: 1px solid #e2e8f0;
  color: #475569;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
body.page-product .ks-qty-step-up {
  top: 0;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0 7px 0 0;
}
body.page-product .ks-qty-step-down {
  bottom: 0;
  border-radius: 0 0 7px 0;
}
body.page-product .ks-qty-step-up:hover,
body.page-product .ks-qty-step-down:hover {
  background: #e2e8f0;
  color: #0f172a;
}
body.page-product .ks-qty-step-up:active,
body.page-product .ks-qty-step-down:active {
  background: #cbd5e1;
}
/* When the JS wrapper is present, hide the css ::after fallback */
body.page-product .product-quantity .qty.ks-qty-enhanced::after {
  display: none;
}

/* CTA stays full-flex */
body.page-product .product-quantity .add,
body.page-product .product-quantity .add .btn-primary {
  flex: 1 1 auto;
  min-height: 52px !important;
}

/* ---------- B. Kill remaining empty space below trust strip ---------- */
body.page-product .pdp-col-buybox .product-information {
  display: flex;
  flex-direction: column;
}
body.page-product .ks-legal-strip {
  margin: 8px 0 10px !important;
}
/* The product-actions block was getting pushed down by stale CLS hacks.
 * Force it to sit immediately after the buybox content. */
body.page-product .product-actions {
  margin-top: 4px !important;
  padding-top: 0 !important;
}
/* Aggressive: no min-height anywhere in the buybox column */
body.page-product .pdp-col-buybox *:not(.btn-primary):not(.add-to-cart):not(.ks-qty-step-up):not(.ks-qty-step-down) {
  min-height: 0 !important;
}
body.page-product #content-wrapper {
  min-height: 400px !important;  /* was 600px, was 2800px */
}
@media (max-width: 991px) {
  body.page-product #content-wrapper {
    min-height: 500px !important;
  }
}

/* ---------- C. Hide redundant TL;DR aside on PDPs ---------- */
/* The TL;DR pulls from meta_description (or description_short fallback),
 * which IS the content the user already sees in .product-description
 * directly below. Keep markup for Speakable/AI extraction; hide visually. */
body.page-product .ks-aeo-tldr {
  display: none !important;
}
/* Category & CMS still benefit from visible TL;DR — only hide on PDPs */
