/* ---------------------------------------------------------------- WooCommerce: form controls and buttons
 * Shared by product, cart, checkout and account pages. Values from Breakdance's WooCommerce styling
 * (styles_mode "enabled"): inputs 1px #d1d5db, 3px radius, 12px 16px padding; primary buttons green,
 * 14px 24px, capitalised labels; select boxes with an 8px chevron; quantity boxes with - and + buttons.
 */

:is(.woocommerce, .woocommerce-page) :is(input.input-text, input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], textarea, select) {
	/* WooCommerce sets these in several places (block theme CSS, classic CSS), each more specific than the last. */
	background-color: #fff !important;
	border: 1px solid #d1d5db !important;
	border-radius: 3px !important;
	box-shadow: none;
	box-sizing: border-box !important;
	color: var(--wp--preset--color--body-text);
	font-family: inherit;
	font-size: var(--ioa-base) !important;
	height: auto;
	line-height: 1.4 !important;
	margin: 0 !important;
	min-width: 0 !important;
	outline: none;
	padding: 12px 16px !important;
	transition: all ease 300ms;
	width: 100%;
}

.woocommerce :where(input.input-text, input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], textarea, select):focus {
	border-color: var(--wp--preset--color--brand);
	box-shadow: var(--wp--preset--color--brand) 0 0 2px;
}

.woocommerce ::placeholder {
	color: #787e8b;
}

/* Select boxes: no native arrow; Breakdance's chevron, 8px, 20px from the right edge. */
/* ":not()" lifts this above the shared input rule so the 32px right padding wins. */
:is(.woocommerce, .woocommerce-page) select:not(.ioa-x) {
	appearance: none;
	-webkit-appearance: none;
	background-image: none !important;
	/* Chrome rounds a select's own height down (48px); Breakdance's came out at 1.4em + 26px (48.4px). */
	height: calc(var(--ioa-base) * 1.4 + 26px) !important;
	padding-right: 32px !important;
}

.ioa-woo-select {
	position: relative;
}

.ioa-woo-select__arrow {
	background-color: var(--wp--preset--color--headings);
	height: calc(100% - 2px);
	-webkit-mask: url(../images/icons/woo-chevron-down.svg) center left / 8px no-repeat;
	mask: url(../images/icons/woo-chevron-down.svg) center left / 8px no-repeat;
	pointer-events: none;
	position: absolute;
	right: 1px;
	top: 1px;
	width: 20px;
}

/* Labels */
.woocommerce form label,
.woocommerce table.variations label {
	color: var(--wp--preset--color--headings);
	font-weight: 500;
	line-height: 1;
}

/* Primary buttons (add to basket, checkout, place order, log in, update ...). Place order is matched as
   [id="place_order"]: an id inside :is() would lift the whole rule above every page-specific rule. */
.woocommerce :is(button.single_add_to_cart_button, a.single_add_to_cart_button, a.checkout-button, [id="place_order"], button[name="login"], button[name="register"], button[name="save_address"], button[name="save_account_details"], a.button.wc-backward, .woocommerce-button.pay, p.order-again a.button, button[type="submit"].woocommerce-Button),
.wc-block-components-button.wc-block-mini-cart__footer-checkout {
	align-items: center;
	background: var(--wp--preset--color--brand);
	border: 1px solid transparent;
	border-radius: 3px;
	box-shadow: none;
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	flex-direction: row;
	font-family: inherit;
	font-size: var(--ioa-base);
	font-weight: 500;
	gap: 4.944px;
	justify-content: center;
	line-height: 1;
	opacity: 1;
	padding: 14px 24px;
	text-align: center;
	text-decoration: none;
	text-transform: capitalize;
	transition: all ease 300ms;
	width: max-content;
}

/* Breakdance never faded the add-to-basket button before a size was chosen. */
.woocommerce button.single_add_to_cart_button.disabled,
.woocommerce button.single_add_to_cart_button:disabled {
	cursor: not-allowed;
	opacity: 1;
}

/* Quantity: a centred number with - and + buttons inside the box (inc/woo-pages.php adds the buttons). */
.woocommerce .quantity.quantity {
	align-self: stretch;
	display: block;
	margin: 0;
	max-width: 85px;
	position: relative;
	width: 100%;
}

@media (max-width: 767px) {
	.woocommerce .quantity.quantity {
		max-width: 75px;
	}
}

/* Products sold one at a time (the memberships) have a hidden quantity: no box, no - and + buttons. */
.woocommerce .quantity.quantity:has(input[type="hidden"]) {
	display: none;
}

.woocommerce .quantity input.qty {
	-moz-appearance: textfield;
	appearance: textfield;
	height: 100%;
	text-align: center;
	width: 100% !important;
}

.woocommerce .quantity input.qty::-webkit-outer-spin-button,
.woocommerce .quantity input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.ioa-woo-qty-button {
	align-items: center;
	appearance: none;
	background: transparent;
	border: 0;
	border-radius: 4px;
	color: #6b7280;
	cursor: pointer;
	display: flex;
	font-size: 10px;
	justify-content: center;
	line-height: 1.15;
	padding: 2px 6px;
	position: absolute;
	/* top 50% and bottom 5px: the button is half the box minus 5px tall, centred by the transform (Breakdance). */
	bottom: 5px;
	top: 50%;
	transform: translateY(-50%);
}

.ioa-woo-qty-button::before {
	background-color: currentColor;
	content: "";
	display: block;
	height: 1em;
	-webkit-mask: var(--ioa-qty-icon) center / 100% 100% no-repeat;
	mask: var(--ioa-qty-icon) center / 100% 100% no-repeat;
	width: 1em;
}

.ioa-woo-qty-button--dec {
	--ioa-qty-icon: url(../images/icons/woo-minus.svg);
	left: 5px;
}

.ioa-woo-qty-button--inc {
	--ioa-qty-icon: url(../images/icons/woo-plus.svg);
	right: 5px;
}

/* A link styled as Breakdance's text button with a chevron after it ("View Sizing Guide >"). */
.ioa-woo-more {
	display: flex;
}

.ioa-woo-more a {
	align-items: center;
	border: 1px solid transparent;
	color: var(--wp--preset--color--brand);
	display: inline-flex;
	font-weight: 500;
	line-height: 1;
	padding: 5px 0;
	text-decoration: none;
}

.ioa-woo-more a::after {
	background-color: currentColor;
	content: "";
	display: block;
	height: 0.9em;
	margin: 0 4px;
	-webkit-mask: url(../images/icons/woo-chevron-right.svg) 0 0 / 100% 100% no-repeat;
	mask: url(../images/icons/woo-chevron-right.svg) 0 0 / 100% 100% no-repeat;
	width: 0.9em;
}
