/**
 * STW AI Personal Dealmaker - celebration effects + avatar cheer banner.
 * Loaded on widget pages, the WooCommerce order-received page, and the
 * dashboard Settings tab (for the effect Demo buttons).
 */

/* ---------------- full-screen effect layer ---------------- */

.stw-dm-confetti {
	position: fixed;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
	z-index: 2147483646;
}

.stw-dm-confetti i {
	position: absolute;
	top: -24px;
	display: block;
	opacity: 0.95;
	animation-timing-function: linear;
	animation-fill-mode: forwards;
}

/* falling, with sideways drift */
@keyframes stwDmConfettiA {
	0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
	100% { transform: translate3d(-60px, 115vh, 0) rotate(660deg); opacity: 0.6; }
}

@keyframes stwDmConfettiB {
	0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
	100% { transform: translate3d(70px, 115vh, 0) rotate(-720deg); opacity: 0.6; }
}

/* rising, with sideways drift (balloons, hearts, bubbles) */
@keyframes stwDmFxRiseA {
	0% { transform: translate3d(0, 0, 0) rotate(-4deg); opacity: 0; }
	8% { opacity: 1; }
	100% { transform: translate3d(-70px, -118vh, 0) rotate(7deg); opacity: 0.85; }
}

@keyframes stwDmFxRiseB {
	0% { transform: translate3d(0, 0, 0) rotate(5deg); opacity: 0; }
	8% { opacity: 1; }
	100% { transform: translate3d(80px, -118vh, 0) rotate(-8deg); opacity: 0.85; }
}

/* ---------------- effect pieces ---------------- */

/* character pieces: emoji, hearts, stars, coins */
.stw-dm-confetti .stw-dm-fx-txt {
	position: absolute;
	top: -48px;
	display: block;
	line-height: 1;
	animation-timing-function: linear;
	animation-fill-mode: forwards;
	text-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.stw-dm-confetti .stw-dm-fx-txt--rise {
	top: auto;
	bottom: -52px;
	animation-timing-function: ease-in-out;
}

/* fireworks sparks fly outward from the burst point via CSS vars */
.stw-dm-fx-spark {
	position: absolute;
	width: 7px;
	height: 7px;
	top: 0;
	border-radius: 50%;
	animation-name: stwDmFxSpark;
	animation-timing-function: cubic-bezier(0.12, 0.8, 0.35, 1);
	animation-fill-mode: forwards;
	box-shadow: 0 0 8px currentColor;
}

@keyframes stwDmFxSpark {
	0% { transform: translate(0, 0) scale(1); opacity: 1; }
	70% { opacity: 1; }
	100% { transform: translate(var(--dx, 0), calc(var(--dy, 0) + 34px)) scale(0.25); opacity: 0; }
}

/* balloons: teardrop body + string */
.stw-dm-confetti .stw-dm-fx-balloon {
	position: absolute;
	top: auto;
	bottom: -110px;
	border-radius: 50% 50% 50% 50% / 56% 56% 44% 44%;
	opacity: 0.92;
	box-shadow: inset -8px -8px 0 rgba(0, 0, 0, 0.12), inset 6px 8px 0 rgba(255, 255, 255, 0.25);
	animation-timing-function: ease-in-out;
}

.stw-dm-fx-balloon::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 100%;
	width: 2px;
	height: 42px;
	background: rgba(0, 0, 0, 0.28);
	transform: translateX(-50%);
}

/* sparkles: 4-point glints twinkling in place */
.stw-dm-fx-glint {
	position: absolute;
	clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
	transform: scale(0);
	animation-name: stwDmFxGlint;
	animation-timing-function: ease-in-out;
	animation-fill-mode: forwards;
	animation-iteration-count: 2;
}

@keyframes stwDmFxGlint {
	0% { transform: scale(0) rotate(0deg); opacity: 0; }
	50% { transform: scale(1) rotate(45deg); opacity: 1; }
	100% { transform: scale(0) rotate(90deg); opacity: 0; }
}

/* streamer ribbons: long thin strips */
.stw-dm-confetti .stw-dm-fx-ribbon {
	position: absolute;
	top: -70px;
	width: 7px;
	border-radius: 4px;
	opacity: 0.92;
}

/* soap bubbles */
.stw-dm-confetti .stw-dm-fx-bubble {
	position: absolute;
	top: auto;
	bottom: -70px;
	border-radius: 50%;
	background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.16) 26%, rgba(173, 216, 230, 0.18) 100%);
	border: 1px solid rgba(255, 255, 255, 0.65);
	box-shadow: inset -4px -4px 8px rgba(255, 255, 255, 0.28);
	animation-timing-function: ease-in-out;
}

/* snowflakes */
.stw-dm-confetti .stw-dm-fx-snow {
	position: absolute;
	top: -16px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
	filter: blur(0.4px);
}

/* light show: soft color pulses */
.stw-dm-fx-glow {
	position: absolute;
	border-radius: 50%;
	mix-blend-mode: screen;
	transform: scale(0.2);
	opacity: 0;
	animation-name: stwDmFxGlow;
	animation-timing-function: ease-out;
	animation-fill-mode: forwards;
}

@keyframes stwDmFxGlow {
	0% { transform: scale(0.2); opacity: 0; }
	30% { opacity: 0.85; }
	100% { transform: scale(1.7); opacity: 0; }
}

/* ---------------- avatar cheer banner ---------------- */

.stw-dm-cheer {
	position: fixed;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: min(480px, calc(100vw - 32px));
	padding: 14px 20px;
	border-radius: 999px;
	background: var(--stw-dm-purple-dark, #321457);
	color: var(--stw-dm-white, #ffffff);
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.30);
	border: 2px solid var(--stw-dm-green, #9acd32);
	cursor: pointer;
	z-index: 2147483647;
	animation: stwDmCheerIn 0.45s cubic-bezier(0.18, 1.25, 0.4, 1) both;
	font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.stw-dm-cheer--big {
	bottom: auto;
	top: 18vh;
	padding: 18px 26px;
	border-width: 3px;
}

.stw-dm-cheer.is-leaving {
	transition: opacity 0.4s ease, transform 0.4s ease;
	opacity: 0;
	transform: translateX(-50%) translateY(14px);
}

@keyframes stwDmCheerIn {
	0% { opacity: 0; transform: translateX(-50%) translateY(26px) scale(0.85); }
	100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.stw-dm-cheer-avatar {
	flex: 0 0 46px;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--stw-dm-green, #9acd32);
	color: var(--stw-dm-purple-dark, #321457);
	font-size: 20px;
	font-weight: 800;
	border: 2px solid rgba(255, 255, 255, 0.65);
}

.stw-dm-cheer-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.stw-dm-cheer-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.stw-dm-cheer-name {
	font-size: 12.5px;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	color: var(--stw-dm-green, #9acd32);
}

.stw-dm-cheer-text {
	font-size: 15px;
	line-height: 1.4;
	font-weight: 600;
}

.stw-dm-cheer--big .stw-dm-cheer-text {
	font-size: 17px;
}
