/* Structural base styles for the Buy Now button.
   Goal: keep the Buy Now button on the SAME ROW as the Add to Cart button across
   any theme. Relying on `display:inline-block` alone is not enough — block themes
   (e.g. Twenty Twenty-Five) lay the WooCommerce `form.cart` out as a flex/grid
   container, which blockifies inline children and stretches them to full width,
   pushing the button onto its own row. So we also control the row container.
   Configurable properties (color, typography, border, spacing) are output as
   inline CSS via Buy_Now::build_inline_css(). */

/* Make the add-to-cart row a horizontal flex container so the quantity,
   Add to Cart, and Buy Now controls sit side by side regardless of the theme's
   default form layout. Scoped to forms that actually contain our button, and
   excluded for variable/grouped products whose forms hold tables/variations. */
form.cart:has(.kb-buy-now-btn):not(.variations_form):not(.grouped_form) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em;
}

/* The button itself: shrink to its content and never stretch, whether the parent
   is a normal block, an inline-flow, or a flex/grid container. */
.kb-buy-now-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	max-width: 100%;
	flex: 0 0 auto !important;
	align-self: center !important;
	float: none !important;
	vertical-align: middle;
	box-sizing: border-box;
	cursor: pointer;
	text-decoration: none;
	line-height: 1;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Fallback for browsers without :has() support — keep the button inline and
   auto-width so it still flows next to the Add to Cart button rather than
   stretching to a full-width block on its own row. */
@supports not selector(form.cart:has(.kb-buy-now-btn)) {
	.kb-buy-now-btn {
		display: inline-block !important;
	}
}
