/* cj-cart-ajax 1.0.0 — estados del botón «Agregar al carrito», aviso de error y toast de respaldo */

/* Botón principal y botones que delegan en él (barra sticky) mientras se añade */
.single_add_to_cart_button.cj-aj-loading,
.cj-sb-add.cj-aj-loading,
#cjv2StickyBtnCarrito.cj-aj-loading {
	pointer-events: none;
	opacity: .88;
	cursor: progress;
}

.single_add_to_cart_button .cj-aj-spinner,
.single_add_to_cart_button .cj-aj-check,
.cj-aj-toast .cj-aj-check {
	display: inline-block;
	width: 18px;
	height: 18px;
	flex: 0 0 auto;
	vertical-align: -4px;
}
.single_add_to_cart_button .cj-aj-spinner,
.single_add_to_cart_button .cj-aj-check {
	margin-right: 10px;
}

.cj-aj-spinner {
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: cj-aj-spin .7s linear infinite;
}

.cj-aj-check {
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Confirmación breve (1,8 s) */
.single_add_to_cart_button.cj-aj-done {
	background: #1f8f4e !important;
	border-color: #1f8f4e !important;
	color: #fff !important;
}
.cj-sb-add.cj-aj-done,
#cjv2StickyBtnCarrito.cj-aj-done {
	background: #1f8f4e !important;
	border-color: #1f8f4e !important;
	color: #fff !important;
}

/* Aviso de error (talla, campo obligatorio, sin stock…) encima de los botones */
.cj-aj-notice {
	margin: 0 0 12px;
	padding: 10px 14px;
	border: 1px solid #f1b9b9;
	border-left: 4px solid #d63638;
	background: #fff5f5;
	color: #8a1f1f;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.4;
}
.cj-aj-notice p { margin: 0; }
.cj-aj-notice p + p { margin-top: 4px; }

/* Toast cuando la página no tiene cajón del carrito */
.cj-aj-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 99999;
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: calc(100% - 32px);
	padding: 12px 18px;
	border-radius: 999px;
	background: #0d1b3e;
	color: #fff;
	font-size: 14px;
	line-height: 1.3;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
	transform: translate(-50%, 20px);
	opacity: 0;
	transition: transform .25s ease, opacity .25s ease;
}
.cj-aj-toast.is-in { transform: translate(-50%, 0); opacity: 1; }
.cj-aj-toast a { color: #fff; text-decoration: underline; font-weight: 600; white-space: nowrap; }

/* Enlace «Ver carrito» que wc-add-to-cart.js añade junto al botón al oír added_to_cart: no se muestra */
form.cart .added_to_cart.wc-forward { display: none !important; }

/* Relacionados del cajón mientras llegan */
.cj-related-products.cj-aj-related-loading .cj-related-list:empty::before {
	content: "Cargando…";
	display: block;
	grid-column: 1 / -1;
	padding: 4px 0 12px;
	color: #8a9ab8;
	font-size: 13px;
}

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

@media (prefers-reduced-motion: reduce) {
	.cj-aj-spinner { animation-duration: 1.4s; }
	.cj-aj-toast { transition: none; }
}
