/* Floating "Join our WhatsApp group" button.
   Never sits over content: space is reserved for it, it tucks to the edge while scrolling,
   and it hides while a sheet is open or a field is being typed in. */
.kx-wa {
	--wa-green: #25D366; --wa-deep: #128C7E;
	position: fixed; z-index: 24;
	right: calc(14px + env(safe-area-inset-right, 0px));
	bottom: calc(18px + env(safe-area-inset-bottom, 0px));
	display: inline-flex; align-items: center; height: 52px;
	border-radius: 999px; padding: 0; text-decoration: none; color: #fff;
	background: linear-gradient(135deg, var(--wa-green), var(--wa-deep));
	box-shadow: 0 10px 24px -6px rgba(18,140,126,.55), 0 2px 6px rgba(18,20,43,.18);
	font: 700 13.5px/1 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent;
	opacity: 0; transform: translateY(24px) scale(.6); pointer-events: none;
	transition: transform .45s cubic-bezier(.34,1.56,.64,1), opacity .3s ease, box-shadow .25s ease;
}
/* On the dashboard, sit just above the floating tab bar */
.kx-wa.is-dock { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

.kx-wa.is-ready { opacity: 1; transform: none; pointer-events: auto; }
.kx-wa.is-ready:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -6px rgba(18,140,126,.6), 0 3px 8px rgba(18,20,43,.2); }
.kx-wa.is-ready:active { transform: scale(.94); }
.kx-wa:focus-visible { outline: 3px solid #12142B; outline-offset: 3px; }

/* Tucked to the edge while the page is scrolling */
.kx-wa.is-ready.is-away { transform: translateX(calc(100% - 18px)); opacity: .85; pointer-events: none; }
/* Hidden while typing in a field, or while a sheet / menu is open */
.kx-wa.is-ready.is-hidden,
body.kx-scroll-lock .kx-wa { opacity: 0; transform: translateY(16px) scale(.7); pointer-events: none; visibility: hidden; transition: transform .25s ease, opacity .2s ease, visibility 0s .25s; }

.kx-wa-ic {
	position: relative; display: grid; place-items: center; flex: none; width: 52px; height: 52px;
}
.kx-wa-ic svg { display: block; animation: kx-wa-wiggle 7s ease-in-out 3s infinite; transform-origin: 50% 60%; }
/* Soft pulse rings */
.kx-wa-ic::before, .kx-wa-ic::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--wa-green);
	opacity: 0; pointer-events: none; animation: kx-wa-ring 2.8s ease-out 1.6s infinite;
}
.kx-wa-ic::after { animation-delay: 2.6s; }

/* Label: opens briefly on arrival, then folds into the round button */
.kx-wa-label {
	max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; padding: 0;
	transition: max-width .5s cubic-bezier(.22,.8,.24,1), opacity .35s ease, padding .5s cubic-bezier(.22,.8,.24,1);
}
.kx-wa.is-open .kx-wa-label { max-width: 210px; opacity: 1; padding: 0 2px 0 20px; }

@keyframes kx-wa-ring { 0% { transform: scale(1); opacity: .55; } 80%, 100% { transform: scale(1.7); opacity: 0; } }
@keyframes kx-wa-wiggle {
	0%, 88%, 100% { transform: rotate(0); }
	91% { transform: rotate(-14deg); } 94% { transform: rotate(12deg); } 97% { transform: rotate(-6deg); }
}

/* Reserve room so the button can never hide a field or button at the end of a page */
body.kx-has-wa .kx-app { padding-bottom: calc(172px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 959px) { body.kx-has-wa .kxa-wrap { padding-bottom: 104px; } }

@media (prefers-reduced-motion: reduce) {
	.kx-wa, .kx-wa-label { transition: opacity .2s ease !important; }
	.kx-wa-ic svg, .kx-wa-ic::before, .kx-wa-ic::after { animation: none !important; }
	.kx-wa.is-ready.is-away { transform: none; }
}
