/**
 * File: /assets/css/frontend/cart/cart-button.css
 * Purpose: Defines reusable frontend Add to Cart button styles.
 *
 * @package SunTechPortal
 */

.suntech-portal .stp-add-to-cart,
.stp-add-to-cart {
	--stp-cart-button-bg: #f97316;
	--stp-cart-button-bg-hover: #ea580c;
	--stp-cart-button-text: #ffffff;
	--stp-cart-button-border: transparent;
	--stp-cart-button-size: 42px;

	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	width: auto;
	min-width: var(--stp-cart-button-size);
	min-height: var(--stp-cart-button-size);
	padding: 10px 16px;
	border: 1px solid var(--stp-cart-button-border);
	border-radius: 999px;
	background: var(--stp-cart-button-bg);
	color: var(--stp-cart-button-text);
	font-size: 13px;
	font-weight: 800;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color 0.18s ease,
		border-color 0.18s ease,
		color 0.18s ease,
		transform 0.18s ease,
		opacity 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}


.suntech-portal .stp-add-to-cart:hover,
.suntech-portal .stp-add-to-cart:focus,
.stp-add-to-cart:hover,
.stp-add-to-cart:focus {
	background: var(--stp-cart-button-bg-hover);
	color: var(--stp-cart-button-text);
	text-decoration: none;
	outline: none;
}

.suntech-portal .stp-add-to-cart:focus-visible,
.stp-add-to-cart:focus-visible {
	outline: 2px solid #111827;
	outline-offset: 2px;
}

.suntech-portal .stp-add-to-cart:active,
.stp-add-to-cart:active {
	transform: translateY(1px);
}

.suntech-portal .stp-add-to-cart__icon,
.stp-add-to-cart__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 17px;
	height: 17px;
	flex: 0 0 17px;
	color: #ffffff;
	line-height: 1;
}

.suntech-portal .stp-add-to-cart__icon svg,
.stp-add-to-cart__icon svg {
	display: block;
	width: 17px;
	height: 17px;
	fill: currentColor;
}

.suntech-portal .stp-add-to-cart__text,
.stp-add-to-cart__text {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	color: currentColor;
	white-space: nowrap;
}

.suntech-portal .stp-add-to-cart--icon,
.stp-add-to-cart--icon {
	gap: 7px;
}

.suntech-portal .stp-add-to-cart--card,
.stp-add-to-cart--card {
	--stp-cart-button-size: 38px;

	width: 38px;
	min-width: 38px;
	max-width: 38px;
	height: 38px;
	min-height: 38px;
	margin-left: auto;
	padding: 0;
	gap: 0;
	border-radius: 999px;
	flex: 0 0 38px;
}

.suntech-portal .stp-add-to-cart--card .stp-add-to-cart__text,
.stp-add-to-cart--card .stp-add-to-cart__text {
	display: none;
}

.suntech-portal .stp-add-to-cart--single,
.stp-add-to-cart--single {
	--stp-cart-button-size: 48px;

	min-height: 48px;
	padding: 13px 24px;
	font-size: 15px;
	border-radius: 999px;
}

.suntech-portal .stp-add-to-cart.is-loading,
.suntech-portal .stp-add-to-cart[aria-busy="true"],
.stp-add-to-cart.is-loading,
.stp-add-to-cart[aria-busy="true"] {
	pointer-events: none;
	cursor: progress;
	opacity: 0.86;
}

.suntech-portal .stp-add-to-cart.is-loading .stp-add-to-cart__icon,
.suntech-portal .stp-add-to-cart[aria-busy="true"] .stp-add-to-cart__icon,
.stp-add-to-cart.is-loading .stp-add-to-cart__icon,
.stp-add-to-cart[aria-busy="true"] .stp-add-to-cart__icon {
	display: none;
}

.suntech-portal .stp-add-to-cart.is-loading::after,
.suntech-portal .stp-add-to-cart[aria-busy="true"]::after,
.stp-add-to-cart.is-loading::after,
.stp-add-to-cart[aria-busy="true"]::after {
	content: "";
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: stp-cart-button-spin 0.7s linear infinite;
}

.suntech-portal .stp-add-to-cart.is-added,
.stp-add-to-cart.is-added {
	--stp-cart-button-bg: #16a34a;
	--stp-cart-button-bg-hover: #15803d;
}

.suntech-portal .stp-add-to-cart.is-added .stp-add-to-cart__icon--cart,
.stp-add-to-cart.is-added .stp-add-to-cart__icon--cart {
	display: none;
}

.suntech-portal .stp-add-to-cart.is-added .stp-add-to-cart__icon--check,
.stp-add-to-cart.is-added .stp-add-to-cart__icon--check {
	display: inline-flex;
}

.suntech-portal .stp-add-to-cart:not(.is-added) .stp-add-to-cart__icon--check,
.stp-add-to-cart:not(.is-added) .stp-add-to-cart__icon--check {
	display: none;
}

.suntech-portal .stp-add-to-cart:not(.is-added) .stp-add-to-cart__icon--cart,
.stp-add-to-cart:not(.is-added) .stp-add-to-cart__icon--cart {
	display: inline-flex;
}

.suntech-portal .stp-add-to-cart.is-disabled,
.suntech-portal .stp-add-to-cart:disabled,
.suntech-portal .stp-add-to-cart[aria-disabled="true"],
.stp-add-to-cart.is-disabled,
.stp-add-to-cart:disabled,
.stp-add-to-cart[aria-disabled="true"] {
	pointer-events: none;
	cursor: not-allowed;
	opacity: 0.74;
}

.suntech-portal .stp-add-to-cart--out-of-stock,
.suntech-portal .stp-add-to-cart.is-out-of-stock,
.stp-add-to-cart--out-of-stock,
.stp-add-to-cart.is-out-of-stock {
	--stp-cart-button-bg: #dc2626;
	--stp-cart-button-bg-hover: #b91c1c;
	--stp-cart-button-text: #ffffff;

	pointer-events: none;
	cursor: not-allowed;
	opacity: 1;
}

.suntech-portal .stp-add-to-cart--out-of-stock .stp-add-to-cart__icon,
.suntech-portal .stp-add-to-cart.is-out-of-stock .stp-add-to-cart__icon,
.stp-add-to-cart--out-of-stock .stp-add-to-cart__icon,
.stp-add-to-cart.is-out-of-stock .stp-add-to-cart__icon {
	display: none;
}

.suntech-portal .stp-cart-quantity,
.stp-cart-quantity {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.suntech-portal .stp-cart-quantity__input,
.stp-cart-quantity__input {
	width: 72px;
	min-height: 42px;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 999px;
	background: #ffffff;
	color: #111827;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
}

.suntech-portal .stp-cart-quantity__input:focus,
.stp-cart-quantity__input:focus {
	border-color: #f97316;
	outline: none;
	box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.16);
}

@keyframes stp-cart-button-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.suntech-portal .stp-add-to-cart,
	.stp-add-to-cart {
		transition: none;
	}

	.suntech-portal .stp-add-to-cart.is-loading::after,
	.suntech-portal .stp-add-to-cart[aria-busy="true"]::after,
	.stp-add-to-cart.is-loading::after,
	.stp-add-to-cart[aria-busy="true"]::after {
		animation: none;
	}
}

@media (max-width: 767px) {
	.suntech-portal .stp-add-to-cart,
	.stp-add-to-cart {
		font-size: 14px;
	}

	.suntech-portal .stp-add-to-cart--card,
	.stp-add-to-cart--card {
		width: 38px;
		min-width: 38px;
		max-width: 38px;
		height: 38px;
		min-height: 38px;
		margin-left: auto;
		padding: 0;
	}

	.suntech-portal .stp-add-to-cart--single,
	.stp-add-to-cart--single {
		width: 100%;
		min-height: 46px;
		padding: 12px 18px;
	}

	.suntech-portal .stp-cart-quantity,
	.stp-cart-quantity {
		width: 100%;
	}

	.suntech-portal .stp-cart-quantity__input,
	.stp-cart-quantity__input {
		width: 78px;
		min-height: 44px;
	}
}