/* ========================================================================== 
   WooCommerce Product Button States
   Scope: product listings using Woo Blocks product button markup
   ========================================================================== */

/* Loading spinner used by cart-button-loading.js */
.wc-block-components-product-button__button.loading,
.wc-block-components-product-button__button.upjau-cart-pending {
	position: relative;
	overflow: hidden;
	text-indent: -9999px;
}

.wc-block-components-product-button__button.loading::after,
.wc-block-components-product-button__button.upjau-cart-pending::after {
	content: "";
	position: absolute;
	inset: 0;
	width: 1.125rem;
	height: 1.125rem;
	margin: auto;
	border: 0.125rem solid currentColor;
	border-right-color: transparent;
	border-radius: var(--radius-full);
	animation: upjau-spin 0.8s linear infinite;
}

@keyframes upjau-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Quantity switcher used by product-card-quantity.js */
.wc-block-components-product-button.upjau-product-button--qty-control[data-upjau-qty-active="1"]
	.wc-block-components-product-button__button {
	display: none;
}

.wc-block-components-product-button.upjau-product-button--qty-control .upjau-product-qty-control {
	display: none;
	position: relative;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin: 0;
	min-height: 49px;
	border-radius: var(--radius-md);
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--white, #fff);
	overflow: hidden;
}

.wc-block-components-product-button.upjau-product-button--qty-control {
	gap: 0;
}

.wc-block-components-product-button.upjau-product-button--qty-control[data-upjau-qty-active="1"]
	.upjau-product-qty-control {
	display: flex;
}

.wc-block-components-product-button.upjau-product-button--qty-control
	.upjau-product-qty-control__button {
	appearance: none;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1;
	width: 2.75rem;
	min-height: 49px;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background-color var(--upjau-transition-normal);
}

.wc-block-components-product-button.upjau-product-button--qty-control
	.upjau-product-qty-control__button:hover {
	background-color: rgba(255, 255, 255, 0.16);
}

.wc-block-components-product-button.upjau-product-button--qty-control
	.upjau-product-qty-control__button:focus-visible {
	outline: 2px solid var(--wp--preset--color--sunflower);
	outline-offset: -2px;
	background-color: rgba(255, 255, 255, 0.2);
}

.wc-block-components-product-button.upjau-product-button--qty-control
	.upjau-product-qty-control__button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.wc-block-components-product-button.upjau-product-button--qty-control .upjau-product-qty-control__value {
	flex: 1;
	text-align: center;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 700;
	letter-spacing: 0.01em;
}

.wc-block-components-product-button.upjau-product-button--qty-control[data-upjau-qty-busy="1"]
	.upjau-product-qty-control {
	color: transparent;
	pointer-events: none;
}

.wc-block-components-product-button.upjau-product-button--qty-control[data-upjau-qty-busy="1"]
	.upjau-product-qty-control::after {
	content: "";
	position: absolute;
	inset: 0;
	width: 1.125rem;
	height: 1.125rem;
	margin: auto;
	border: 0.125rem solid var(--wp--preset--color--white, #fff);
	border-right-color: transparent;
	border-radius: var(--radius-full);
	animation: upjau-spin 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
	.wc-block-components-product-button__button.loading::after,
	.wc-block-components-product-button__button.upjau-cart-pending::after,
	.wc-block-components-product-button.upjau-product-button--qty-control[data-upjau-qty-busy="1"]
		.upjau-product-qty-control::after {
		animation: none;
	}
}
