/**
 * D LUNAFAM — "added to Wishlist" toast (woocommerce/ti-addedtowishlist-
 * dialogbox.php) + the instant heart (assets/js/wishlist-add.js).
 *
 * TI Wishlist appends each confirmation into `body > .tinv-wishlist`; that
 * holder becomes a fixed stack: under the header on the right (desktop),
 * above the bottom nav (phones). Non-blocking: the page stays usable.
 */

body > .tinv-wishlist {
	position: fixed;
	top: calc(var(--mmsc-header-h, 80px) + 16px);
	right: 24px;
	z-index: 100001;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
	padding: 0;
	pointer-events: none;
	font-family: var(--mmsc-font-body);
}

body > .tinv-wishlist > * {
	pointer-events: auto;
}

.mmsc-wl-toast {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 12px;
	width: min(380px, calc(100vw - 24px));
	box-sizing: border-box;
	padding: 10px 8px 10px 10px;
	border: 1px solid var(--mmsc-color-border);
	border-radius: 14px;
	background: var(--mmsc-color-surface);
	box-shadow: 0 16px 40px rgba(43, 37, 33, 0.16);
	color: var(--mmsc-color-text);
	font-family: var(--mmsc-font-body);
	text-align: left;
	animation: mmsc-wl-toast-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes mmsc-wl-toast-in {
	from { opacity: 0; transform: translateY(-8px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

.mmsc-wl-toast__img {
	display: block;
	width: 44px;
	height: 58px;
	overflow: hidden;
	border-radius: 8px;
	background: var(--mmsc-color-bg);
}

.mmsc-wl-toast__img img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
	object-position: center top;
}

.mmsc-wl-toast__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #f6ecee;
	fill: var(--mmsc-color-primary);
}

.mmsc-wl-toast__body {
	min-width: 0;
	text-align: left;
	color: var(--mmsc-color-text);
}

.mmsc-wl-toast p.mmsc-wl-toast__title {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--mmsc-color-text);
}

.mmsc-wl-toast__heart {
	flex: none;
	fill: var(--mmsc-color-primary);
}

.mmsc-wl-toast.is-already .mmsc-wl-toast__heart {
	fill: none;
	stroke: var(--mmsc-color-primary);
	stroke-width: 2;
}

/* Removed (second tap on a saved heart): an empty, muted heart. */
.mmsc-wl-toast.is-removed .mmsc-wl-toast__heart {
	fill: none;
	stroke: var(--mmsc-color-text-muted);
	stroke-width: 2;
}

.mmsc-wl-toast.is-removed .mmsc-wl-toast__img {
	opacity: 0.6;
}

.mmsc-wl-toast p.mmsc-wl-toast__text {
	overflow: hidden;
	margin: 3px 0 0;
	font-size: 13px;
	line-height: 1.35;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--mmsc-color-text-muted);
}

body .tinv-wishlist .mmsc-wl-toast a.mmsc-wl-toast__view { /* beats TI's `.tinv-wishlist a:not(.button):not(.social)` blue underline */
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	padding: 0 14px;
	border: 1px solid var(--mmsc-color-dark);
	border-radius: var(--mmsc-radius-pill);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1;
	text-decoration: none;
	text-transform: uppercase;
	color: var(--mmsc-color-dark);
	background: transparent;
	transition: background-color var(--mmsc-transition-fast), color var(--mmsc-transition-fast);
}

body .tinv-wishlist .mmsc-wl-toast a.mmsc-wl-toast__view:hover,
body .tinv-wishlist .mmsc-wl-toast a.mmsc-wl-toast__view:focus-visible {
	background: var(--mmsc-color-dark);
	color: var(--mmsc-color-surface);
}

.mmsc-wl-toast button.mmsc-wl-toast__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0 !important;
	border-radius: 50%;
	background: transparent !important;
	box-shadow: none;
	color: var(--mmsc-color-text-muted) !important;
	cursor: pointer;
}

.mmsc-wl-toast button.mmsc-wl-toast__close:hover,
.mmsc-wl-toast button.mmsc-wl-toast__close:focus-visible {
	background: var(--mmsc-color-bg) !important;
	color: var(--mmsc-color-text) !important;
}

/* Phones: above the bottom nav (and any page dock), full width. */
@media (max-width: 767px) {
	body > .tinv-wishlist {
		top: auto;
		right: 12px;
		bottom: calc(var(--mmsc-float-offset, 0px) + 12px);
		left: 12px;
		align-items: stretch;
		flex-direction: column-reverse;
	}

	.mmsc-wl-toast {
		gap: 10px;
		width: 100%;
		animation-name: mmsc-wl-toast-up;
	}

	.mmsc-wl-toast p.mmsc-wl-toast__title {
		font-size: 13.5px;
	}

	body .tinv-wishlist .mmsc-wl-toast a.mmsc-wl-toast__view {
		padding: 0 12px;
	}
}

@keyframes mmsc-wl-toast-up {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: none; }
}

/* The heart the moment it's tapped (wishlist-add.js). */
.tinvwl_add_to_wishlist_button.mmsc-wl-pop::before {
	animation: mmsc-wl-pop 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes mmsc-wl-pop {
	0% { transform: scale(1); }
	40% { transform: scale(1.28); }
	100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.mmsc-wl-toast,
	.tinvwl_add_to_wishlist_button.mmsc-wl-pop::before {
		animation: none;
	}
}
