/**
 * cs-qty-stepper — one bordered box, number left, stacked up/down arrows at the
 * right edge (Tif's reference design, Aug 5 2026).
 *
 * Styles BOTH stepper sources so they look identical:
 *   .cs-qty-stepper        — our wrapper on standard Woo qty inputs
 *   .pewc-plusminus-wrapper — PEWC's native wrapper on child-product qty fields
 *
 * DOM order in both is [minus, input, plus]; the buttons are absolutely
 * positioned, so visual order is independent of markup order.
 */

/* The BOX owns the width. PEWC's own stylesheet makes this wrapper a flex
   container whose input has width: 0 + flex-grow, so sizing the input alone is
   ignored — the used width comes from the flex line. Fix the wrapper instead and
   let the input flex to fill it. */
.cs-qty-stepper,
.pewc-plusminus-wrapper {
	position: relative;
	display: inline-flex !important;
	align-items: stretch;
	background: #fff;
	border: 1px solid #c9c9c9;
	border-radius: 3px;
	box-sizing: border-box;
	overflow: hidden;
	vertical-align: middle;
	width: 90px !important;
	/* PEWC's quantity cell is itself a flex container, which would stretch this
	   box past its width; flex: 0 0 auto + max-width pin it. */
	flex: 0 0 auto !important;
	max-width: 90px !important;
}

/* The theme/Elementor style inputs and buttons with high-specificity rules that
   load after this file, so the visual properties below are forced. */
.cs-qty-stepper input[type="number"],
.pewc-plusminus-wrapper input[type="number"] {
	appearance: textfield;
	-moz-appearance: textfield;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	box-sizing: border-box !important;
	flex: 1 1 auto !important;
	margin: 0 !important;
	min-height: 2.4em;
	min-width: 0 !important;
	outline: 0;
	padding: 0.5em 30px 0.5em 0.75em !important;
	text-align: left !important;
	width: auto !important;
}

.cs-qty-stepper input[type="number"]::-webkit-outer-spin-button,
.cs-qty-stepper input[type="number"]::-webkit-inner-spin-button,
.pewc-plusminus-wrapper input[type="number"]::-webkit-outer-spin-button,
.pewc-plusminus-wrapper input[type="number"]::-webkit-inner-spin-button {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
}

/* Stacked arrow buttons pinned to the right edge.
   height/width carry !important: PEWC's plusminus.js sets an inline height.
   ⚠️ Width MUST be px, not em — font-size: 0 (which hides the -/+ glyphs) would
   collapse any em width to 0 and the arrows would render clipped. */
.cs-qty-btn,
.pewc-plusminus-btn {
	background: transparent !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	cursor: pointer;
	font-size: 0 !important;
	height: 50% !important;
	line-height: 0;
	margin: 0 !important;
	min-height: 0;
	min-width: 0;
	padding: 0 !important;
	position: absolute;
	right: 0;
	transition: background-color 0.15s ease;
	width: 28px !important;
}

.cs-qty-plus,
.pewc-plus-btn {
	top: 0;
}

.cs-qty-minus,
.pewc-minus-btn {
	bottom: 0;
}

/* Triangles replace the -/+ glyphs (hidden via font-size: 0 above). */
.cs-qty-btn::before,
.pewc-plusminus-btn::before {
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	content: "";
	height: 0;
	left: 50%;
	position: absolute;
	top: 50%;
	transform: translate( -50%, -50% );
	width: 0;
}

.cs-qty-plus::before,
.pewc-plus-btn::before {
	border-bottom: 6px solid #333;
	margin-top: -1px;
}

.cs-qty-minus::before,
.pewc-minus-btn::before {
	border-top: 6px solid #333;
	margin-top: 1px;
}

.cs-qty-btn:hover,
.cs-qty-btn:focus,
.pewc-plusminus-btn:hover,
.pewc-plusminus-btn:focus {
	background: #f1f1f1 !important;
}

.cs-qty-btn:disabled,
.pewc-plusminus-btn:disabled {
	cursor: default;
	opacity: 0.35;
}

.cs-qty-btn:disabled:hover,
.pewc-plusminus-btn:disabled:hover {
	background: transparent !important;
}

/* Divider between the two arrow halves, mirroring a native spinner. */
.cs-qty-plus,
.pewc-plus-btn {
	border-bottom: 1px solid #e4e4e4 !important;
}

/* -----------------------------------------------------------------------------------------
 * Module 34 (qty-input-visibility) — hide the wrapper left behind when the quantity input
 * is switched to type="hidden" on a flagged product.
 *
 * WooCommerce hardcodes <div class="quantity"> in global/quantity-input.php, so it cannot be
 * filtered away in PHP. Scoped to the body class rather than matching hidden inputs globally,
 * which would also catch quantity markup elsewhere on the site.
 * -------------------------------------------------------------------------------------- */
.cs-qty-input-hidden .quantity {
	display: none;
}
