/* Kareva Chat Button for WhatsApp — front end.
	Colours and offsets come from the settings as CSS variables on .kcb. */

.kcb {
	--kcb-bg: #188741;
	--kcb-fg: #fff;
	--kcb-x: 20px;
	--kcb-y: 20px;
	--kcb-size: 56px;
	position: fixed;
	z-index: 2147482998;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: inherit;
	line-height: 1.4;
	pointer-events: none;
}

.kcb *,
.kcb *::before,
.kcb *::after {
	box-sizing: border-box;
}

.kcb > * {
	pointer-events: auto;
}

/* ---------------------------------------------------------------
	Placement
--------------------------------------------------------------- */

.kcb--bottom-right {
	right: var(--kcb-x);
	bottom: calc(var(--kcb-y) + env(safe-area-inset-bottom, 0px));
}

.kcb--bottom-left {
	left: var(--kcb-x);
	bottom: calc(var(--kcb-y) + env(safe-area-inset-bottom, 0px));
	align-items: flex-start;
}

.kcb--middle-right,
.kcb--middle-left {
	top: 50%;
	transform: translateY(-50%);
}

.kcb--middle-right {
	right: var(--kcb-x);
}

.kcb--middle-left {
	left: var(--kcb-x);
	align-items: flex-start;
}

/* ---------------------------------------------------------------
	Button
--------------------------------------------------------------- */

.kcb--size-s {
	--kcb-size: 48px;
}

.kcb--size-m {
	--kcb-size: 56px;
}

.kcb--size-l {
	--kcb-size: 64px;
}

.kcb-button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: var(--kcb-size);
	height: var(--kcb-size);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--kcb-bg);
	color: var(--kcb-fg);
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.kcb-button:hover {
	color: var(--kcb-fg);
	filter: brightness(1.06);
	transform: translateY(-2px);
}

.kcb-button:focus-visible {
	outline: 3px solid var(--kcb-bg);
	outline-offset: 4px;
}

.kcb-icon {
	flex: 0 0 auto;
	width: 56%;
	height: 56%;
}

.kcb--shadow .kcb-button {
	box-shadow: 0 8px 24px -6px rgba(0, 0, 0, .35), 0 2px 6px rgba(0, 0, 0, .12);
}

/* Rounded square */
.kcb--style-rounded .kcb-button {
	border-radius: 28%;
}

/* Pill with label */
.kcb--style-pill .kcb-button {
	width: auto;
	padding: 0 22px 0 16px;
	border-radius: 999px;
}

.kcb--style-pill .kcb-icon {
	width: calc(var(--kcb-size) * .5);
	height: calc(var(--kcb-size) * .5);
}

.kcb-label {
	white-space: nowrap;
}

/* ---------------------------------------------------------------
	Animations
--------------------------------------------------------------- */

.kcb--anim-pulse .kcb-button::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: var(--kcb-bg);
	opacity: .55;
	z-index: -1;
	animation: kcbPulse 2.4s ease-out infinite;
}

@keyframes kcbPulse {

	0% {
		transform: scale(1);
		opacity: .5;
	}

	80%,
	100% {
		transform: scale(1.55);
		opacity: 0;
	}
}

.kcb--anim-bounce .kcb-button {
	animation: kcbBounce 4s ease-in-out infinite;
}

@keyframes kcbBounce {

	0%,
	84%,
	100% {
		transform: translateY(0);
	}

	88% {
		transform: translateY(-10px);
	}

	92% {
		transform: translateY(0);
	}

	95% {
		transform: translateY(-5px);
	}
}

/* ---------------------------------------------------------------
	Greeting bubble
--------------------------------------------------------------- */

.kcb-greeting {
	position: relative;
	max-width: min(280px, calc(100vw - 2 * var(--kcb-x)));
	padding: 14px 40px 14px 16px;
	border-radius: 14px;
	background: #fff;
	color: #1d1d1f;
	font-size: 15px;
	box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .3), 0 2px 6px rgba(0, 0, 0, .08);
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .3s ease, transform .3s ease;
}

.kcb-greeting.is-visible {
	opacity: 1;
	transform: none;
}

.kcb-greeting[hidden] {
	display: none;
}

.kcb-greeting__text {
	margin: 0;
	color: inherit;
}

.kcb-greeting__close {
	position: absolute;
	top: 6px;
	right: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #555;
	cursor: pointer;
}

.kcb-greeting__close:hover {
	background: rgba(0, 0, 0, .07);
}

.kcb-greeting__close:focus-visible {
	outline: 2px solid #1d1d1f;
	outline-offset: 1px;
}

/* ---------------------------------------------------------------
	Devices
--------------------------------------------------------------- */

@media (min-width: 783px) {

	.kcb--hide-desktop {
		display: none !important;
	}
}

@media (max-width: 782px) {

	.kcb--hide-mobile {
		display: none !important;
	}
}

/* ---------------------------------------------------------------
	Inline shortcode button
--------------------------------------------------------------- */

.kcb-inline {
	--kcb-bg: #188741;
	--kcb-fg: #fff;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding: 0 22px 0 16px;
	border-radius: 999px;
	background: var(--kcb-bg);
	color: var(--kcb-fg);
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
}

.kcb-inline:hover,
.kcb-inline:focus {
	color: var(--kcb-fg);
	filter: brightness(1.06);
}

.kcb-inline .kcb-icon {
	width: 24px;
	height: 24px;
}

@media (prefers-reduced-motion: reduce) {

	.kcb-button,
	.kcb-button::before,
	.kcb-greeting {
		animation: none !important;
		transition: none;
	}
}

@media (forced-colors: active) {

	.kcb-button,
	.kcb-inline {
		border: 2px solid ButtonText;
	}
}

@media print {

	.kcb {
		display: none !important;
	}
}
