/**
 * Product card “Adaugă în coș” — approved hAIo / bSmarty design
 * Scoped to .bsmarty-cart-button only (listing / card grids).
 * Does NOT target single product, cart, checkout, or My Account buttons.
 */

/* Beat WooCommerce `.woocommerce a.button { display:inline-block; padding:... }` */
a.bsmarty-cart-button.button,
button.bsmarty-cart-button,
.bsmarty-cart-button {
	--bsmarty-cart-purple: #6d28d9;
	--bsmarty-cart-indigo: #4f46e5;
	--bsmarty-cart-purple-hover: #7c3aed;
	--bsmarty-cart-purple-deep: #5b21b6;
	--bsmarty-cart-pink: #ff7eb6;
	--bsmarty-cart-white: #ffffff;
	--bsmarty-cart-added: #168653;
	/* Icon size (% of button). Shift: negative % of button height = up. */
	--bsmarty-cart-icon-size: 114%; /* was 120%, −5% */
	--bsmarty-cart-icon-shift-y: -25%; /* was −30%, down 5% */

	position: relative;
	display: grid !important;
	place-items: center;
	align-content: center;
	width: 99%;
	/* Tall enough for cart icon */
	min-height: 48px;
	height: auto !important;
	margin: 0 auto !important;
	padding: 10px 12px !important;
	overflow: hidden !important;
	box-sizing: border-box;
	border: 1.5px solid rgba(255, 126, 182, 0.92) !important;
	border-radius: calc(14px - 0.3mm);
	background: var(--bsmarty-cart-pink) !important;
	background-image: none !important;
	color: var(--bsmarty-cart-white) !important;
	font-size: clamp(0.875rem, 2.6vw, 1rem) !important;
	font-weight: 700;
	line-height: 1.25 !important;
	text-align: center;
	text-decoration: none !important;
	text-shadow: none;
	box-shadow:
		0 7px 18px rgba(79, 70, 229, 0.28),
		0 0 14px rgba(255, 126, 182, 0.55);
	cursor: pointer;
	float: none;
	transition:
		transform 180ms ease,
		background 180ms ease,
		border-color 180ms ease,
		box-shadow 180ms ease;
}

.bsmarty-cart-button::before {
	content: '';
	position: absolute;
	inset: 0.7px;
	z-index: 0;
	border-radius: calc(14px - 0.6mm);
	background: linear-gradient(135deg, var(--bsmarty-cart-purple) 0%, var(--bsmarty-cart-indigo) 100%);
	pointer-events: none;
	transition: background 180ms ease;
}

.bsmarty-cart-button__text,
.bsmarty-cart-button__icon {
	z-index: 1;
	grid-area: 1 / 1;
	justify-self: center;
	align-self: center;
	transition:
		opacity 180ms ease,
		transform 220ms ease;
	pointer-events: none;
}

.bsmarty-cart-button__text {
	position: relative;
	opacity: 1;
	transform: translateY(0) scale(1);
	max-width: none;
	overflow: visible;
	text-overflow: clip;
	white-space: nowrap;
	padding: 0 0.25rem;
	color: var(--bsmarty-cart-white);
}

.bsmarty-cart-button__icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	opacity: 0;
	/* Entrance animation only — keep icon geometrically centered */
	transform: translateY(10px) scale(0.85);
	color: var(--bsmarty-cart-white);
	pointer-events: none;
	line-height: 0;
}

.bsmarty-cart-button__icon svg {
	display: block;
	position: relative;
	flex-shrink: 0;
	width: var(--bsmarty-cart-icon-size);
	height: var(--bsmarty-cart-icon-size);
	max-width: var(--bsmarty-cart-icon-size);
	max-height: var(--bsmarty-cart-icon-size);
	margin: 0;
	padding: 0;
	stroke: currentColor;
	/* % is relative to icon wrapper (= button height) */
	top: var(--bsmarty-cart-icon-shift-y);
}

@media (hover: hover) and (pointer: fine) {
	.bsmarty-cart-button:hover:not(.is-disabled):not(.is-added) {
		transform: translateY(-2px);
		border-color: rgba(255, 126, 182, 0.9) !important;
		box-shadow:
			0 10px 24px rgba(109, 40, 217, 0.35),
			0 0 20px rgba(255, 126, 182, 0.58);
		color: var(--bsmarty-cart-white) !important;
	}

	.bsmarty-cart-button:hover:not(.is-disabled):not(.is-added)::before,
	.bsmarty-cart-button:focus-visible:not(.is-disabled):not(.is-added)::before {
		background: linear-gradient(135deg, var(--bsmarty-cart-purple-hover) 0%, var(--bsmarty-cart-purple-deep) 100%);
	}

	.bsmarty-cart-button:hover:not(.is-disabled):not(.is-added) .bsmarty-cart-button__text,
	.bsmarty-cart-button:focus-visible:not(.is-disabled):not(.is-added) .bsmarty-cart-button__text {
		opacity: 0;
		transform: translateY(-10px) scale(0.95);
	}

	.bsmarty-cart-button:hover:not(.is-disabled):not(.is-added) .bsmarty-cart-button__icon,
	.bsmarty-cart-button:focus-visible:not(.is-disabled):not(.is-added) .bsmarty-cart-button__icon {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.bsmarty-cart-button:focus-visible {
	outline: 3px solid #f97316;
	outline-offset: 3px;
}

.bsmarty-cart-button.is-added {
	border-color: rgba(255, 126, 182, 0.45) !important;
	box-shadow:
		0 7px 18px rgba(22, 134, 83, 0.28),
		0 0 14px rgba(255, 126, 182, 0.35);
	transform: none;
}

.bsmarty-cart-button.is-added::before {
	background: var(--bsmarty-cart-added);
}

.bsmarty-cart-button.is-added .bsmarty-cart-button__text {
	opacity: 1 !important;
	transform: none !important;
}

.bsmarty-cart-button.is-added .bsmarty-cart-button__icon {
	opacity: 0 !important;
	transform: translateY(10px) scale(0.85) !important;
}

.bsmarty-cart-button.loading {
	opacity: 0.75;
	pointer-events: none;
}

/* Hide WooCommerce spinner / checkmark — we handle feedback ourselves */
a.bsmarty-cart-button.button.loading::after,
a.bsmarty-cart-button.button.added::after {
	content: none !important;
	display: none !important;
}

.bsmarty-cart-button.is-disabled,
.bsmarty-cart-button:disabled {
	border-color: transparent !important;
	box-shadow: none;
	cursor: not-allowed;
	transform: none;
}

.bsmarty-cart-button.is-disabled::before,
.bsmarty-cart-button:disabled::before {
	background: #94a3b8;
}

.bsmarty-cart-button.is-disabled .bsmarty-cart-button__icon,
.bsmarty-cart-button:disabled .bsmarty-cart-button__icon {
	display: none;
}

/* Hide WooCommerce “View cart” sibling inside card carts only */
.bsmarty-archive-card__cart .added_to_cart,
.bsmarty-card-test__cart .added_to_cart,
.bsmarty-product-card__cart .added_to_cart,
.bsmarty-brand-card__cart .added_to_cart,
a.bsmarty-cart-button + .added_to_cart {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.bsmarty-archive-card__cart,
.bsmarty-card-test__cart,
.bsmarty-product-card__cart,
.bsmarty-brand-card__cart {
	position: relative;
	margin-top: auto;
	padding-top: 0.25rem;
	min-width: 0;
	width: 100%;
	overflow: visible;
}

@media (hover: none), (pointer: coarse) {
	a.bsmarty-cart-button.button,
	button.bsmarty-cart-button,
	.bsmarty-cart-button {
		display: grid !important;
		align-items: center;
		justify-content: center;
		gap: 0;
		min-height: 48px;
		font-size: 1rem !important;
		line-height: 1.25 !important;
	}

	.bsmarty-cart-button__text,
	.bsmarty-cart-button__icon {
		grid-area: 1 / 1;
		opacity: 1;
		transform: none;
	}

	.bsmarty-cart-button__icon {
		display: none !important;
	}

	.bsmarty-cart-button.is-added .bsmarty-cart-button__icon {
		display: none !important;
	}
}

/* Phone cards — larger label (a11y); icon stays vertically centered */
@media (max-width: 640px) {
	a.bsmarty-cart-button.button,
	button.bsmarty-cart-button,
	.bsmarty-cart-button {
		--bsmarty-cart-icon-size: 114%;
		--bsmarty-cart-icon-shift-y: -25%;
		min-height: 52px;
		padding: 12px 14px !important;
		font-size: 1rem !important;
		line-height: 1.3 !important;
	}

	.bsmarty-cart-button__icon {
		inset: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bsmarty-cart-button,
	.bsmarty-cart-button__text,
	.bsmarty-cart-button__icon {
		transition: none;
	}
}
