/* Floating WhatsApp button and optional greeting bubble. */
.ag-whatsapp-float {
	position: fixed;
	right: max(16px, env(safe-area-inset-right));
	bottom: calc(16px + env(safe-area-inset-bottom));
	z-index: 20;
	display: inline-flex;
	width: 56px;
	height: 56px;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: #25D366;
	box-shadow: 0 3px 12px rgb(0 0 0 / 22%);
	color: #fff;
	text-decoration: none;
	transition: transform 160ms ease, box-shadow 160ms ease;
}

.ag-whatsapp-float[hidden] {
	display: none !important;
}

.ag-whatsapp-loader-status {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ag-whatsapp-float svg {
	display: block;
	width: 30px;
	height: 30px;
	fill: currentColor;
}

.ag-whatsapp-float:hover {
	transform: translateY(-2px);
	box-shadow: 0 5px 16px rgb(0 0 0 / 26%);
	color: #fff;
}

.ag-whatsapp-float:focus-visible {
	outline: 3px solid #173b2a;
	outline-offset: 3px;
}

.ag-whatsapp-greeting {
	position: fixed;
	right: max(16px, env(safe-area-inset-right));
	bottom: calc(82px + env(safe-area-inset-bottom));
	z-index: 21;
	display: flex;
	width: min(286px, calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
	align-items: flex-start;
	gap: 8px;
	padding: 12px 10px 12px 14px;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 4px 18px rgb(0 0 0 / 18%);
	color: #202820;
	animation: ag-whatsapp-greeting-in 180ms ease-out both;
}

.ag-whatsapp-greeting__link {
	display: flex;
	min-width: 0;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 3px;
	border-radius: 5px;
	color: inherit;
	font-size: 14px;
	line-height: 1.35;
	text-decoration: none;
}

.ag-whatsapp-greeting__link:hover {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: #25D366;
	text-underline-offset: 2px;
}

.ag-whatsapp-greeting__link:focus-visible,
.ag-whatsapp-greeting__close:focus-visible {
	outline: 2px solid #176b39;
	outline-offset: 2px;
}

.ag-whatsapp-greeting__title {
	font-size: 15px;
	font-weight: 700;
}

.ag-whatsapp-greeting__message {
	font-weight: 400;
}

.ag-whatsapp-greeting__close {
	display: inline-flex;
	width: 30px;
	height: 30px;
	flex: 0 0 30px;
	align-items: center;
	justify-content: center;
	margin: -4px -4px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #39433b;
	font: inherit;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

@keyframes ag-whatsapp-greeting-in {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 767px) {
	.ag-whatsapp-float {
		/* Dejar libres menú inferior e iconos; recalibrar tras verificar su alto real en staging. */
		bottom: calc(76px + env(safe-area-inset-bottom));
		width: 60px;
		height: 60px;
	}

	/* Clientify V2 monta el launcher cerrado en un iframe srcdoc de 80 × 80 px.
	   Elevar solo ese estado evita desplazar/recortar el panel cuando está abierto. */
	body > iframe[srcdoc*="widget-whatsapp2.0"][style*="width: 80px"][style*="height: 80px"] {
		bottom: calc(88px + env(safe-area-inset-bottom)) !important;
	}

	.ag-whatsapp-greeting {
		bottom: calc(146px + env(safe-area-inset-bottom));
		width: min(286px, calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
	}
}

@media (prefers-reduced-motion: reduce) {
	.ag-whatsapp-float {
		transition: none;
	}
	.ag-whatsapp-float:hover {
		transform: none;
	}
	.ag-whatsapp-greeting {
		animation: none;
	}
}
