/*
 * WRAPING — product-card cart-button width fix.
 * Scope: buttons in product LISTINGS. Never checkout/cart or product details.
 * Keep existing black/gold background, borders, hover states and site layout.
 */

/* No-JS: WooCommerce/blocks/themes' common loop button markup. */
body:not(.single-product) :is(
  ul.products li.product,
  .wc-block-grid__product,
  .wd-products .wd-product,
  .products-grid .product,
  .product-grid .product,
  .woocommerce .products .product
) :is(a.add_to_cart_button, a.product_type_simple, a.product_type_variable, a.product_type_grouped, button.add_to_cart_button) {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: auto !important;
  flex-shrink: 1 !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  padding: 10px 8px !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  text-overflow: clip !important;
  text-align: center !important;
}

/* JS marks custom WRAPING product cards by finding the literal CTA label. */
body .wrp-kosikfix-button {
  box-sizing: border-box !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  vertical-align: middle !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: auto !important;
  flex: 1 1 0 !important;
  height: auto !important;
  min-height: 43px !important;
  max-height: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding: 9px 7px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
  text-overflow: clip !important;
  text-align: center !important;
  cursor: pointer;
}

body .wrp-kosikfix-button :is(span, strong, b) {
  white-space: normal !important;
  overflow-wrap: normal !important;
  text-overflow: clip !important;
  max-width: 100% !important;
}

/* Only if the price and CTA actually share a compact footer parent. */
body .wrp-kosikfix-footer {
  display: flex !important;
  flex-flow: row nowrap !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 7px !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body .wrp-kosikfix-footer .wrp-kosikfix-price {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  max-width: 42% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  white-space: nowrap !important;
}

body .wrp-kosikfix-footer .wrp-kosikfix-button {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* The 4-column cards are ~278px wide. Narrower cards still show the full CTA. */
@media (max-width: 600px) {
  body .wrp-kosikfix-button {
    padding: 9px 5px !important;
    font-size: 10.5px !important;
  }
  body .wrp-kosikfix-footer {
    gap: 5px !important;
  }
}
