/* =====================================================================
 * KS-CROB-V1 (2026-09-27) — product page buy box and clarity blocks.
 * Linked render-blocking from catalog/product.tpl (after ks-pdp-mobile-reorder-v1.css) because every rule
 * here touches the first screen. Does not restyle button.add-to-cart or #ks-sticky-cta (live PostHog
 * experiments and ks-cta-contrast.css own those).
 *
 *  1. Quantity stepper "− [n] +": 44x46 buttons (were 28x23 up/down arrows). Before theme JS wraps the
 *     input in bootstrap-touchspin, the bare input already sits between the two button slots, so nothing
 *     moves when the buttons appear; ks-lcp2-pdp-crit (stylesheets.tpl) reserves the same 134x48 box.
 *  2. "Kup teraz" (product-add-to-cart.tpl): secondary full-width button under "Do koszyka".
 *  3. Quantity-tier hint, variant box and edition table: flex order in the buy box (desktop order scheme is
 *     in product-prices.tpl, the phone one in ks-pdp-mobile-reorder-v1.css).
 *  4. Sold-out pages: the ks_aeo alternatives block replaces the disabled button (body.ks-oos-has-alt is set
 *     by that block's inline script while the page is parsed), and the unavailable price is muted.
 *  5. "Apple Pay" payment chip: white on black (ks-iter.css forced #0f172a text on its black background).
 * ===================================================================== */

/* ---- 1. Quantity stepper ------------------------------------------------ */
body#product #add-to-cart-or-refresh .product-quantity .qty {
  position: relative !important;
  flex: 0 0 134px !important;
  width: 134px !important;
  min-width: 134px !important;
  max-width: 134px !important;
  height: 48px !important;
  min-height: 48px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: stretch !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  background: #fff !important;
}
body#product #add-to-cart-or-refresh .product-quantity .qty::before,
body#product #add-to-cart-or-refresh .product-quantity .qty::after { display: none !important; content: none !important; }
body#product #add-to-cart-or-refresh .product-quantity .qty #quantity_wanted {
  order: 2 !important;
  flex: 0 0 44px !important;
  width: 44px !important;
  min-width: 44px !important;
  height: 46px !important;
  min-height: 46px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #fff !important;
  color: #0f172a !important;
  font-size: 16px !important; /* no iOS zoom on focus */
  font-weight: 600 !important;
  text-align: center !important;
  float: none !important;
  -moz-appearance: textfield;
}
/* bare input (before bootstrap-touchspin runs): same x as after, between the two 44px button slots */
body#product #add-to-cart-or-refresh .product-quantity .qty > #quantity_wanted { margin-left: 44px !important; }
body#product #add-to-cart-or-refresh .product-quantity .qty .bootstrap-touchspin {
  display: flex !important;
  align-items: stretch !important;
  width: 132px !important;
  height: 46px !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: visible !important;
}
body#product #add-to-cart-or-refresh .product-quantity .qty .input-group-btn-vertical { display: contents !important; }
body#product #add-to-cart-or-refresh .product-quantity .qty .btn-touchspin {
  position: static !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 44px !important;
  width: 44px !important;
  min-width: 44px !important;
  max-width: 44px !important;
  height: 46px !important;
  min-height: 46px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #f1f5f9 !important;
  color: #0f172a !important;
  box-shadow: none !important;
  font-size: 22px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  top: auto !important;
  bottom: auto !important;
  transform: none !important;
}
body#product #add-to-cart-or-refresh .product-quantity .qty .bootstrap-touchspin-down { order: 1 !important; border-right: 1px solid #e2e8f0 !important; }
body#product #add-to-cart-or-refresh .product-quantity .qty .bootstrap-touchspin-up { order: 3 !important; border-left: 1px solid #e2e8f0 !important; }
body#product #add-to-cart-or-refresh .product-quantity .qty .btn-touchspin i { display: none !important; }
body#product #add-to-cart-or-refresh .product-quantity .qty .btn-touchspin::after { content: none !important; display: none !important; }
body#product #add-to-cart-or-refresh .product-quantity .qty .bootstrap-touchspin-down::before { content: "\2212"; }
body#product #add-to-cart-or-refresh .product-quantity .qty .bootstrap-touchspin-up::before { content: "+"; }
body#product #add-to-cart-or-refresh .product-quantity .qty .btn-touchspin:hover { background: #e2e8f0 !important; }
body#product #add-to-cart-or-refresh .product-quantity .qty .btn-touchspin:focus-visible {
  outline: 2px solid #f97316 !important;
  outline-offset: -2px !important;
}
body#product #add-to-cart-or-refresh .product-quantity .qty #quantity_wanted::-webkit-inner-spin-button,
body#product #add-to-cart-or-refresh .product-quantity .qty #quantity_wanted::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---- 2. "Kup teraz" ------------------------------------------------------ */
body#product .ks-buy-now {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 10px 0 0;
  padding: 10px 16px;
  border: 2px solid #0f172a;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
body#product .ks-buy-now:hover { background: #0f172a; color: #fff; }
body#product .ks-buy-now:focus-visible { outline: 2px solid #f97316; outline-offset: 2px; }
body#product .ks-buy-now[disabled] { cursor: progress; opacity: .75; }
/* while "Kup teraz" runs, the add-to-cart pop-up stays hidden — the next screen is the order page */
html.ks-buy-now-pending #blockcart-modal,
html.ks-buy-now-pending .modal-backdrop { display: none !important; }
@media (prefers-reduced-motion: reduce) { body#product .ks-buy-now { transition: none; } }

/* ---- 3. Order of the new buy-box blocks ------------------------------------ */
body#product #ks-qty-tier-hint { margin: 8px 0 0; }
@media (min-width: 768px) {
  body#product .pdp-col-buybox .product-information > #ks-qty-tier-hint { order: 5 !important; }
  body#product .pdp-col-buybox .product-information > .ks-variant-cmp { order: 5 !important; }
  body#product .pdp-col-buybox .product-information > .ks-edition-cmp { order: 10 !important; }
}
@media (max-width: 767px) {
  body#product .pdp-col-buybox .product-information > #ks-qty-tier-hint,
  body#product .pdp-col-buybox .product-information > .ks-variant-cmp {
    order: 4 !important;
    width: 100% !important;
    flex: 0 0 100% !important;
  }
}

/* Variant box: "Ta sama aktywacja … — wersja OEM za 89,90 zł" (ks_aeo KsPdpCompare) */
body#product .ks-variant-cmp {
  box-sizing: border-box;
  margin: 12px 0 0;
  padding: 14px 16px;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
  border-radius: 12px;
  background: #f0fdf4;
  color: #1e293b;
  text-align: left;
}
body#product section.ks-variant-cmp p.ks-variant-cmp__h {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
}
body#product section.ks-variant-cmp p.ks-variant-cmp__txt {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  color: #334155;
}
body#product section.ks-variant-cmp--info p.ks-variant-cmp__txt { margin: 0; }
body#product .ks-variant-cmp--info { border-color: #e2e8f0; border-left-color: #64748b; background: #f8fafc; }
body#product .ks-variant-cmp__txt a { color: #1d4ed8; text-decoration: underline; text-underline-offset: 2px; }
body#product .ks-variant-cmp__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
body#product .ks-variant-cmp__buy { margin: 0; }
body#product .ks-variant-cmp__add {
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: #15803d;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
body#product .ks-variant-cmp__add:hover { background: #166534; color: #fff; }
body#product .ks-variant-cmp__add:focus-visible { outline: 2px solid #15803d; outline-offset: 2px; }
body#product .ks-variant-cmp__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: #166534;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
@media (max-width: 480px) {
  body#product .ks-variant-cmp__buy, body#product .ks-variant-cmp__add { width: 100%; }
}

/* Edition table */
body#product .ks-edition-cmp {
  box-sizing: border-box;
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #1e293b;
  text-align: left;
}
body#product section.ks-edition-cmp p.ks-edition-cmp__h { margin: 0 0 8px; font-size: 16px; font-weight: 700; line-height: 1.35; color: #0f172a; }
body#product .ks-edition-cmp__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
body#product .ks-edition-cmp__table { width: 100%; min-width: 300px; border-collapse: collapse; font-size: 13px; line-height: 1.35; }
body#product .ks-edition-cmp__table th,
body#product .ks-edition-cmp__table td { padding: 8px 6px; border-bottom: 1px solid #f1f5f9; text-align: center; vertical-align: middle; }
body#product .ks-edition-cmp__table tbody th { width: 30%; text-align: left; font-weight: 500; color: #334155; }
body#product .ks-edition-cmp__table thead th { vertical-align: bottom; font-weight: 700; color: #0f172a; }
body#product .ks-edition-cmp__table thead th a { display: inline-block; padding: 4px 0; color: #0f172a; text-decoration: underline; text-underline-offset: 2px; }
body#product .ks-edition-cmp__price { display: block; font-size: 12px; font-weight: 500; color: #475569; }
body#product .ks-edition-cmp__here {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ffedd5;
  color: #9a3412;
  font-size: 11px;
  font-weight: 700;
}
body#product .ks-edition-cmp__table .is-current { background: #fff7ed; }
body#product .ks-edition-cmp__yes { color: #15803d; font-size: 16px; font-weight: 700; }
body#product .ks-edition-cmp__no { color: #94a3b8; }
body#product .ks-edition-cmp__sr {
  position: absolute;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
body#product section.ks-edition-cmp p.ks-edition-cmp__help { margin: 10px 0 0; font-size: 13px; line-height: 1.5; color: #475569; }

/* ---- 4. Sold-out pages ------------------------------------------------------ */
/* the ks_aeo block right under the price is the buy action; the disabled quantity + button, the
   "nie można teraz dodać" note and the payment chips of an unbuyable product are not shown */
body#product.ks-oos-has-alt #add-to-cart-or-refresh .product-add-to-cart .product-quantity,
body#product.ks-oos-has-alt #add-to-cart-or-refresh .product-add-to-cart .control-label,
body#product.ks-oos-has-alt #add-to-cart-or-refresh .ks-oos-note,
body#product.ks-oos-has-alt #add-to-cart-or-refresh .ks-pdp-pay-chips { display: none !important; }
body#product .product-prices.ks-price--unavailable .current-price-value {
  color: #64748b !important;
  font-size: 22px !important;
  font-weight: 600 !important;
}

/* ---- 5. Apple Pay chip -------------------------------------------------------- */
body#product .ks-pdp-pay-chips .ks-pdp-pay-chip.ks-pdp-pay-chip--apay {
  background: #000 !important;
  border-color: #000 !important;
  color: #fff !important;
}

/* ---- 6. Phone teaser for the cheaper offer of the same key (inside the buy form, under "Kup teraz") ---- */
body#product .ks-variant-teaser { margin: 10px 0 0; }
body#product .ks-variant-teaser a {
  display: block;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: #f0fdf4;
  color: #14532d;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}
body#product .ks-variant-teaser a:focus-visible { outline: 2px solid #15803d; outline-offset: 2px; }
body#product .ks-variant-teaser__more { color: #15803d; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
@media (min-width: 768px) { body#product .ks-variant-teaser { display: none !important; } }

/* ---- 7. Sold-out block: status line and disclaimer at their intended size (theme p rules enlarged them to
   ~20px on phones, pushing the in-stock offer under the fold) ---- */
body#product section.ks-oos-alt p.ks-oos-alt__h { margin: 0 0 4px; font-size: 16px; line-height: 1.35; }
body#product section.ks-oos-alt p.ks-oos-alt__intro { margin: 0 0 8px; font-size: 13px; line-height: 1.45; }

/* ---- 8. Phones: stepper and "Do koszyka" stay on one row (134 + 10 + the rest of the column), so "Kup teraz"
   still starts inside the first screen at 375x812 ---- */
@media (max-width: 767px) {
  body#product #add-to-cart-or-refresh .product-add-to-cart .product-quantity {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  body#product #add-to-cart-or-refresh .product-add-to-cart .product-quantity .add {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    margin: 0 !important;
  }
  body#product #add-to-cart-or-refresh .product-add-to-cart .product-quantity .add .add-to-cart {
    width: 100% !important;
    min-width: 0 !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    white-space: nowrap !important;
  }
}
