/*
 * Golden Snitch Add-to-Cart Button & Flight Animation (Harry Potter tag ID 872 - Admin Only)
 */

.shoco-btn.hp-snitch-btn {
	position: relative;
	column-gap: 7px;
	overflow: visible;
}

.shoco-btn.hp-snitch-btn .hp-snitch-icon-wrap {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	line-height: 0;
	flex-shrink: 0;
	pointer-events: none;
	animation: hpSnitchFloat 2.2s ease-in-out infinite;
	transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
	will-change: transform, opacity;
}

.shoco-btn.hp-snitch-btn svg.hp-snitch-svg {
	width: 34px !important;
	height: 20px !important;
	overflow: visible;
	pointer-events: none;
	filter: drop-shadow(0 1px 3px rgba(122, 75, 4, 0.32));
	transition: filter 0.25s ease, transform 0.25s ease;
}

/* Single product page desktop button has larger text (24px) */
.woocommerce-variation-add-to-cart.variations_button .shoco-btn.hp-snitch-btn svg.hp-snitch-svg,
.woocommerce-variation-add-to-cart .shoco-btn.hp-snitch-btn svg.hp-snitch-svg {
	width: 42px !important;
	height: 24px !important;
}

/* Upsells inside single product page use standard catalog button size */
.upsells .woocommerce-variation-add-to-cart.variations_button .shoco-btn.hp-snitch-btn svg.hp-snitch-svg,
.upsells .woocommerce-variation-add-to-cart .shoco-btn.hp-snitch-btn svg.hp-snitch-svg {
	width: 34px !important;
	height: 20px !important;
}

/* Prevent default 360deg rotation on .shoco-btn.loading */
.shoco-btn.hp-snitch-btn.loading svg.hp-snitch-svg {
	animation: none !important;
}

/* Preserve Snitch colors when button is hovered (.btn-style-1:hover svg path override) */
.shoco-btn.hp-snitch-btn:hover svg.hp-snitch-svg {
	filter: drop-shadow(0 0 6px rgba(242, 193, 58, 0.85)) drop-shadow(0 1px 3px rgba(140, 86, 6, 0.45));
	transform: scale(1.08);
}

.shoco-btn.hp-snitch-btn:hover svg.hp-snitch-svg path.hp-snitch-wing-main {
	fill: #FFF8DC !important;
	stroke: #C8921E !important;
}

.shoco-btn.hp-snitch-btn:hover svg.hp-snitch-svg path.hp-snitch-wing-vein {
	fill: none !important;
	stroke: #D8A22E !important;
}

.shoco-btn.hp-snitch-btn:hover svg.hp-snitch-svg path.hp-snitch-seam {
	fill: none !important;
	stroke: #8C5606 !important;
}

.shoco-btn.hp-snitch-btn:hover svg.hp-snitch-svg path.hp-snitch-sparkle {
	fill: #F3B626 !important;
	stroke: none !important;
}

/* Wing animations */
.hp-snitch-svg .hp-snitch-wing-left {
	transform-origin: 17px 12.5px;
	animation: hpSnitchWingLeft 0.34s ease-in-out infinite alternate;
}

.hp-snitch-svg .hp-snitch-wing-right {
	transform-origin: 27px 12.5px;
	animation: hpSnitchWingRight 0.34s ease-in-out infinite alternate;
}

/* Faster wing flutter on button hover */
.shoco-btn.hp-snitch-btn:hover .hp-snitch-svg .hp-snitch-wing-left {
	animation: hpSnitchWingLeftFast 0.085s ease-in-out infinite alternate;
}

.shoco-btn.hp-snitch-btn:hover .hp-snitch-svg .hp-snitch-wing-right {
	animation: hpSnitchWingRightFast 0.085s ease-in-out infinite alternate;
}

/* Sparkle twinkle inside button */
.hp-snitch-svg .hp-snitch-sparkle-1 {
	transform-origin: 11.5px 4.3px;
	animation: hpSnitchSparkle 1.8s ease-in-out infinite;
}

.hp-snitch-svg .hp-snitch-sparkle-2 {
	transform-origin: 33.2px 18.5px;
	animation: hpSnitchSparkle 1.8s ease-in-out 0.9s infinite;
}

/* Match .added-mark dimensions to the Snitch icon so the button never changes size */
.shoco-btn.hp-snitch-btn .added-mark {
	width: 34px !important;
	height: 20px !important;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 1;
}

.woocommerce-variation-add-to-cart.variations_button .shoco-btn.hp-snitch-btn .added-mark,
.woocommerce-variation-add-to-cart .shoco-btn.hp-snitch-btn .added-mark {
	width: 42px !important;
	height: 24px !important;
}

.upsells .woocommerce-variation-add-to-cart.variations_button .shoco-btn.hp-snitch-btn .added-mark,
.upsells .woocommerce-variation-add-to-cart .shoco-btn.hp-snitch-btn .added-mark {
	width: 34px !important;
	height: 20px !important;
}

/* In-flight & post-flight checkmark states on button */
.shoco-btn.hp-snitch-btn.hp-snitch-inflight .hp-snitch-icon-wrap {
	opacity: 0 !important;
	transform: scale(0.15) translateY(-10px) !important;
}

.shoco-btn.hp-snitch-btn.hp-snitch-inflight svg.hp-snitch-svg {
	display: block !important;
}

.shoco-btn.hp-snitch-btn.hp-snitch-inflight .added-mark {
	display: none !important;
}

.shoco-btn.hp-snitch-btn.hp-snitch-show-check .hp-snitch-icon-wrap {
	display: none !important;
}

.shoco-btn.hp-snitch-btn.hp-snitch-show-check .added-mark {
	display: inline-flex !important;
	animation: hpSnitchReturnPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* When WooCommerce leaves .added on the button, keep the Snitch visible once check confirmation finishes */
.shoco-btn.hp-snitch-btn.added:not(.hp-snitch-show-check):not(.hp-snitch-inflight) svg.hp-snitch-svg {
	display: block !important;
}

.shoco-btn.hp-snitch-btn.added:not(.hp-snitch-show-check) .added-mark {
	display: none !important;
}

.shoco-btn.hp-snitch-btn.hp-snitch-returning .hp-snitch-icon-wrap {
	animation: hpSnitchReturnPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), hpSnitchFloat 2.2s ease-in-out 0.45s infinite;
}

/* Full-viewport non-interactive flight overlay */
#hp-snitch-flight-layer {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	pointer-events: none !important;
	z-index: 2147483640;
	overflow: hidden;
}

#hp-snitch-flight-layer * {
	pointer-events: none !important;
}

.hp-snitch-trail-canvas {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none !important;
}

.hp-flying-snitch {
	position: fixed;
	top: 0;
	left: 0;
	width: 52px;
	height: 30px;
	margin-left: -26px;
	margin-top: -15px;
	pointer-events: none !important;
	will-change: transform, opacity;
	filter: drop-shadow(0 0 8px rgba(255, 222, 89, 0.95)) drop-shadow(0 2px 12px rgba(216, 152, 28, 0.7));
}

.hp-flying-snitch svg.hp-snitch-svg {
	width: 100% !important;
	height: 100% !important;
	display: block !important;
	overflow: visible;
}

.hp-flying-snitch .hp-snitch-wing-left {
	transform-origin: 17px 12.5px;
	animation: hpSnitchWingLeftFast 0.055s ease-in-out infinite alternate !important;
}

.hp-flying-snitch .hp-snitch-wing-right {
	transform-origin: 27px 12.5px;
	animation: hpSnitchWingRightFast 0.055s ease-in-out infinite alternate !important;
}

/* Basket catch pulse when Snitch lands in .xoo-wsc-basket */
.xoo-wsc-basket.hp-snitch-basket-caught {
	animation: hpBasketCatch 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Keyframes */
@keyframes hpSnitchFloat {
	0%, 100% {
		transform: translateY(0px) rotate(0deg);
	}
	50% {
		transform: translateY(-2px) rotate(-2deg);
	}
}

@keyframes hpSnitchWingLeft {
	0% {
		transform: rotate(10deg) scaleY(0.92);
	}
	100% {
		transform: rotate(-16deg) scaleY(1.05);
	}
}

@keyframes hpSnitchWingRight {
	0% {
		transform: rotate(-10deg) scaleY(0.92);
	}
	100% {
		transform: rotate(16deg) scaleY(1.05);
	}
}

@keyframes hpSnitchWingLeftFast {
	0% {
		transform: rotate(22deg) scaleY(0.78);
	}
	100% {
		transform: rotate(-28deg) scaleY(1.1);
	}
}

@keyframes hpSnitchWingRightFast {
	0% {
		transform: rotate(-22deg) scaleY(0.78);
	}
	100% {
		transform: rotate(28deg) scaleY(1.1);
	}
}

@keyframes hpSnitchSparkle {
	0%, 100% {
		opacity: 0.25;
		transform: scale(0.7) rotate(0deg);
	}
	50% {
		opacity: 1;
		transform: scale(1.15) rotate(20deg);
	}
}

@keyframes hpSnitchReturnPop {
	0% {
		opacity: 0;
		transform: scale(0.2);
	}
	70% {
		opacity: 1;
		transform: scale(1.18);
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes hpBasketCatch {
	0% {
		transform: scale(1);
		box-shadow: 0 1px 3px 1px #9ECFCA;
	}
	35% {
		transform: scale(1.22) rotate(-6deg);
		box-shadow: 0 0 24px 6px rgba(246, 200, 68, 0.85), 0 0 8px 2px #FFF6B7;
	}
	65% {
		transform: scale(0.94) rotate(3deg);
		box-shadow: 0 0 14px 3px rgba(246, 200, 68, 0.55);
	}
	100% {
		transform: scale(1) rotate(0deg);
		box-shadow: 0 1px 3px 1px #9ECFCA;
	}
}

@media (max-width: 767px) {
	.shoco-btn.hp-snitch-btn {
		column-gap: 5px;
	}

	.shoco-btn.hp-snitch-btn svg.hp-snitch-svg,
	.woocommerce-variation-add-to-cart.variations_button .shoco-btn.hp-snitch-btn svg.hp-snitch-svg,
	.woocommerce-variation-add-to-cart .shoco-btn.hp-snitch-btn svg.hp-snitch-svg,
	.upsells .woocommerce-variation-add-to-cart.variations_button .shoco-btn.hp-snitch-btn svg.hp-snitch-svg,
	.upsells .woocommerce-variation-add-to-cart .shoco-btn.hp-snitch-btn svg.hp-snitch-svg,
	.shoco-btn.hp-snitch-btn .added-mark,
	.woocommerce-variation-add-to-cart.variations_button .shoco-btn.hp-snitch-btn .added-mark,
	.woocommerce-variation-add-to-cart .shoco-btn.hp-snitch-btn .added-mark,
	.upsells .woocommerce-variation-add-to-cart.variations_button .shoco-btn.hp-snitch-btn .added-mark,
	.upsells .woocommerce-variation-add-to-cart .shoco-btn.hp-snitch-btn .added-mark {
		width: 26px !important;
		height: 15px !important;
	}

	.hp-flying-snitch {
		width: 44px;
		height: 25px;
		margin-left: -22px;
		margin-top: -12.5px;
	}
}
