/**
 * Herrera Corporativo - WhatsApp Flotante
 * Las variables --hcwa-* se inyectan en línea desde los ajustes del plugin.
 */

.hcwa-widget {
	position: fixed;
	/* --hcwa-stack-y lo calcula el script para no encimarse con otros botones fijos. */
	bottom: calc( var( --hcwa-offset-y, 24px ) + var( --hcwa-stack-y, 0px ) );
	/* Por encima del "back to top" de Royal Elementor Addons (z-index 9999). */
	z-index: 99990;
	display: flex;
	align-items: center;
	gap: 12px;
	line-height: 1;
	transition: bottom 0.2s ease;
}

.hcwa-pos-bottom-right {
	right: var( --hcwa-offset-x, 24px );
	flex-direction: row-reverse;
}

.hcwa-pos-bottom-left {
	left: var( --hcwa-offset-x, 24px );
	flex-direction: row;
}

/* Mientras el script mide la esquina, sin animar el reposicionamiento. */
.hcwa-widget.hcwa-measuring {
	transition: none;
}

/* Oculto por JS: fuera de horario, o sin número disponible. */
.hcwa-widget.hcwa-is-hidden {
	display: none;
}

/*
 * Solo cuando el ajuste "fuera de horario" es "ocultar" hace falta esperar al
 * script; así, si el JS falla, el botón sigue visible en el resto de casos.
 */
.hcwa-widget.hcwa-cloak:not( .hcwa-ready ) {
	display: none;
}

/* Botón */

.hcwa-button {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var( --hcwa-size, 60px );
	height: var( --hcwa-size, 60px );
	border-radius: var( --hcwa-radius, 50% );
	background-color: var( --hcwa-bg, #25d366 );
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.22 );
	text-decoration: none;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	-webkit-tap-highlight-color: transparent;
}

.hcwa-button:hover,
.hcwa-button:focus,
.hcwa-button:visited {
	text-decoration: none;
	background-color: var( --hcwa-bg, #25d366 );
}

.hcwa-button:focus-visible {
	outline: 3px solid var( --hcwa-bg, #25d366 );
	outline-offset: 3px;
}

.hcwa-icon {
	position: relative;
	z-index: 1;
	/* El glifo es más alto que ancho (448x512): se dimensiona por altura. */
	height: 56%;
	width: auto;
	fill: var( --hcwa-icon, #fff );
	display: block;
}

/* Etiqueta lateral */

.hcwa-label {
	background: #fff;
	color: #1f2937;
	font-size: 14px;
	font-weight: 600;
	padding: 9px 14px;
	border-radius: 8px;
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.16 );
	white-space: nowrap;
}

/* Efecto al interactuar */

.hcwa-has-hover .hcwa-button:hover,
.hcwa-has-hover .hcwa-button:focus-visible {
	transform: scale( 1.08 );
	box-shadow: 0 8px 22px rgba( 0, 0, 0, 0.28 );
}

.hcwa-has-hover .hcwa-button:active {
	transform: scale( 0.96 );
}

/* Animaciones */

.hcwa-pulse {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background-color: var( --hcwa-bg, #25d366 );
	opacity: 0;
	z-index: 0;
}

.hcwa-anim-pulse .hcwa-pulse {
	animation: hcwa-pulse 2.2s cubic-bezier( 0.4, 0, 0.6, 1 ) infinite;
}

@keyframes hcwa-pulse {
	0% {
		transform: scale( 1 );
		opacity: 0.55;
	}
	70% {
		transform: scale( 1.7 );
		opacity: 0;
	}
	100% {
		transform: scale( 1.7 );
		opacity: 0;
	}
}

.hcwa-anim-heartbeat .hcwa-button {
	animation: hcwa-heartbeat 2.4s ease-in-out infinite;
}

@keyframes hcwa-heartbeat {
	0%, 55%, 100% {
		transform: scale( 1 );
	}
	10% {
		transform: scale( 1.12 );
	}
	20% {
		transform: scale( 1 );
	}
	30% {
		transform: scale( 1.12 );
	}
	40% {
		transform: scale( 1 );
	}
}

.hcwa-anim-bounce .hcwa-button {
	animation: hcwa-bounce 2.4s ease-in-out infinite;
}

@keyframes hcwa-bounce {
	0%, 60%, 100% {
		transform: translateY( 0 );
	}
	70% {
		transform: translateY( -14px );
	}
	80% {
		transform: translateY( 0 );
	}
	90% {
		transform: translateY( -6px );
	}
}

.hcwa-anim-shake .hcwa-button {
	animation: hcwa-shake 3s ease-in-out infinite;
}

@keyframes hcwa-shake {
	0%, 70%, 100% {
		transform: rotate( 0deg );
	}
	75% {
		transform: rotate( -12deg );
	}
	80% {
		transform: rotate( 10deg );
	}
	85% {
		transform: rotate( -8deg );
	}
	90% {
		transform: rotate( 6deg );
	}
	95% {
		transform: rotate( -3deg );
	}
}

/*
 * El efecto de interacción debe ganarle a la animación en reposo: si no, la
 * transformación del keyframe pisa el escalado del hover.
 */
.hcwa-has-hover .hcwa-button:hover,
.hcwa-has-hover .hcwa-button:focus-visible,
.hcwa-has-hover .hcwa-button:active {
	animation-play-state: paused;
}

/* Visibilidad por dispositivo */

@media ( max-width: 767px ) {
	.hcwa-widget.hcwa-hide-mobile {
		display: none;
	}

	.hcwa-label {
		display: none;
	}
}

@media ( min-width: 768px ) {
	.hcwa-widget.hcwa-hide-desktop {
		display: none;
	}
}

/* Accesibilidad: sin movimiento si el visitante lo pidió. */

@media ( prefers-reduced-motion: reduce ) {
	.hcwa-button,
	.hcwa-pulse {
		animation: none !important;
	}

	.hcwa-button {
		transition: none;
	}
}
