/* Botón flotante de WhatsApp (inc/whatsapp.php) */
.cm-wa {
	--wa-green: #25d366;
	--wa-green-dark: #1da851;
	--wa-bg: #effbf3;
	position: fixed;
	bottom: 20px;
	z-index: 9990;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.4;
}
.cm-wa--right { right: 20px; }
.cm-wa--left { left: 20px; align-items: flex-start; }

/* Lanzador: texto + icono */
.cm-wa__launcher {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	opacity: 0;
	transform: translateY(20px) scale(.9);
	transition: opacity .35s ease, transform .35s ease;
}
.cm-wa--left .cm-wa__launcher { flex-direction: row-reverse; }
.cm-wa.is-ready .cm-wa__launcher { opacity: 1; transform: none; }
.cm-wa__label {
	position: relative;
	padding: 10px 16px;
	background: #fff;
	color: #1f2937;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
	border-radius: 999px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.cm-wa__icon {
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	flex: 0 0 60px;
	color: #fff;
	background: var(--wa-green);
	border-radius: 50%;
	box-shadow: 0 6px 20px rgba(37, 211, 102, .45);
	transition: transform .2s ease, background .2s ease;
}
.cm-wa__icon svg { width: 34px; height: 34px; }
.cm-wa__launcher:hover .cm-wa__icon,
.cm-wa__launcher:focus-visible .cm-wa__icon { transform: scale(1.08); background: var(--wa-green-dark); }
.cm-wa__launcher:focus-visible { outline: 3px solid var(--wa-green); outline-offset: 4px; border-radius: 999px; }
.cm-wa.is-open .cm-wa__label { display: none; }

/* Ventana de chat */
.cm-wa__chat {
	width: min(370px, calc(100vw - 32px));
	overflow: hidden;
	background: var(--wa-bg);
	border-radius: 24px;
	box-shadow: 0 16px 50px rgba(0, 0, 0, .3);
	transform-origin: bottom right;
	animation: cm-wa-in .3s ease both;
}
.cm-wa--left .cm-wa__chat { transform-origin: bottom left; }
.cm-wa__chat[hidden] { display: none; }
.cm-wa__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px 16px 22px;
	color: #fff;
	background: var(--wa-green);
}
.cm-wa__brand { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 700; }
.cm-wa__close {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	color: #fff;
	background: rgba(0, 0, 0, .22);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}
.cm-wa__close:hover { background: rgba(0, 0, 0, .35); }
.cm-wa__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	max-height: min(420px, 55vh);
	padding: 22px 22px 8px 26px;
	overflow-y: auto;
}
.cm-wa__bubble {
	position: relative;
	max-width: 88%;
	padding: 12px 20px;
	color: #303030;
	font-size: 16px;
	background: #fff;
	border-radius: 22px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
	animation: cm-wa-bubble .35s ease both;
	animation-delay: calc(var(--i) * .35s + .15s);
}
.cm-wa__bubble::before {
	content: "";
	position: absolute;
	left: -10px;
	bottom: 14px;
	border: 8px solid transparent;
	border-right: 12px solid #fff;
	border-left: 0;
	filter: drop-shadow(-2px 1px 1px rgba(0, 0, 0, .06));
}
.cm-wa__bubble strong { color: #1f1f1f; }
.cm-wa__bubble--media { padding: 16px 30px; }
.cm-wa__bubble--media img,
.cm-wa__bubble--media svg { display: block; width: 130px; height: auto; }
.cm-wa-thumb { animation: cm-wa-thumb 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
.cm-wa-eye { animation: cm-wa-blink 4s infinite; transform-box: fill-box; transform-origin: center; }
.cm-wa__footer { display: flex; justify-content: flex-end; padding: 10px 14px 18px; }
.cm-wa__open {
	display: inline-flex;
	align-items: center;
	gap: 14px;
	padding: 10px 12px 10px 24px;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	text-decoration: none;
	background: var(--wa-green);
	border-radius: 999px;
	box-shadow: 0 4px 14px rgba(37, 211, 102, .4);
	transition: background .2s ease;
}
.cm-wa__open:hover,
.cm-wa__open:focus-visible { color: #fff; background: var(--wa-green-dark); }

@keyframes cm-wa-in { from { opacity: 0; transform: translateY(16px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes cm-wa-bubble { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cm-wa-thumb { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-8deg) translateY(-4px); } 60% { transform: rotate(4deg); } }
@keyframes cm-wa-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }

@media (max-width: 480px) {
	.cm-wa { bottom: 14px; }
	.cm-wa--right { right: 14px; }
	.cm-wa--left { left: 14px; }
	.cm-wa__label { font-size: 14px; padding: 8px 14px; }
	.cm-wa__icon { width: 54px; height: 54px; flex-basis: 54px; }
}

@media (prefers-reduced-motion: reduce) {
	.cm-wa *, .cm-wa__launcher { animation: none !important; transition: none !important; }
}

/* Mientras se ve el aviso de cookies, el botón espera para no taparlo */
body:has(.cookie-banner:not([hidden])) .cm-wa { display: none; }

@media print { .cm-wa { display: none; } }
