/**
 * Floating Contact Button - front-end styles.
 */

.fcb-widget {
	--fcb-size: 58px;
	--fcb-offset-x: 24px;
	--fcb-offset-y: 24px;
	--fcb-color: #2563eb;
	--fcb-icon-color: #ffffff;
	--fcb-z: 99990;
	--fcb-gap: 12px;

	position: fixed;
	bottom: var(--fcb-offset-y);
	z-index: var(--fcb-z);
	display: flex;
	flex-direction: column;
	gap: var(--fcb-gap);
	font-size: 14px;
	line-height: 1.4;
	box-sizing: border-box;

	/*
	 * The widget lays itself out from the chosen corner, so it must not flip
	 * with the page direction. Labels below opt back in to per-string
	 * direction detection, which keeps Persian, Arabic and Hebrew readable.
	 */
	direction: ltr;
}

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

.fcb-widget.fcb--right {
	right: var(--fcb-offset-x);
	align-items: flex-end;
}

.fcb-widget.fcb--left {
	left: var(--fcb-offset-x);
	align-items: flex-start;
}

/* Trigger row ------------------------------------------------------------ */

.fcb-trigger {
	display: flex;
	align-items: center;
	gap: 10px;
}

.fcb--left .fcb-trigger {
	flex-direction: row-reverse;
}

.fcb-trigger__label {
	unicode-bidi: plaintext;
	background: #ffffff;
	color: #101828;
	padding: 7px 14px;
	border-radius: 999px;
	box-shadow: 0 6px 20px rgba(16, 24, 40, 0.16);
	white-space: nowrap;
	font-weight: 600;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.fcb-widget.is-open .fcb-trigger__label {
	opacity: 0;
	transform: translateY(6px);
	pointer-events: none;
}

.fcb-toggle {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--fcb-size);
	height: var(--fcb-size);
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--fcb-color);
	color: var(--fcb-icon-color);
	box-shadow: 0 8px 24px rgba(16, 24, 40, 0.28);
	cursor: pointer;
	text-decoration: none;
	-webkit-appearance: none;
	appearance: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fcb-toggle:hover,
.fcb-toggle:focus-visible {
	transform: scale(1.06);
	box-shadow: 0 10px 28px rgba(16, 24, 40, 0.34);
	color: var(--fcb-icon-color);
}

.fcb-toggle:focus-visible {
	outline: 3px solid var(--fcb-color);
	outline-offset: 3px;
}

.fcb-toggle .fcb-icon {
	width: calc(var(--fcb-size) * 0.46);
	height: calc(var(--fcb-size) * 0.46);
	display: block;
}

.fcb-toggle__icon {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.fcb-toggle__icon--close {
	opacity: 0;
	transform: rotate(-45deg) scale(0.6);
}

.fcb-widget.is-open .fcb-toggle__icon--main {
	opacity: 0;
	transform: rotate(45deg) scale(0.6);
}

.fcb-widget.is-open .fcb-toggle__icon--close {
	opacity: 1;
	transform: none;
}

/* Channel list ----------------------------------------------------------- */

.fcb-channels {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.fcb--right .fcb-channels {
	align-items: flex-end;
}

.fcb--left .fcb-channels {
	align-items: flex-start;
}

.fcb-widget.is-open .fcb-channels {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.fcb-channels__item {
	margin: 0;
	padding: 0;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	transition-delay: var(--fcb-delay, 0ms);
}

.fcb-widget.is-open .fcb-channels__item {
	opacity: 1;
	transform: none;
}

.fcb-channel {
	--fcb-channel-color: var(--fcb-color);

	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: inherit;
}

.fcb--left .fcb-channel {
	flex-direction: row-reverse;
}

.fcb-channel__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--fcb-size) * 0.78);
	height: calc(var(--fcb-size) * 0.78);
	border-radius: 50%;
	background: var(--fcb-channel-color);
	color: var(--fcb-icon-color);
	box-shadow: 0 6px 18px rgba(16, 24, 40, 0.24);
	transition: transform 0.2s ease;
	flex: 0 0 auto;
}

.fcb-channel__icon .fcb-icon {
	width: calc(var(--fcb-size) * 0.36);
	height: calc(var(--fcb-size) * 0.36);
	display: block;
}

.fcb-channel__label {
	unicode-bidi: plaintext;
	background: #ffffff;
	color: #101828;
	padding: 6px 13px;
	border-radius: 999px;
	box-shadow: 0 6px 18px rgba(16, 24, 40, 0.16);
	white-space: nowrap;
	font-weight: 600;
}

.fcb-channel:hover .fcb-channel__icon,
.fcb-channel:focus-visible .fcb-channel__icon {
	transform: scale(1.08);
}

.fcb-channel:focus-visible {
	outline: 3px solid var(--fcb-channel-color);
	outline-offset: 3px;
	border-radius: 999px;
}

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

.fcb--anim-pulse .fcb-toggle::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--fcb-color);
	opacity: 0.55;
	z-index: -1;
	animation: fcb-pulse 2.2s ease-out infinite;
}

.fcb--anim-bounce .fcb-toggle {
	animation: fcb-bounce 2.4s ease-in-out infinite;
}

.fcb-widget.is-open .fcb-toggle::after,
.fcb-widget.is-open.fcb--anim-bounce .fcb-toggle {
	animation: none;
}

@keyframes fcb-pulse {
	0% {
		transform: scale(1);
		opacity: 0.55;
	}

	70% {
		transform: scale(1.7);
		opacity: 0;
	}

	100% {
		transform: scale(1.7);
		opacity: 0;
	}
}

@keyframes fcb-bounce {
	0%,
	100%,
	60% {
		transform: translateY(0);
	}

	30% {
		transform: translateY(-8px);
	}

	45% {
		transform: translateY(-4px);
	}
}

/* Device visibility ------------------------------------------------------ */

@media (max-width: 782px) {
	.fcb-widget.fcb--desktop-only {
		display: none;
	}

	.fcb-widget {
		--fcb-gap: 10px;
	}
}

@media (min-width: 783px) {
	.fcb-widget.fcb--mobile-only {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fcb-widget *,
	.fcb-widget *::after {
		animation: none !important;
		transition-duration: 0.01ms !important;
	}
}

/* Utilities -------------------------------------------------------------- */

.fcb-screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
