/**
 * Smart Sites CRM · WhatsApp: el bloque «Botón de WhatsApp» y el botón flotante con su ventana de chat.
 *
 * Los colores llegan de Smart CRM → WhatsApp como variables (--scrm-wa-fondo y --scrm-wa-texto, en :root). Un color
 * elegido en el bloque desde el editor las reemplaza (las clases de la paleta llevan !important). La forma, la letra y
 * el relleno del bloque son los de los botones del tema (.wp-element-button); aquí van solo el color y el tamaño.
 * Las reglas nombran las dos clases: los estilos globales de un tema de bloques (:root :where(.wp-element-button))
 * pesan lo mismo que una clase y se imprimen después.
 */

/* --- El bloque --- */
.scrm-wa-boton.wp-element-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .55em;
	background-color: var(--scrm-wa-fondo, #25D366);
	color: var(--scrm-wa-texto, #111827);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

.scrm-wa-boton.wp-element-button:hover,
.scrm-wa-boton.wp-element-button:focus-visible {
	background-color: var(--scrm-wa-fondo, #25D366);
	color: var(--scrm-wa-texto, #111827);
	filter: brightness(.94);
	text-decoration: none;
}

.scrm-wa-boton .scrm-wa-icono,
.scrm-wa-boton__icono svg {
	display: block;
	flex: none;
	width: 1.3em;
	height: 1.3em;
	fill: currentColor;
}

.scrm-wa-boton__icono {
	display: inline-flex;
}

.scrm-wa-boton--grande.wp-element-button {
	padding: 1.05em 1.75em;
	font-size: 1.0625em;
}

.scrm-wa-boton--ancho.wp-element-button {
	display: flex;
	width: 100%;
	box-sizing: border-box;
}

/* --- El flotante --- */
.scrm-wa {
	position: fixed;
	z-index: 9990;
	right: 20px;
	bottom: calc(20px + env(safe-area-inset-bottom, 0px));
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	max-width: calc(100vw - 40px);
	font-family: inherit;
	line-height: 1.4;
}

.scrm-wa--izquierda {
	right: auto;
	left: 20px;
	align-items: flex-start;
}

.scrm-wa [hidden] {
	display: none !important;
}

.scrm-wa .scrm-wa-icono {
	display: block;
	fill: currentColor;
}

.scrm-wa__boton {
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--scrm-wa-fondo, #25D366);
	color: var(--scrm-wa-texto, #111827);
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	text-decoration: none;
	cursor: pointer;
	transition: transform .15s ease;
}

.scrm-wa .scrm-wa__boton:hover {
	transform: scale(1.05);
	color: var(--scrm-wa-texto, #111827);
}

/* Los enlaces del flotante, sin el color ni el subrayado de los enlaces del tema. */
.scrm-wa .scrm-wa__boton,
.scrm-wa .scrm-wa__abrir,
.scrm-wa .scrm-wa__abrir:hover,
.scrm-wa .scrm-wa__abrir:focus {
	color: var(--scrm-wa-texto, #111827);
	text-decoration: none;
}

.scrm-wa__boton:focus-visible,
.scrm-wa__abrir:focus-visible,
.scrm-wa button:focus-visible {
	outline: 3px solid var(--scrm-wa-fondo, #25D366);
	outline-offset: 3px;
}

.scrm-wa__boton .scrm-wa-icono {
	width: 30px;
	height: 30px;
}

.scrm-wa--abierto .scrm-wa__boton {
	transform: none;
}

/* Los botones de cerrar y el texto del globo: sin los estilos de botón del tema. */
.scrm-wa button {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
}

.scrm-wa__globo {
	position: relative;
	display: flex;
	align-items: flex-start;
	max-width: 260px;
	padding: 11px 6px 11px 14px;
	border-radius: 14px;
	background: #FFFFFF;
	color: #111827;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
	font-size: 14.5px;
}

.scrm-wa__globo-texto {
	flex: 1;
	text-align: left;
	font-weight: 600;
}

.scrm-wa__globo-cerrar,
.scrm-wa__cerrar {
	display: grid;
	place-items: center;
	flex: none;
	width: 28px;
	height: 28px;
	border-radius: 50%;
}

.scrm-wa__globo-cerrar {
	margin: -5px 0 -5px 4px;
	color: #6B7280;
}

.scrm-wa__globo-cerrar svg,
.scrm-wa__cerrar svg {
	width: 16px;
	height: 16px;
}

.scrm-wa__globo-cerrar:hover {
	background: #F3F4F6;
}

.scrm-wa__chat {
	width: min(340px, calc(100vw - 40px));
	overflow: hidden;
	border-radius: 16px;
	background: #FFFFFF;
	color: #111827;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
}

.scrm-wa__cabeza {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 12px 14px 16px;
	background: var(--scrm-wa-fondo, #25D366);
	color: var(--scrm-wa-texto, #111827);
}

.scrm-wa__avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .35);
}

.scrm-wa__avatar .scrm-wa-icono {
	width: 22px;
	height: 22px;
}

.scrm-wa__titulos {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.scrm-wa__nombre {
	font-size: 15.5px;
	font-weight: 700;
}

.scrm-wa__sub {
	font-size: 12.5px;
	opacity: .85;
}

.scrm-wa__cerrar:hover {
	background: rgba(0, 0, 0, .08);
}

.scrm-wa__cuerpo {
	padding: 20px 16px;
	background: #EFEAE2;
}

.scrm-wa__mensaje {
	display: inline-block;
	max-width: 88%;
	margin: 0;
	padding: 10px 13px;
	border-radius: 0 12px 12px 12px;
	background: #FFFFFF;
	box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
	font-size: 14.5px;
	line-height: 1.45;
}

.scrm-wa__abrir {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 14px 16px 16px;
	padding: 13px 18px;
	border-radius: 999px;
	background: var(--scrm-wa-fondo, #25D366);
	color: var(--scrm-wa-texto, #111827);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
}

.scrm-wa__abrir:hover {
	color: var(--scrm-wa-texto, #111827);
	filter: brightness(.94);
}

.scrm-wa__abrir .scrm-wa-icono {
	width: 20px;
	height: 20px;
}

@media (max-width: 767px) {
	.scrm-wa {
		right: 16px;
		bottom: calc(16px + env(safe-area-inset-bottom, 0px));
		max-width: calc(100vw - 32px);
	}

	.scrm-wa--izquierda {
		left: 16px;
	}

	.scrm-wa__boton {
		width: 56px;
		height: 56px;
	}

	.scrm-wa__chat {
		width: min(340px, calc(100vw - 32px));
	}

	.scrm-wa--sin-movil {
		display: none;
	}
}

@media (min-width: 768px) {
	.scrm-wa--sin-escritorio {
		display: none;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.scrm-wa__globo,
	.scrm-wa__chat {
		animation: scrm-wa-entra .22s ease-out;
	}
}

@media (prefers-reduced-motion: reduce) {
	.scrm-wa__boton {
		transition: none;
	}
}

@keyframes scrm-wa-entra {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

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