:root {
	--wwcw-brand-color: #25D366;
}

/*
 * I temi (es. Hello Elementor) applicano spesso reset globali del tipo
 * "[type=button], button { border-radius:3px; border:1px solid ... }".
 * Quel selettore ha la stessa specificità di una singola classe e, caricato
 * dopo il CSS del plugin, vincerebbe. Per questo tutte le regole sotto sono
 * ancorate a #wwcw-widget (specificità basata su ID) e i pulsanti passano
 * prima da "all: unset" per azzerare qualsiasi stile ereditato dal tema.
 */
#wwcw-widget,
#wwcw-widget *,
#wwcw-widget *::before,
#wwcw-widget *::after {
	box-sizing: border-box;
}

/* ---------- Widget flottante ---------- */
#wwcw-widget.wwcw-widget {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: normal;
}

#wwcw-widget.wwcw-position-right {
	right: 20px;
}

#wwcw-widget.wwcw-position-left {
	left: 20px;
}

#wwcw-widget .wwcw-toggle-btn {
	all: unset;
	box-sizing: border-box;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--wwcw-brand-color);
	color: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	position: relative;
	z-index: 2;
}

#wwcw-widget .wwcw-toggle-btn:hover {
	filter: brightness(0.95);
}

#wwcw-widget .wwcw-toggle-btn svg {
	width: 30px;
	height: 30px;
}

#wwcw-widget .wwcw-toggle-icon-close {
	display: none;
}

#wwcw-widget.wwcw-open .wwcw-toggle-icon-open {
	display: none;
}

#wwcw-widget.wwcw-open .wwcw-toggle-icon-close {
	display: flex;
}

@media (prefers-reduced-motion: no-preference) {
	#wwcw-widget .wwcw-toggle-btn::after {
		content: "";
		position: absolute;
		inset: 0;
		border-radius: 50%;
		box-shadow: 0 0 0 0 var(--wwcw-brand-color);
		animation: wwcw-pulse 2.5s infinite;
		pointer-events: none;
	}

	#wwcw-widget.wwcw-open .wwcw-toggle-btn::after {
		animation: none;
		box-shadow: none;
	}
}

@keyframes wwcw-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.45);
	}
	70% {
		box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
	}
}

/* ---------- Finestra di chat ---------- */
#wwcw-widget .wwcw-popup {
	position: absolute;
	bottom: 76px;
	width: 320px;
	max-width: calc(100vw - 40px);
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
	overflow: hidden;
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
	margin: 0;
	list-style: none;
}

#wwcw-widget.wwcw-position-right .wwcw-popup {
	right: 0;
}

#wwcw-widget.wwcw-position-left .wwcw-popup {
	left: 0;
}

#wwcw-widget.wwcw-open .wwcw-popup {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

#wwcw-widget .wwcw-popup-header {
	background: var(--wwcw-brand-color);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
}

#wwcw-widget .wwcw-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.25);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex-shrink: 0;
}

#wwcw-widget .wwcw-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

#wwcw-widget .wwcw-avatar svg {
	width: 24px;
	height: 24px;
}

#wwcw-widget .wwcw-header-text {
	flex: 1;
	min-width: 0;
}

#wwcw-widget .wwcw-header-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: #fff;
}

#wwcw-widget .wwcw-header-subtitle {
	margin: 2px 0 0;
	font-size: 12px;
	opacity: 0.9;
	display: flex;
	align-items: center;
	gap: 5px;
	color: #fff;
}

#wwcw-widget .wwcw-online-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b6ffb0;
	display: inline-block;
}

#wwcw-widget .wwcw-popup-close {
	all: unset;
	box-sizing: border-box;
	color: #fff;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.9;
}

#wwcw-widget .wwcw-popup-close:hover {
	opacity: 1;
}

#wwcw-widget .wwcw-popup-close svg {
	width: 16px;
	height: 16px;
}

#wwcw-widget .wwcw-popup-body {
	padding: 16px;
	background: #ECE5DD;
	margin: 0;
}

#wwcw-widget .wwcw-chat-bubble {
	background: #fff;
	border-radius: 10px;
	border-top-left-radius: 2px;
	padding: 10px 12px;
	font-size: 13.5px;
	line-height: 1.4;
	color: #111;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
	margin: 0;
}

#wwcw-widget .wwcw-popup-footer {
	padding: 12px 16px 16px;
	background: #ECE5DD;
	margin: 0;
}

#wwcw-widget .wwcw-start-chat {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: var(--wwcw-brand-color);
	color: #fff;
	font-weight: 600;
	font-size: 14px;
	padding: 11px 16px;
	border-radius: 8px;
	cursor: pointer;
	transition: filter 0.15s ease;
}

#wwcw-widget .wwcw-start-chat:hover {
	filter: brightness(0.95);
	color: #fff;
}

#wwcw-widget .wwcw-start-chat svg {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

@media (max-width: 480px) {
	#wwcw-widget .wwcw-popup {
		width: calc(100vw - 32px);
	}
}

/*
 * ---------- Pulsanti inline (shortcode / blocco) ----------
 * Questi pulsanti vivono nel contenuto della pagina (non dentro #wwcw-widget),
 * quindi non possono contare sulla specificità dell'ID: le proprietà chiave
 * usano !important per resistere ai reset generici dei temi su "a"/"button".
 */
.wwcw-inline-btn {
	box-sizing: border-box;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px;
	text-decoration: none !important;
	font-weight: 600;
	border-radius: 8px !important;
	border: 2px solid var(--wwcw-brand-color) !important;
	cursor: pointer;
	line-height: 1.2;
	vertical-align: middle;
	font-family: inherit;
}

.wwcw-inline-btn .wwcw-icon svg {
	display: block;
}

.wwcw-inline-btn.wwcw-style-filled {
	background: var(--wwcw-brand-color) !important;
	color: #fff !important;
}

.wwcw-inline-btn.wwcw-style-filled:hover {
	filter: brightness(0.95);
	color: #fff !important;
}

.wwcw-inline-btn.wwcw-style-outline {
	background: transparent !important;
	color: var(--wwcw-brand-color) !important;
}

.wwcw-inline-btn.wwcw-style-outline:hover {
	background: rgba(37, 211, 102, 0.08) !important;
}

.wwcw-inline-btn.wwcw-style-icon {
	border-radius: 50% !important;
	padding: 0;
	background: var(--wwcw-brand-color) !important;
	color: #fff !important;
}

.wwcw-inline-btn.wwcw-size-small {
	padding: 6px 12px;
	font-size: 13px;
}

.wwcw-inline-btn.wwcw-size-small .wwcw-icon svg {
	width: 16px;
	height: 16px;
}

.wwcw-inline-btn.wwcw-style-icon.wwcw-size-small {
	width: 34px;
	height: 34px;
}

.wwcw-inline-btn.wwcw-size-medium {
	padding: 10px 18px;
	font-size: 14px;
}

.wwcw-inline-btn.wwcw-size-medium .wwcw-icon svg {
	width: 20px;
	height: 20px;
}

.wwcw-inline-btn.wwcw-style-icon.wwcw-size-medium {
	width: 46px;
	height: 46px;
}

.wwcw-inline-btn.wwcw-size-large {
	padding: 14px 24px;
	font-size: 16px;
}

.wwcw-inline-btn.wwcw-size-large .wwcw-icon svg {
	width: 24px;
	height: 24px;
}

.wwcw-inline-btn.wwcw-style-icon.wwcw-size-large {
	width: 56px;
	height: 56px;
}

.wwcw-block-preview {
	pointer-events: none;
}
