/* HyperToast – floating WooCommerce notices
 * Override any variable from your theme, e.g.
 * :root { --ht-bg: #111; --ht-accent: #e0b07a; }
 */
:root {
	--ht-bg: #23120b;
	--ht-text: #fff8f2;
	--ht-muted: rgba(255, 248, 242, .72);
	--ht-accent: #d9a46c;
	--ht-success: #4ade80;
	--ht-info: #60a5fa;
	--ht-error: #f87171;
	--ht-removed: #f4b860;
	--ht-radius: 14px;
	--ht-width: 380px;
	--ht-gap: 12px;
	--ht-offset: 20px;
	--ht-shadow: 0 18px 40px -12px rgba(20, 8, 2, .45), 0 4px 12px rgba(20, 8, 2, .18);
	--ht-font: inherit;
	--ht-z: 999999;
}

/* Hide the original bars once JS is active */
/* Original bars are hidden by the inline #hypertoast-hide rule (built from settings);
 * this catches anything already converted. */
html .ht-processed,
html body .woocommerce-notices-wrapper > .ht-processed { display: none !important; }

/* ---------- Container ---------- */
.ht-stack {
	position: fixed;
	z-index: var(--ht-z);
	display: flex;
	flex-direction: column;
	gap: var(--ht-gap);
	width: min(var(--ht-width), calc(100vw - 2 * var(--ht-offset)));
	pointer-events: none;
	font-family: var(--ht-font);
}
.ht-stack[data-pos^="top"]    { top: var(--ht-offset); transition: top .25s ease; }
.ht-stack[data-pos^="bottom"] { bottom: var(--ht-offset); flex-direction: column-reverse; }
.ht-stack[data-pos$="right"]  { right: var(--ht-offset); }
.ht-stack[data-pos$="left"]   { left: var(--ht-offset); }
.ht-stack[data-pos$="center"] { left: 50%; transform: translateX(-50%); }

/* Clear the WP admin bar when logged in */
.admin-bar .ht-stack[data-pos^="top"] { top: calc(32px + var(--ht-offset)); }

/* ---------- Toast ---------- */
.ht-toast {
	--ht-type: var(--ht-success);
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 14px;
	align-items: start;
	padding: 16px 16px 18px;
	background: var(--ht-bg);
	color: var(--ht-text);
	border-radius: var(--ht-radius);
	box-shadow: var(--ht-shadow);
	overflow: hidden;
	pointer-events: auto;
	touch-action: pan-y;
	opacity: 0;
	transform: translateY(-14px) scale(.97);
	transition: opacity .28s ease, transform .38s cubic-bezier(.2, .9, .3, 1.2);
	will-change: transform, opacity;
}
.ht-stack[data-pos^="bottom"] .ht-toast { transform: translateY(14px) scale(.97); }
.ht-toast.ht-in { opacity: 1; transform: none !important; }
.ht-toast.ht-out {
	opacity: 0;
	transform: translateX(30px) scale(.96) !important;
	transition: opacity .22s ease, transform .22s ease;
}
.ht-toast.ht-info  { --ht-type: var(--ht-info); }
.ht-toast.ht-error { --ht-type: var(--ht-error); }
.ht-toast.ht-removed { --ht-type: var(--ht-removed); }

/* Left accent line */
.ht-toast::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 4px;
	background: var(--ht-type);
}

/* Icon / thumbnail */
.ht-media {
	position: relative;
	width: 44px;
	height: 44px;
	flex: none;
}
.ht-icon {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--ht-type) 18%, transparent);
	color: var(--ht-type);
}
.ht-icon svg { width: 22px; height: 22px; }
.ht-thumb {
	width: 44px !important;
	height: 44px !important;
	object-fit: cover;
	border-radius: 10px;
	display: block;
	background: rgba(255, 255, 255, .08);
}
.ht-media .ht-badge {
	position: absolute;
	right: -5px;
	bottom: -5px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--ht-type);
	color: var(--ht-bg);
	box-shadow: 0 0 0 2px var(--ht-bg);
}
.ht-badge svg { width: 12px; height: 12px; }

/* Text */
.ht-body { min-width: 0; }
.ht-title {
	margin: 1px 0 3px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: .01em;
}
.ht-msg {
	font-size: 13.5px;
	line-height: 1.45;
	color: var(--ht-muted);
	overflow-wrap: anywhere;
}
.ht-msg a { color: var(--ht-text); text-decoration: underline; }
.ht-msg ul { margin: 4px 0 0; padding-left: 18px; }
.ht-msg li { margin: 2px 0; }

/* Buttons */
.ht-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ht-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	text-decoration: none !important;
	cursor: pointer;
	border: 1px solid rgba(255, 255, 255, .22);
	background: transparent;
	color: var(--ht-text) !important;
	transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.ht-btn:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .4); }
.ht-btn:active { transform: scale(.97); }
.ht-btn.ht-primary {
	background: var(--ht-accent);
	border-color: var(--ht-accent);
	color: var(--ht-bg) !important;
}
.ht-btn.ht-primary:hover { filter: brightness(1.08); background: var(--ht-accent); }

/* Close */
.ht-close {
	appearance: none;
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	margin: -4px -4px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ht-muted);
	cursor: pointer;
	transition: background .18s ease, color .18s ease;
}
.ht-close:hover { background: rgba(255, 255, 255, .1); color: var(--ht-text); }
.ht-close svg { width: 16px; height: 16px; }

/* Countdown bar */
.ht-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	background: var(--ht-type);
	opacity: .7;
	transform-origin: left;
	animation: ht-countdown linear forwards;
}
.ht-toast.ht-paused .ht-progress { animation-play-state: paused; }
@keyframes ht-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Focus styles */
.ht-btn:focus-visible,
.ht-close:focus-visible { outline: 2px solid var(--ht-accent); outline-offset: 2px; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
	.ht-stack,
	.ht-stack[data-pos] {
		left: 12px !important;
		right: 12px !important;
		width: auto;
		transform: none;
	}
	.ht-stack[data-mobile="bottom"] {
		top: auto !important;
		bottom: calc(12px + env(safe-area-inset-bottom));
		flex-direction: column-reverse;
	}
	.ht-stack[data-mobile="top"] {
		bottom: auto !important;
		top: calc(12px + env(safe-area-inset-top));
		flex-direction: column;
	}
	.admin-bar .ht-stack[data-mobile="top"] { top: calc(46px + 12px); }
	.ht-stack[data-mobile="bottom"] .ht-toast { transform: translateY(20px) scale(.97); }
	.ht-toast { padding: 14px 14px 16px; gap: 12px; }
	.ht-btn { flex: 1 1 auto; padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.ht-toast, .ht-toast.ht-out { transition: opacity .15s linear; transform: none !important; }
	.ht-progress { display: none; }
}
