/* Team Moon Options — "added to cart" feedback on the product page. */

/* Button: spinner while adding */
form.cart .single_add_to_cart_button.tm-added-busy,
form.cart .single_add_to_cart_button.tm-added-done {
	position: relative !important;
	overflow: hidden;
}

form.cart .single_add_to_cart_button.tm-added-busy {
	color: transparent !important;
}

form.cart .single_add_to_cart_button.tm-added-busy::after {
	display: none !important; /* theme spinner */
}

.tm-added__spin {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 22px;
	height: 22px;
	margin: -11px 0 0 -11px;
	border: 2.5px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: tmAddedSpin 0.7s linear infinite;
}

/* Button: "✓ Added to cart" slides in over the label */
.tm-added__label {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font: inherit;
	font-weight: 700;
	background: inherit;
	border-radius: inherit;
	animation: tmAddedIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

form.cart .single_add_to_cart_button.tm-added-done {
	color: transparent !important;
	animation: tmAddedPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tm-added__check {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	padding: 3px;
	border-radius: 50%;
	background: #22c55e;
	color: #fff;
	box-sizing: border-box;
}

.tm-added__check path {
	stroke-dasharray: 24;
	stroke-dashoffset: 24;
	animation: tmAddedDraw 0.4s 0.12s ease-out forwards;
}

form.cart .single_add_to_cart_button.tm-added-out .tm-added__label {
	animation: tmAddedOut 0.25s ease-in forwards;
}

/* Grid "+" buttons (strong selectors: card styles force the + with !important) */
.wd-product .wd-add-btn > a.button.tm-added-loop,
a.add_to_cart_button.tm-added-loop {
	position: relative;
	overflow: visible !important;
}

.wd-product .wd-add-btn > a.button.tm-added-busy::before,
a.add_to_cart_button.tm-added-busy::before {
	opacity: 0 !important;
}

.wd-product .wd-add-btn > a.button.tm-added-busy::after,
a.add_to_cart_button.tm-added-busy::after {
	display: none !important;
}

.wd-product .wd-add-btn > a.button > i.tm-added__spin,
a.add_to_cart_button > i.tm-added__spin {
	display: block !important;
	position: absolute !important;
	top: 50% !important;
	left: 50% !important;
	width: 16px !important;
	height: 16px !important;
	margin: -8px 0 0 -8px !important;
	border: 2px solid currentColor !important;
	border-top-color: transparent !important;
	border-radius: 50% !important;
	opacity: 0.9;
	animation: tmAddedSpin 0.7s linear infinite !important;
}

.wd-product .wd-add-btn > a.button.tm-added-pop,
a.add_to_cart_button.tm-added-pop {
	animation: tmAddedLoopPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wd-product .wd-add-btn > a.button.tm-added-pop::after,
a.add_to_cart_button.tm-added-pop::after {
	content: "" !important;
	display: block !important;
	position: absolute !important;
	inset: -2px !important;
	width: auto !important;
	height: auto !important;
	margin: 0 !important;
	border: 2px solid #22c55e !important;
	border-radius: inherit !important;
	background: none !important;
	opacity: 0;
	transform: none;
	animation: tmAddedRing 0.8s ease-out !important;
	pointer-events: none;
}

@keyframes tmAddedLoopPop {
	0% { transform: scale(1); }
	30% { transform: scale(0.82); }
	65% { transform: scale(1.15); }
	100% { transform: scale(1); }
}

@keyframes tmAddedRing {
	0% { opacity: 0.9; transform: scale(1); }
	100% { opacity: 0; transform: scale(1.7); }
}

/* Flying picture */
.tm-added-fly {
	position: fixed;
	z-index: 999999;
	pointer-events: none;
	background-size: cover;
	background-position: center;
	background-color: #fff;
	border-radius: 18px;
	box-shadow: 0 12px 30px rgba(16, 24, 40, 0.25);
	will-change: transform, opacity;
}

/* Header cart bounce */
.tm-added-bump {
	animation: tmAddedBump 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tm-added-bump .wd-cart-number,
.tm-added-bump .tm-cart__count {
	animation: tmAddedCount 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Notice */
.tm-added-toast {
	position: fixed;
	z-index: 999998;
	left: 50%;
	bottom: 18px;
	display: flex;
	align-items: center;
	gap: 12px;
	width: min(460px, calc(100% - 24px));
	padding: 10px 10px 10px 14px;
	border-radius: 18px;
	background: #fff;
	color: #0f1630;
	font-family: inherit;
	box-shadow: 0 14px 40px rgba(16, 24, 40, 0.18), 0 0 0 1px rgba(16, 24, 40, 0.06);
	opacity: 0;
	transform: translate(-50%, 24px) scale(0.96);
	transition: opacity 0.25s ease, transform 0.4s cubic-bezier(0.34, 1.36, 0.64, 1);
}

.tm-added-toast.is-in {
	opacity: 1;
	transform: translate(-50%, 0) scale(1);
}

.tm-added-toast__img {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 46px;
	height: 46px;
	border-radius: 12px;
	background-color: #f3f4f6;
	background-size: cover;
	background-position: center;
}

.tm-added-toast__text {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 14px;
	line-height: 1.4;
}

.tm-added-toast__text strong {
	font-weight: 700;
}

a.tm-added-toast__btn {
	flex: 0 0 auto;
	padding: 9px 16px;
	border-radius: 999px;
	background: #0f1630;
	color: #fff !important;
	font-size: 13.5px;
	font-weight: 700;
	text-decoration: none !important;
	white-space: nowrap;
}

button.tm-added-toast__close {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 30px !important;
	height: 30px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: #f3f4f6 !important;
	color: #0f1630 !important;
	box-shadow: none !important;
	cursor: pointer;
}

@media (max-width: 600px) {
	.tm-added-toast {
		bottom: calc(12px + env(safe-area-inset-bottom));
	}

	.tm-added-toast__text {
		font-size: 13px;
	}
}

@keyframes tmAddedSpin {
	to { transform: rotate(360deg); }
}

@keyframes tmAddedIn {
	from { opacity: 0; transform: translateY(60%); }
	to { opacity: 1; transform: none; }
}

@keyframes tmAddedOut {
	to { opacity: 0; transform: translateY(-60%); }
}

@keyframes tmAddedDraw {
	to { stroke-dashoffset: 0; }
}

@keyframes tmAddedPop {
	0% { transform: scale(1); }
	40% { transform: scale(0.96); }
	100% { transform: scale(1); }
}

@keyframes tmAddedBump {
	0% { transform: scale(1); }
	35% { transform: scale(1.25) rotate(-8deg); }
	65% { transform: scale(0.95) rotate(4deg); }
	100% { transform: scale(1); }
}

@keyframes tmAddedCount {
	0% { transform: scale(1); }
	40% { transform: scale(1.6); }
	100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.tm-added__spin { animation-duration: 1.4s; }
	.tm-added__label,
	.tm-added__check path,
	form.cart .single_add_to_cart_button.tm-added-done,
	.tm-added-bump,
	.tm-added-bump .wd-cart-number,
	.tm-added-bump .tm-cart__count,
	a.add_to_cart_button.tm-added-pop,
	a.add_to_cart_button.tm-added-pop::after,
	.wd-product .wd-add-btn > a.button.tm-added-pop,
	.wd-product .wd-add-btn > a.button.tm-added-pop::after {
		animation: none !important;
	}
	.tm-added__check path { stroke-dashoffset: 0; }
	.tm-added-toast { transition: opacity 0.2s ease; transform: translate(-50%, 0); }
}
