/*  GRZ Gaming — store-toast canonical notification stylesheet.
 *  Single source of truth for EVERY WooCommerce notice:
 *  floating toasts (.grz-store-toast) and in-flow cards (.grz-store-notice).
 *  commerce-v140.js tags each notice with grz-store-notice + variant class,
 *  prepends the icon badge and appends the dismiss button. */

/* ===================================================================
 * 1. Floating toast stack
 * ================================================================ */
.grz-toast-stack {
	position: fixed;
	top: max(var(--grz-toast-top, 68px), env(safe-area-inset-top));
	left: 50%;
	z-index: 100000;
	display: grid;
	gap: 9px;
	width: min(380px, calc(100vw - 28px));
	pointer-events: none;
	transform: translateX(-50%);
}
body.admin-bar .grz-toast-stack {
	top: max(var(--grz-toast-top, 100px), calc(env(safe-area-inset-top) + 68px));
}

/* ===================================================================
 * 2. Variant tokens — one flat tint per notice type
 * ================================================================ */
.grz-store-notice {
	--grz-nt-bg: #eff6ff;
	--grz-nt-line: #bfdbfe;
	--grz-nt-ink: #1d4ed8;
	--grz-nt-icon: #2563eb;
	--grz-nt-btn: rgba(37, 99, 235, 0.1);
}
.grz-store-notice--success {
	--grz-nt-bg: #effaf2;
	--grz-nt-line: #cce9d4;
	--grz-nt-ink: #176f34;
	--grz-nt-icon: #1c9a4b;
	--grz-nt-btn: rgba(25, 148, 71, 0.1);
}
.grz-store-notice--info {
	--grz-nt-bg: #eff6ff;
	--grz-nt-line: #bfdbfe;
	--grz-nt-ink: #1d4ed8;
	--grz-nt-icon: #2563eb;
	--grz-nt-btn: rgba(37, 99, 235, 0.1);
}
.grz-store-notice--error {
	--grz-nt-bg: #fef2f2;
	--grz-nt-line: #fecaca;
	--grz-nt-ink: #b42318;
	--grz-nt-icon: #dc2626;
	--grz-nt-btn: rgba(220, 38, 38, 0.1);
}

/* ===================================================================
 * 3. Base notification card (in-flow)
 * ================================================================ */
.grz-store-notice {
	position: relative !important;
	box-sizing: border-box !important;
	display: flex !important;
	align-items: center !important;
	gap: 11px !important;
	width: 100% !important;
	max-width: 100% !important;
	min-height: 52px !important;
	margin: 0 0 14px !important;
	padding: 11px 44px 11px 14px !important;
	border: 1px solid var(--grz-nt-line) !important;
	border-inline-start: 1px solid var(--grz-nt-line) !important;
	border-radius: 8px !important;
	background: var(--grz-nt-bg) !important;
	box-shadow: none !important;
	color: var(--grz-nt-ink) !important;
	font-size: 0.78rem !important;
	font-weight: 650;
	line-height: 1.45 !important;
	list-style: none !important;
	transition: opacity 170ms ease, transform 170ms ease, height 170ms ease, margin 170ms ease, padding 170ms ease;
}
/* Kill every WooCommerce/theme pseudo icon — the JS badge replaces them. */
.grz-store-notice::before,
.grz-store-notice::after {
	display: none !important;
	content: none !important;
}

/* WooCommerce renders errors as <ul class="woocommerce-error"><li>… — stack the items. */
ul.grz-store-notice {
	display: grid !important;
	grid-template-columns: 22px minmax(0, 1fr);
	column-gap: 11px;
	row-gap: 4px;
}
ul.grz-store-notice > .grz-store-notice__icon {
	grid-column: 1;
	grid-row: 1;
	align-self: start;
	margin-top: 1px;
}
ul.grz-store-notice li {
	grid-column: 2;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	list-style: none;
}
ul.grz-store-notice li::before {
	display: none;
	content: none;
}

/* ===================================================================
 * 4. Icon badge
 * ================================================================ */
.grz-store-notice__icon {
	flex: 0 0 22px;
	display: inline-grid;
	width: 22px;
	height: 22px;
	place-items: center;
	border-radius: 50%;
	background: var(--grz-nt-icon);
	color: #fff;
}
.grz-store-notice__icon svg {
	display: block;
	width: 13px;
	height: 13px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ===================================================================
 * 5. Action button (View cart, Undo, …)
 * ================================================================ */
.grz-store-notice :where(.button, .wc-forward, .restore-item) {
	order: 2;
	min-height: 30px !important;
	margin: 0 !important;
	margin-inline-start: auto !important;
	padding: 0 10px !important;
	border: 0 !important;
	border-radius: 6px !important;
	background: var(--grz-nt-btn) !important;
	box-shadow: none !important;
	color: var(--grz-nt-ink) !important;
	font-size: 0.66rem !important;
	font-weight: 800 !important;
	line-height: 1 !important;
	white-space: nowrap;
	float: none;
	transition: background 140ms ease, color 140ms ease;
}
.grz-store-notice :where(.button, .wc-forward, .restore-item):is(:hover, :focus-visible) {
	background: var(--grz-nt-icon) !important;
	color: #fff !important;
}

/* ===================================================================
 * 6. Dismiss button
 * ================================================================ */
.grz-store-notice__dismiss {
	position: absolute;
	inset-inline-end: 8px;
	top: 50%;
	display: inline-grid;
	width: 28px;
	height: 28px;
	min-height: 28px;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	box-shadow: none;
	color: var(--grz-nt-ink, #1d4ed8);
	cursor: pointer;
	opacity: 0.55;
	transform: translateY(-50%);
	transition: opacity 140ms ease, background 140ms ease;
}
.grz-store-notice__dismiss:is(:hover, :focus-visible) {
	background: var(--grz-nt-btn);
	opacity: 1;
}
.grz-store-notice__dismiss span,
.grz-store-notice__dismiss svg {
	display: block;
	width: 14px;
	height: 14px;
}
.grz-store-notice__dismiss svg {
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2.2;
}

/* ===================================================================
 * 7. Floating toast — elevated card with a countdown rail
 * ===================================================================
 * The in-flow card above is deliberately flat because it sits inside the
 * page. A floating toast has to read as a layer above the page, so it gets
 * a solid surface, a real shadow, a hairline ring and a progress rail that
 * shows how long it will stay. grzNotify() pauses that rail on hover and
 * focus, so the bar doubles as feedback that the toast is being held open.
 * ================================================================ */
/* The floating card is a soft tinted pill rather than a white sheet with a
 * coloured stripe: the tint alone carries the variant, so the whole thing reads
 * as one calm object instead of a bordered alert. Our own additions on top of
 * that idea are the hairline ring in the variant colour, a dismiss control that
 * stays out of the way until you reach for it, and the countdown rail. */
.grz-store-toast {
	position: relative !important;
	overflow: hidden !important;
	align-items: center !important;
	width: fit-content !important;
	min-width: min(268px, 100%) !important;
	max-width: 100% !important;
	margin-inline: auto !important;
	padding: 13px 40px 13px 15px !important;
	border: 0 !important;
	border-radius: 14px !important;
	background: var(--grz-nt-bg) !important;
	box-shadow:
		inset 0 0 0 1px var(--grz-nt-ring, rgba(15, 23, 42, 0.05)),
		0 8px 16px -6px rgba(15, 23, 42, 0.12),
		0 20px 40px -16px rgba(15, 23, 42, 0.16) !important;
	color: var(--grz-nt-ink) !important;
	pointer-events: auto;
	animation: grz-toast-enter 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Softer, roomier surface tints than the in-flow card uses — an overlay needs
 * less contrast against the page than a notice embedded in it. */
.grz-store-toast.grz-store-notice--success {
	--grz-nt-bg: #e9f8ef;
	--grz-nt-ring: rgba(25, 148, 71, 0.16);
	--grz-nt-ink: #14663a;
}
.grz-store-toast.grz-store-notice--info {
	--grz-nt-bg: #edf5ff;
	--grz-nt-ring: rgba(37, 99, 235, 0.16);
	--grz-nt-ink: #1c4ba3;
}
.grz-store-toast.grz-store-notice--warning {
	--grz-nt-bg: #fff6e8;
	--grz-nt-ring: rgba(217, 119, 6, 0.18);
	--grz-nt-ink: #92400e;
	--grz-nt-icon: #d97706;
}
.grz-store-toast.grz-store-notice--error {
	--grz-nt-bg: #fdeceb;
	--grz-nt-ring: rgba(220, 38, 38, 0.16);
	--grz-nt-ink: #a3231b;
}

/* Filled circular badge, a little larger on the floating card so it carries the
 * variant on its own now that the surface is only lightly tinted. */
.grz-store-toast .grz-store-notice__icon {
	flex: 0 0 24px;
	width: 24px;
	height: 24px;
	margin-top: 0;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}
.grz-store-toast .grz-store-notice__icon svg {
	width: 14px;
	height: 14px;
	stroke-width: 2.6;
}

/* Title + message stack. grzNotify() emits these; WooCommerce notices have
 * no title and simply flow as the single text node. */
.grz-store-notice__body {
	display: flex;
	min-width: 0;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
}
.grz-store-notice__title {
	color: #0f172a;
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	line-height: 1.3;
}
.grz-store-notice__text {
	color: #475569;
	font-size: 0.765rem;
	font-weight: 550;
	line-height: 1.45;
	overflow-wrap: anywhere;
}
/* Without a title the message is the primary line, so give it the weight. */
.grz-store-notice__body:not(:has(.grz-store-notice__title)) .grz-store-notice__text {
	color: #0f172a;
	font-weight: 650;
}

/* On the tinted card the copy inherits the variant ink instead of slate, so a
 * single-line message reads as one coloured unit with its badge. */
.grz-store-toast .grz-store-notice__title,
.grz-store-toast .grz-store-notice__body:not(:has(.grz-store-notice__title)) .grz-store-notice__text {
	color: var(--grz-nt-ink);
	font-weight: 700;
}
.grz-store-toast .grz-store-notice__text {
	color: color-mix(in srgb, var(--grz-nt-ink) 78%, transparent);
}
@supports not (color: color-mix(in srgb, red 50%, transparent)) {
	.grz-store-toast .grz-store-notice__text { color: var(--grz-nt-ink); opacity: 0.82; }
}

.grz-store-notice__action {
	order: 2;
	flex: 0 0 auto;
	align-self: center;
	margin-inline-start: auto;
	padding: 6px 11px;
	border: 0;
	border-radius: 7px;
	background: var(--grz-nt-btn);
	color: var(--grz-nt-ink);
	cursor: pointer;
	font-size: 0.68rem;
	font-weight: 800;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background 140ms ease, color 140ms ease;
}
.grz-store-notice__action:is(:hover, :focus-visible) {
	background: var(--grz-nt-icon);
	color: #fff;
}

/* On the floating card the dismiss is laid out by flex, not absolutely
 * positioned.
 *
 * The in-flow card reserves 44px of trailing padding for an absolute dismiss,
 * which is fine there because nothing else competes for it. On a toast the
 * WooCommerce action ("View cart") is pushed to the same edge by
 * `margin-inline-start: auto` and lands exactly on that padding boundary — the
 * two ended up 4px apart with the × overlapping the 14px rounded corner. As a
 * flex item it simply queues after the action and the gap is guaranteed. */
.grz-store-toast {
	gap: 10px !important;
}
.grz-store-toast .grz-store-notice__dismiss {
	position: static;
	order: 3;
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	min-height: 26px;
	margin: 0;
	transform: none;
	color: var(--grz-nt-ink);
	opacity: 0.32;
}
/* Trailing padding no longer has to reserve space for an absolute control. */
.grz-store-toast {
	padding-inline-end: 12px !important;
}
/* Keep the action from hugging the dismiss. */
.grz-store-toast :where(.button, .wc-forward, .restore-item),
.grz-store-toast .grz-store-notice__action {
	margin-inline-end: 0 !important;
}
.grz-store-toast:is(:hover, :focus-within) .grz-store-notice__dismiss {
	opacity: 0.7;
}
.grz-store-toast .grz-store-notice__dismiss:is(:hover, :focus-visible) {
	background: color-mix(in srgb, var(--grz-nt-ink) 10%, transparent);
	opacity: 1;
}
@media (pointer: coarse) {
	.grz-store-toast .grz-store-notice__dismiss { opacity: 0.6; }
}

/* Countdown rail. Scaled from the inline style grzNotify() sets, so it
 * animates in one compositor-friendly transform. */
.grz-store-notice__progress {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	display: block;
	height: 2px;
	background: transparent;
}
.grz-store-notice__progress-fill {
	display: block;
	width: 100%;
	height: 100%;
	background: var(--grz-nt-icon);
	opacity: 0.32;
	transform-origin: left center;
}
[dir="rtl"] .grz-store-notice__progress-fill {
	transform-origin: right center;
}

@keyframes grz-toast-enter {
	from { opacity: 0; transform: translate3d(0, -14px, 0) scale(0.97); }
	to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* Dark mode: the toast floats over whatever the page is, so it needs its own
 * surface rather than inheriting the light card tints from section 2. */
/* Dark mode keeps the same shape: a low-luminance variant tint rather than a
 * neutral panel, so the card still reads as one coloured object. */
@media (prefers-color-scheme: dark) {
	.grz-store-toast.grz-store-notice--success {
		--grz-nt-bg: #10281a; --grz-nt-ring: rgba(52, 211, 153, 0.22); --grz-nt-ink: #a7f3cd;
	}
	.grz-store-toast.grz-store-notice--info {
		--grz-nt-bg: #101f38; --grz-nt-ring: rgba(96, 165, 250, 0.22); --grz-nt-ink: #bfdbfe;
	}
	.grz-store-toast.grz-store-notice--warning {
		--grz-nt-bg: #2a1f0c; --grz-nt-ring: rgba(251, 191, 36, 0.22); --grz-nt-ink: #fde3a7;
	}
	.grz-store-toast.grz-store-notice--error {
		--grz-nt-bg: #2c1414; --grz-nt-ring: rgba(248, 113, 113, 0.22); --grz-nt-ink: #fecaca;
	}
	.grz-store-toast {
		box-shadow:
			inset 0 0 0 1px var(--grz-nt-ring),
			0 10px 15px -3px rgba(0, 0, 0, 0.44),
			0 24px 48px -12px rgba(0, 0, 0, 0.58) !important;
	}
	.grz-store-toast .grz-store-notice__action {
		background: rgba(255, 255, 255, 0.10);
		color: var(--grz-nt-ink);
	}
}

/* ===================================================================
 * 8. Dismiss animation (shared by toast + in-flow)
 * ================================================================ */
.grz-store-notice.is-dismissing {
	height: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	overflow: hidden !important;
	padding-block: 0 !important;
	opacity: 0;
	transform: translateY(-6px);
}

/* ===================================================================
 * 9. Pre-JS fallback — server-rendered notices before enhancement
 * ================================================================ */
:where(body.woocommerce, .woocommerce-page, .grz-woocommerce-active, .grz-commerce-flow) :where(.woocommerce-message):not(.grz-store-notice) {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0 0 14px;
	padding: 12px 16px;
	border: 1px solid #cce9d4;
	border-radius: 8px;
	background: #effaf2;
	box-shadow: none;
	color: #176f34;
	font-size: 0.78rem;
	line-height: 1.45;
	list-style: none;
}
:where(body.woocommerce, .woocommerce-page, .grz-woocommerce-active, .grz-commerce-flow) :where(.woocommerce-info):not(.grz-store-notice) {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0 0 14px;
	padding: 12px 16px;
	border: 1px solid #bfdbfe;
	border-radius: 8px;
	background: #eff6ff;
	box-shadow: none;
	color: #1d4ed8;
	font-size: 0.78rem;
	line-height: 1.45;
	list-style: none;
}
:where(body.woocommerce, .woocommerce-page, .grz-woocommerce-active, .grz-commerce-flow) :where(.woocommerce-error):not(.grz-store-notice) {
	box-sizing: border-box;
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0 0 14px;
	padding: 12px 16px;
	border: 1px solid #fecaca;
	border-radius: 8px;
	background: #fef2f2;
	box-shadow: none;
	color: #b42318;
	font-size: 0.78rem;
	line-height: 1.45;
	list-style: none;
}

/* ===================================================================
 * 10. Checkout AJAX error group wrapper
 * ================================================================ */
.grz-checkout-page .woocommerce-NoticeGroup {
	max-width: var(--grz-container-inner, 1392px);
	margin-inline: auto;
}

/* ===================================================================
 * 11. Mobile + reduced motion
 * ================================================================ */
@media (max-width: 760px) {
	.grz-toast-stack,
	body.admin-bar .grz-toast-stack {
		top: max(10px, env(safe-area-inset-top));
		width: calc(100vw - 20px);
	}

	/* WooCommerce's own "View cart" button is redundant on a phone toast and
	 * pushes the message onto a third line. grzNotify()'s own action element
	 * is compact enough to keep. */
	.grz-store-toast :where(.button, .wc-forward) {
		display: none !important;
	}
}
@media (max-width: 620px) {
	.grz-store-notice {
		flex-wrap: wrap;
		min-height: 48px !important;
		padding: 10px 40px 10px 12px !important;
	}

	.grz-store-toast {
		padding: 11px 40px 11px 12px !important;
		border-radius: 11px !important;
	}

	.grz-store-notice :where(.button, .wc-forward, .restore-item) {
		order: 3;
		margin: 2px 0 0 !important;
	}

	.grz-store-notice__action {
		order: 3;
		align-self: flex-start;
		margin: 4px 0 0 33px;
	}
}

/* --------------------------------------------------------------------------
 * Retired: bottom-right account toast.
 * Account actions now render through grzNotify() like everything else. The
 * old element only appears if notify-v1.js failed to load, so it keeps a
 * minimal readable style and no longer needs its two duplicate definitions
 * in woocommerce.css and account-v140.css.
 * ----------------------------------------------------------------------- */
.grz-customer-toast {
	position: fixed;
	z-index: 100000;
	inset-inline-end: 16px;
	bottom: 16px;
	max-width: min(340px, calc(100vw - 32px));
	padding: 11px 14px;
	border-radius: 10px;
	background: #10192b;
	box-shadow: 0 12px 30px rgba(15, 23, 42, 0.26);
	color: #fff;
	font-size: 0.78rem;
	font-weight: 650;
	line-height: 1.45;
}

@media (prefers-reduced-motion: reduce) {
	.grz-store-toast { animation: none; }
	.grz-store-notice { transition: none; }
	/* The countdown rail is motion too — hold it at full width and let the
	 * timer dismiss the toast without an animated bar. */
	.grz-store-notice__progress-fill { transition: none !important; transform: none !important; }
}
