/*
 * Floating WooCommerce success messages — see podim-wc-floating-messages.php.
 *
 * The JS moves every .woocommerce-message (success, a <div> per notice) and
 * .woocommerce-error (a single <ul> holding one <li> per notice) into
 * #podim-wc-toasts, so the rules below are scoped to that container: a notice
 * the shim has not adopted (JS off, or one inside a form Bricks re-renders)
 * keeps its normal inline appearance.
 */

#podim-wc-toasts {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: min(360px, calc(100vw - 32px));
	pointer-events: none; /* the gaps stay click-through; the toasts re-enable it */
}

#podim-wc-toasts:empty {
	display: none;
}

#podim-wc-toasts .woocommerce-message,
#podim-wc-toasts .woocommerce-error {
	pointer-events: auto;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 10px;
	/* !important only where podim-checkout/assets/css/frontend.css already
	   uses it on cart/checkout/order-received — the reserved right-hand
	   padding is what keeps the close button off the text. No borders: the
	   card is defined by its shadow alone (Jernej, 2026-08-22). */
	margin: 0;
	padding: 14px 42px 14px 16px !important;
	border: 0 !important;
	border-radius: 8px !important;
	background: #fff;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16) !important;
	color: #1c1c1c;
	font-size: 15px !important;
	line-height: 1.45;
	list-style: none;
	animation: podim-wc-toast-in 0.22s ease-out both;
}

/* WooCommerce's own ::before tick sits in the padding of the block version. */
#podim-wc-toasts .woocommerce-message::before,
#podim-wc-toasts .woocommerce-error::before,
#podim-wc-toasts .woocommerce-error li::before {
	content: none;
}

/* .woocommerce-error is a <ul>: strip the list chrome so it reads as a
   paragraph, and space multiple errors inside the one toast. */
#podim-wc-toasts .woocommerce-error li {
	margin: 0;
	padding: 0;
	list-style: none;
}

#podim-wc-toasts .woocommerce-error li + li {
	margin-top: 8px;
}

/* The close button on an error toast is wrapped in an <li> to keep the <ul>
   valid; it is absolutely positioned, so the <li> must take no flow space. */
#podim-wc-toasts .podim-wc-toast__close-item {
	margin: 0;
	padding: 0;
	height: 0;
	list-style: none;
}

/* WooCommerce prints the "View cart" link *before* the message text; anonymous
   flex items default to order:0, so pushing the button to order:1 puts it under
   the sentence it belongs to. */
#podim-wc-toasts .woocommerce-message a:not(.podim-wc-toast__close),
#podim-wc-toasts .woocommerce-error a:not(.podim-wc-toast__close) {
	order: 1;
	align-self: flex-start;
	padding: 0.6em 1.5em;
	border-radius: 99px;
	background: var(--primary, #1f8a5c);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

#podim-wc-toasts .woocommerce-message a:not(.podim-wc-toast__close):hover,
#podim-wc-toasts .woocommerce-message a:not(.podim-wc-toast__close):focus-visible,
#podim-wc-toasts .woocommerce-error a:not(.podim-wc-toast__close):hover,
#podim-wc-toasts .woocommerce-error a:not(.podim-wc-toast__close):focus-visible {
	filter: brightness(0.92);
	color: #fff;
}

.podim-wc-toast__close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #6b6b6b;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.podim-wc-toast__close:hover,
.podim-wc-toast__close:focus-visible {
	background: rgba(0, 0, 0, 0.07);
	color: #1c1c1c;
}

#podim-wc-toasts .woocommerce-message.is-leaving,
#podim-wc-toasts .woocommerce-error.is-leaving {
	animation: podim-wc-toast-out 0.18s ease-in both;
}

@keyframes podim-wc-toast-in {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}

@keyframes podim-wc-toast-out {
	from { opacity: 1; transform: none; }
	to   { opacity: 0; transform: translateX(16px); }
}

@media (prefers-reduced-motion: reduce) {
	#podim-wc-toasts .woocommerce-message,
	#podim-wc-toasts .woocommerce-error,
	#podim-wc-toasts .woocommerce-message.is-leaving,
	#podim-wc-toasts .woocommerce-error.is-leaving {
		animation: none;
	}
}

@media (max-width: 480px) {
	#podim-wc-toasts {
		right: 12px;
		left: 12px;
		bottom: 12px;
		width: auto;
	}
}
