/**
 * Pulsante fisso WhatsApp Chat.
 * Il colore e la posizione stanno sulle variabili --wpchat-* del contenitore.
 * --wpchat-offset-bottom è la distanza dal bordo basso, prima dell'area sicura.
 * Un altro plugin può mettersi sopra con:
 * bottom: calc(var(--wpchat-offset-bottom, 20px) + var(--wpchat-button-size, 60px) + env(safe-area-inset-bottom, 0px) + 12px);
 */

#wpchat-widget {
	position: fixed;
	z-index: 9999;
	background: transparent;
	border-radius: 50%;
	--wpchat-primary-color: #25D366;
	--wpchat-hover-color: #128C7E;
	--wpchat-icon-color: #fff;
	--wpchat-icon-hover-color: #fff;
	--wpchat-button-size: var(--wpchat-button-size-desktop, 60px);
	--wpchat-offset-bottom: var(--wpchat-offset-y, 20px);
	--wpchat-offset-x: var(--wpchat-offset-x-desktop, 20px);
	width: var(--wpchat-button-size);
	height: var(--wpchat-button-size);
}

#wpchat-widget.wpchat-bottom-right {
	bottom: calc(var(--wpchat-offset-bottom, 20px) + env(safe-area-inset-bottom, 0px));
	right: calc(var(--wpchat-offset-x, 20px) + env(safe-area-inset-right, 0px));
}

#wpchat-widget.wpchat-bottom-left {
	bottom: calc(var(--wpchat-offset-bottom, 20px) + env(safe-area-inset-bottom, 0px));
	left: calc(var(--wpchat-offset-x, 20px) + env(safe-area-inset-left, 0px));
}

#wpchat-widget.wpchat-top-right {
	top: calc(var(--wpchat-offset-bottom, 20px) + env(safe-area-inset-top, 0px));
	right: calc(var(--wpchat-offset-x, 20px) + env(safe-area-inset-right, 0px));
}

#wpchat-widget.wpchat-top-left {
	top: calc(var(--wpchat-offset-bottom, 20px) + env(safe-area-inset-top, 0px));
	left: calc(var(--wpchat-offset-x, 20px) + env(safe-area-inset-left, 0px));
}

@media (max-width: 768px) {
	#wpchat-widget {
		--wpchat-button-size: var(--wpchat-button-size-mobile, 56px);
		--wpchat-offset-bottom: var(--wpchat-offset-y-mobile, var(--wpchat-offset-y, 16px));
		--wpchat-offset-x: var(--wpchat-offset-x-mobile, var(--wpchat-offset-x-desktop, 16px));
	}
}

#wpchat-widget.wpchat-hold {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.wpchat-elementor {
	display: inline-block;
	max-width: 100%;
	vertical-align: middle;
}

#wpchat-widget .wpchat-button,
#wpchat-widget .wpchat-button:visited,
#wpchat-widget .wpchat-inline,
#wpchat-widget .wpchat-inline:visited,
.wpchat-elementor .wpchat-button,
.wpchat-elementor .wpchat-button:visited,
.wpchat-elementor .wpchat-inline,
.wpchat-elementor .wpchat-inline:visited {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	min-height: 48px;
	border-radius: 50%;
	background-color: var(--wpchat-primary-color, #25D366);
	color: var(--wpchat-icon-color, #fff);
	text-decoration: none;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	box-sizing: border-box;
	transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

#wpchat-widget .wpchat-button,
#wpchat-widget .wpchat-inline {
	width: 100%;
	height: 100%;
}

.wpchat-elementor a.wpchat-inline {
	width: var(--wpchat-button-size, 60px);
	height: var(--wpchat-button-size, 60px);
}

#wpchat-widget .wpchat-button:hover,
#wpchat-widget .wpchat-button:focus-visible,
#wpchat-widget .wpchat-button:visited:hover,
#wpchat-widget .wpchat-button:visited:focus-visible,
#wpchat-widget .wpchat-inline:hover,
#wpchat-widget .wpchat-inline:focus-visible,
#wpchat-widget .wpchat-inline:visited:hover,
#wpchat-widget .wpchat-inline:visited:focus-visible,
.wpchat-elementor .wpchat-button:hover,
.wpchat-elementor .wpchat-button:focus-visible,
.wpchat-elementor .wpchat-button:visited:hover,
.wpchat-elementor .wpchat-button:visited:focus-visible,
.wpchat-elementor .wpchat-inline:hover,
.wpchat-elementor .wpchat-inline:focus-visible,
.wpchat-elementor .wpchat-inline:visited:hover,
.wpchat-elementor .wpchat-inline:visited:focus-visible {
	background-color: var(--wpchat-hover-color, #128C7E);
	color: var(--wpchat-icon-hover-color, #fff);
	text-decoration: none;
}

#wpchat-widget .wpchat-button:hover,
#wpchat-widget .wpchat-inline:hover,
.wpchat-elementor .wpchat-button:hover,
.wpchat-elementor .wpchat-inline:hover {
	transform: scale(1.08);
}

#wpchat-widget .wpchat-button:focus,
.wpchat-elementor .wpchat-button:focus,
.wpchat-elementor .wpchat-text-link:focus {
	outline: none;
}

#wpchat-widget .wpchat-button:focus-visible,
.wpchat-elementor .wpchat-button:focus-visible,
.wpchat-elementor .wpchat-text-link:focus-visible {
	outline: 3px solid #0b3d2e;
	outline-offset: 3px;
}

#wpchat-widget .wpchat-button svg,
#wpchat-widget .wpchat-button svg path,
#wpchat-widget .wpchat-inline svg,
#wpchat-widget .wpchat-inline svg path,
.wpchat-elementor .wpchat-button svg,
.wpchat-elementor .wpchat-button svg path,
.wpchat-elementor .wpchat-inline svg,
.wpchat-elementor .wpchat-inline svg path,
.wpchat-elementor .wpchat-text-link svg,
.wpchat-elementor .wpchat-text-link svg path {
	fill: currentColor;
	color: inherit;
}

#wpchat-widget.wpchat-protect .wpchat-button,
#wpchat-widget.wpchat-protect .wpchat-button:visited,
#wpchat-widget.wpchat-protect .wpchat-inline,
#wpchat-widget.wpchat-protect .wpchat-inline:visited,
.wpchat-elementor.wpchat-protect .wpchat-button,
.wpchat-elementor.wpchat-protect .wpchat-button:visited,
.wpchat-elementor.wpchat-protect .wpchat-inline,
.wpchat-elementor.wpchat-protect .wpchat-inline:visited {
	background-color: var(--wpchat-primary-color, #25D366) !important;
	color: var(--wpchat-icon-color, #fff) !important;
	text-decoration: none !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

#wpchat-widget.wpchat-protect .wpchat-button:hover,
#wpchat-widget.wpchat-protect .wpchat-button:focus-visible,
#wpchat-widget.wpchat-protect .wpchat-button:visited:hover,
#wpchat-widget.wpchat-protect .wpchat-button:visited:focus-visible,
#wpchat-widget.wpchat-protect .wpchat-inline:hover,
#wpchat-widget.wpchat-protect .wpchat-inline:focus-visible,
.wpchat-elementor.wpchat-protect .wpchat-button:hover,
.wpchat-elementor.wpchat-protect .wpchat-button:focus-visible,
.wpchat-elementor.wpchat-protect .wpchat-button:visited:hover,
.wpchat-elementor.wpchat-protect .wpchat-button:visited:focus-visible,
.wpchat-elementor.wpchat-protect .wpchat-inline:hover,
.wpchat-elementor.wpchat-protect .wpchat-inline:focus-visible {
	background-color: var(--wpchat-hover-color, #128C7E) !important;
	color: var(--wpchat-icon-hover-color, #fff) !important;
	text-decoration: none !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

#wpchat-widget.wpchat-protect .wpchat-button svg,
#wpchat-widget.wpchat-protect .wpchat-button svg path,
#wpchat-widget.wpchat-protect .wpchat-inline svg,
#wpchat-widget.wpchat-protect .wpchat-inline svg path,
.wpchat-elementor.wpchat-protect .wpchat-button svg,
.wpchat-elementor.wpchat-protect .wpchat-button svg path,
.wpchat-elementor.wpchat-protect .wpchat-inline svg,
.wpchat-elementor.wpchat-protect .wpchat-inline svg path,
.wpchat-elementor.wpchat-protect .wpchat-text-link svg,
.wpchat-elementor.wpchat-protect .wpchat-text-link svg path {
	fill: currentColor !important;
	color: inherit !important;
}

.wpchat-icon {
	width: 58%;
	height: 58%;
	display: block;
}

.wpchat-tooltip {
	display: none;
}

@media (hover: hover) {
	.wpchat-tooltip {
		display: block;
		position: absolute;
		background: #333;
		color: #fff;
		padding: 8px 14px;
		border-radius: 6px;
		font-size: 14px;
		line-height: 1.3;
		white-space: nowrap;
		opacity: 0;
		pointer-events: none;
		z-index: 2;
		font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	}

	.wpchat-bottom-right .wpchat-tooltip,
	.wpchat-bottom-left .wpchat-tooltip {
		bottom: calc(100% + 12px);
	}

	.wpchat-top-right .wpchat-tooltip,
	.wpchat-top-left .wpchat-tooltip {
		top: calc(100% + 12px);
	}

	.wpchat-bottom-right .wpchat-tooltip,
	.wpchat-top-right .wpchat-tooltip {
		right: 0;
	}

	.wpchat-bottom-left .wpchat-tooltip,
	.wpchat-top-left .wpchat-tooltip {
		left: 0;
	}

	#wpchat-widget .wpchat-button:hover .wpchat-tooltip,
	#wpchat-widget .wpchat-button:focus-visible .wpchat-tooltip {
		opacity: 1;
	}
}

#wpchat-widget .wpchat-tooltip {
	color: #fff;
}

#wpchat-widget .wpchat-offline-badge {
	color: #ff4444;
	position: absolute;
	top: -2px;
	right: -2px;
	width: 16px;
	height: 16px;
	background: #fff;
	border-radius: 50%;
	display: none;
	align-items: center;
	justify-content: center;
}

.wpchat-offline .wpchat-offline-badge {
	display: flex;
}

.wpchat-pulse {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: var(--wpchat-primary-color, #25D366);
	opacity: 0.45;
	transform: translate(-50%, -50%);
	animation: wpchat-pulse-animation 2s infinite;
	pointer-events: none;
	z-index: -1;
}

@keyframes wpchat-pulse-animation {
	0% { transform: translate(-50%, -50%) scale(1); opacity: 0.45; }
	70% { transform: translate(-50%, -50%) scale(1.35); opacity: 0; }
	100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

.wpchat-offline .wpchat-pulse {
	display: none;
}

.wpchat-animation-fade { animation: wpchat-fade-in 0.5s ease; }
.wpchat-animation-bounce { animation: wpchat-bounce-in 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.wpchat-animation-slide.wpchat-bottom-right,
.wpchat-animation-slide.wpchat-top-right { animation: wpchat-slide-in-right 0.5s ease; }
.wpchat-animation-slide.wpchat-bottom-left,
.wpchat-animation-slide.wpchat-top-left { animation: wpchat-slide-in-left 0.5s ease; }

@keyframes wpchat-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes wpchat-slide-in-right {
	from { opacity: 0; transform: translateX(24px); }
	to { opacity: 1; transform: translateX(0); }
}

@keyframes wpchat-slide-in-left {
	from { opacity: 0; transform: translateX(-24px); }
	to { opacity: 1; transform: translateX(0); }
}

@keyframes wpchat-bounce-in {
	0% { opacity: 0; transform: scale(0.6); }
	60% { opacity: 1; transform: scale(1.08); }
	100% { opacity: 1; transform: scale(1); }
}

.wpchat-bubble {
	position: absolute;
	bottom: calc(100% + 12px);
	right: 0;
	width: 240px;
	max-width: 70vw;
	background: #fff;
	color: #1d2327;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
	padding: 12px 14px;
	z-index: 2;
}

.wpchat-bottom-left .wpchat-bubble,
.wpchat-top-left .wpchat-bubble {
	right: auto;
	left: 0;
}

.wpchat-top-right .wpchat-bubble,
.wpchat-top-left .wpchat-bubble {
	bottom: auto;
	top: calc(100% + 12px);
}

.wpchat-bubble-text {
	margin: 0 0 8px;
	font-size: 14px;
	line-height: 1.4;
}

.wpchat-dept-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

#wpchat-widget .wpchat-dept-list a,
#wpchat-widget .wpchat-dept-list a:visited,
#wpchat-widget .wpchat-dept-list a:hover,
#wpchat-widget .wpchat-dept-list a:focus-visible {
	display: block;
	padding: 8px 0;
	color: #128C7E;
	font-weight: 600;
	text-decoration: none;
	background-color: transparent;
	box-shadow: none;
}

#wpchat-widget.wpchat-protect .wpchat-dept-list a,
#wpchat-widget.wpchat-protect .wpchat-dept-list a:visited,
#wpchat-widget.wpchat-protect .wpchat-dept-list a:hover,
#wpchat-widget.wpchat-protect .wpchat-dept-list a:focus-visible {
	color: #128C7E !important;
	background-color: transparent !important;
	text-decoration: none !important;
	box-shadow: none !important;
}

.wpchat-elementor .wpchat-text-link,
.wpchat-elementor .wpchat-text-link:visited {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--wpchat-primary-color, #25D366);
	font-weight: 600;
	text-decoration: none;
	background-color: transparent;
	box-shadow: none;
}

.wpchat-elementor .wpchat-text-link .wpchat-icon {
	width: 1.25em;
	height: 1.25em;
	color: currentColor;
}

.wpchat-elementor .wpchat-text-link:hover,
.wpchat-elementor .wpchat-text-link:focus-visible,
.wpchat-elementor .wpchat-text-link:visited:hover,
.wpchat-elementor .wpchat-text-link:visited:focus-visible {
	color: var(--wpchat-hover-color, #128C7E);
	text-decoration: none;
	background-color: transparent;
}

.wpchat-elementor.wpchat-protect .wpchat-text-link,
.wpchat-elementor.wpchat-protect .wpchat-text-link:visited {
	color: var(--wpchat-primary-color, #25D366) !important;
	text-decoration: none !important;
	background-color: transparent !important;
	box-shadow: none !important;
}

.wpchat-elementor.wpchat-protect .wpchat-text-link:hover,
.wpchat-elementor.wpchat-protect .wpchat-text-link:focus-visible,
.wpchat-elementor.wpchat-protect .wpchat-text-link:visited:hover {
	color: var(--wpchat-hover-color, #128C7E) !important;
	text-decoration: none !important;
	background-color: transparent !important;
}

@media (prefers-reduced-motion: reduce) {
	#wpchat-widget,
	#wpchat-widget .wpchat-button,
	#wpchat-widget .wpchat-inline,
	.wpchat-elementor .wpchat-button,
	.wpchat-elementor .wpchat-inline,
	.wpchat-pulse,
	.wpchat-icon {
		animation: none !important;
		transition: none !important;
	}

	#wpchat-widget .wpchat-button:hover,
	#wpchat-widget .wpchat-inline:hover,
	.wpchat-elementor .wpchat-button:hover,
	.wpchat-elementor .wpchat-inline:hover {
		transform: none;
	}

	.wpchat-pulse {
		display: none !important;
	}
}

@media print {
	#wpchat-widget {
		display: none !important;
	}
}
