/**
 * Add-to-cart icon on product pictures only.
 * Default: #2E5AA7 bg / #FDE466 icon
 * Hover:   #FDE466 bg / #2E5AA7 icon
 */

ul.products .product .product-item .item--popcard .button,
ul.products .product .product-item .product-item__description--popcard .button,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button,
ul.products .product .product-item .product-item__description--actions .button.product_type_variable,
ul.products .product .product-item .product-item__description--actions .button.product_type_simple,
ul.products .product .product-item .product-item__description--actions .button.ajax_add_to_cart {
	background-color: #2e5aa7 !important;
	background-image: none !important;
	color: #fde466 !important;
	border-color: #2e5aa7 !important;
	box-shadow: none !important;
	fill: #fde466;
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, fill 0.25s ease;
}

ul.products .product .product-item .item--popcard .button svg,
ul.products .product .product-item .product-item__description--popcard .button svg,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button svg,
ul.products .product .product-item .product-item__description--actions .button.product_type_variable svg,
ul.products .product .product-item .product-item__description--actions .button.product_type_simple svg,
ul.products .product .product-item .product-item__description--actions .button.ajax_add_to_cart svg,
ul.products .product .product-item .item--popcard .button svg use,
ul.products .product .product-item .product-item__description--popcard .button svg use {
	fill: currentColor !important;
	color: inherit;
	stroke: currentColor;
}

ul.products .product .product-item .item--popcard .button:hover,
ul.products .product .product-item .item--popcard .button:focus,
ul.products .product .product-item .product-item__description--popcard .button:hover,
ul.products .product .product-item .product-item__description--popcard .button:focus,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button:hover,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button:focus,
ul.products .product .product-item .product-item__description--actions .button.product_type_variable:hover,
ul.products .product .product-item .product-item__description--actions .button.product_type_variable:focus,
ul.products .product .product-item .product-item__description--actions .button.product_type_simple:hover,
ul.products .product .product-item .product-item__description--actions .button.product_type_simple:focus,
ul.products .product .product-item .product-item__description--actions .button.ajax_add_to_cart:hover,
ul.products .product .product-item .product-item__description--actions .button.ajax_add_to_cart:focus {
	background-color: #fde466 !important;
	background-image: none !important;
	color: #2e5aa7 !important;
	border-color: #fde466 !important;
	fill: #2e5aa7;
	box-shadow: none !important;
}

/* Keep the same palette after add / loading states on the picture icon. */
ul.products .product .product-item .item--popcard .button.added,
ul.products .product .product-item .product-item__description--popcard .button.added,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button.added,
ul.products .product .product-item .product-item__description--actions .button.product_type_variable.added {
	background-color: #2e5aa7 !important;
	color: #fde466 !important;
	border-color: #2e5aa7 !important;
}

/*
 * Shop photo add-to-cart: same circle spinner as wishlist (not dots).
 * Variable products get .loading / .jaj-cart-loading from jaj-product-share.js;
 * AJAX simple products get .loading from WooCommerce.
 */
ul.products .product .product-item .jaj-photo-actions-pill > .button.loading,
ul.products .product .product-item .jaj-photo-actions-pill > .button.jaj-cart-loading,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.loading,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.jaj-cart-loading,
ul.products .product .product-item .jaj-photo-actions-pill > .add_to_cart_button.loading,
ul.products .product .product-item .jaj-photo-actions-pill > .add_to_cart_button.jaj-cart-loading,
ul.products .product .product-item .jaj-photo-actions-pill > .ajax_add_to_cart.loading,
ul.products .product .product-item .jaj-photo-actions-pill > .ajax_add_to_cart.jaj-cart-loading,
ul.products .product .product-item .jaj-photo-actions-pill > .product_type_variable.loading,
ul.products .product .product-item .jaj-photo-actions-pill > .product_type_variable.jaj-cart-loading,
ul.products .product .product-item .item--popcard .button.loading,
ul.products .product .product-item .product-item__description--popcard .button.loading,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button.loading,
ul.products .product .product-item .product-item__description--actions .button.ajax_add_to_cart.loading {
	position: relative !important;
	overflow: visible !important;
	opacity: 1 !important;
	cursor: wait;
	pointer-events: none;
}

ul.products .product .product-item .jaj-photo-actions-pill:has(> .button.loading),
ul.products .product .product-item .jaj-photo-actions-pill:has(> .button.jaj-cart-loading),
ul.products .product .product-item .jaj-photo-actions-pill:has(> .add_to_cart_button.loading),
ul.products .product .product-item .jaj-photo-actions-pill:has(> .ajax_add_to_cart.loading) {
	overflow: visible !important;
}

ul.products .product .product-item .jaj-photo-actions-pill > .button.loading > svg,
ul.products .product .product-item .jaj-photo-actions-pill > .button.jaj-cart-loading > svg,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.loading > svg,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.jaj-cart-loading > svg,
ul.products .product .product-item .jaj-photo-actions-pill > .add_to_cart_button.loading > svg,
ul.products .product .product-item .jaj-photo-actions-pill > .add_to_cart_button.jaj-cart-loading > svg,
ul.products .product .product-item .jaj-photo-actions-pill > .ajax_add_to_cart.loading > svg,
ul.products .product .product-item .jaj-photo-actions-pill > .ajax_add_to_cart.jaj-cart-loading > svg,
ul.products .product .product-item .item--popcard .button.loading > svg,
ul.products .product .product-item .product-item__description--popcard .button.loading > svg,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button.loading > svg,
ul.products .product .product-item .product-item__description--actions .button.ajax_add_to_cart.loading > svg,
ul.products .product .product-item .jaj-photo-actions-pill > .button.loading > .text,
ul.products .product .product-item .jaj-photo-actions-pill > .button.jaj-cart-loading > .text,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.loading > .text,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.jaj-cart-loading > .text,
ul.products .product .product-item .jaj-photo-actions-pill > .button.loading > span,
ul.products .product .product-item .jaj-photo-actions-pill > .button.jaj-cart-loading > span,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.loading > span,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.jaj-cart-loading > span {
	visibility: hidden !important;
	opacity: 0 !important;
}

/* Hide WooCommerce default loading glyph. */
ul.products .product .product-item .jaj-photo-actions-pill > .button.loading::before,
ul.products .product .product-item .jaj-photo-actions-pill > .button.jaj-cart-loading::before,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.loading::before,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.jaj-cart-loading::before,
ul.products .product .product-item .jaj-photo-actions-pill > .add_to_cart_button.loading::before,
ul.products .product .product-item .jaj-photo-actions-pill > .add_to_cart_button.jaj-cart-loading::before,
ul.products .product .product-item .jaj-photo-actions-pill > .ajax_add_to_cart.loading::before,
ul.products .product .product-item .jaj-photo-actions-pill > .ajax_add_to_cart.jaj-cart-loading::before,
ul.products .product .product-item .item--popcard .button.loading::before,
ul.products .product .product-item .product-item__description--popcard .button.loading::before,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button.loading::before,
ul.products .product .product-item .product-item__description--actions .button.ajax_add_to_cart.loading::before {
	content: none !important;
	display: none !important;
	animation: none !important;
}

ul.products .product .product-item .jaj-photo-actions-pill > .button.loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > .button.jaj-cart-loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > a.button.jaj-cart-loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > .add_to_cart_button.loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > .add_to_cart_button.jaj-cart-loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > .ajax_add_to_cart.loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > .ajax_add_to_cart.jaj-cart-loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > .product_type_variable.loading::after,
ul.products .product .product-item .jaj-photo-actions-pill > .product_type_variable.jaj-cart-loading::after,
ul.products .product .product-item .item--popcard .button.loading::after,
ul.products .product .product-item .product-item__description--popcard .button.loading::after,
ul.products .product .product-item .product-item__description--actions .button.add_to_cart_button.loading::after,
ul.products .product .product-item .product-item__description--actions .button.ajax_add_to_cart.loading::after {
	content: '' !important;
	display: block !important;
	position: absolute !important;
	left: 50% !important;
	top: 50% !important;
	width: 14px !important;
	height: 14px !important;
	margin: -7px 0 0 -7px !important;
	box-sizing: border-box !important;
	border: 2px solid currentColor !important;
	border-top-color: transparent !important;
	border-radius: 50% !important;
	background: transparent !important;
	animation: jajShopCartBtnSpin 0.6s linear infinite !important;
	z-index: 2;
	pointer-events: none;
}

@keyframes jajShopCartBtnSpin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* Product page: dots loading on “افزودن به سبد خرید” (same as cart/minicart). */
.single-product form.cart .single_add_to_cart_button.jaj-btn-loading,
.single-product .single_add_to_cart_button.button.jaj-btn-loading,
.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button.jaj-btn-loading {
	position: relative !important;
	overflow: visible !important;
	color: transparent !important;
	-webkit-text-fill-color: transparent !important;
	text-shadow: none !important;
	pointer-events: none;
}

.single-product form.cart .single_add_to_cart_button.jaj-btn-loading .jj-btn-label,
.single-product .single_add_to_cart_button.button.jaj-btn-loading .jj-btn-label,
.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button.jaj-btn-loading .jj-btn-label {
	visibility: hidden !important;
	opacity: 0 !important;
	color: transparent !important;
	-webkit-text-fill-color: transparent !important;
}

.single-product form.cart .single_add_to_cart_button .jj-btn-loader,
.single-product .single_add_to_cart_button.button .jj-btn-loader,
.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button .jj-btn-loader {
	display: none;
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	flex-direction: row;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: center;
	gap: 5px;
	height: 18px;
	z-index: 2;
	pointer-events: none;
	writing-mode: horizontal-tb;
	overflow: visible;
}

.single-product form.cart .single_add_to_cart_button.jaj-btn-loading .jj-btn-loader,
.single-product .single_add_to_cart_button.button.jaj-btn-loading .jj-btn-loader,
.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button.jaj-btn-loading .jj-btn-loader {
	display: flex;
}

.single-product form.cart .single_add_to_cart_button .jj-btn-loader span,
.single-product .single_add_to_cart_button.button .jj-btn-loader span,
.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button .jj-btn-loader span {
	display: block;
	width: 7px;
	height: 7px;
	flex-shrink: 0;
	border-radius: 50%;
	background: #fff;
	animation: jjPdpAddToCartDotWiggle 0.9s ease-in-out infinite;
}

.single-product form.cart .single_add_to_cart_button .jj-btn-loader span:nth-child(2),
.single-product .single_add_to_cart_button.button .jj-btn-loader span:nth-child(2),
.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button .jj-btn-loader span:nth-child(2) {
	animation-delay: 0.15s;
}

.single-product form.cart .single_add_to_cart_button .jj-btn-loader span:nth-child(3),
.single-product .single_add_to_cart_button.button .jj-btn-loader span:nth-child(3),
.single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button .jj-btn-loader span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes jjPdpAddToCartDotWiggle {
	0%, 100% { transform: translateY(0); opacity: 0.45; }
	50% { transform: translateY(-5px); opacity: 1; }
}
