/**
 * Beyond WhatsApp — estilos del widget flotante.
 */

/* Valores por defecto. El plugin los sobrescribe con los ajustes guardados. */
:root {
	--beyondwa-main: #25D366;
	--beyondwa-header: #25D366;
	--beyondwa-header-txt: #FFFFFF;
	--beyondwa-body-bg: #EEF6F0;
	--beyondwa-bubble-bg: #FFFFFF;
	--beyondwa-bubble-txt: #111B21;
	--beyondwa-cta: #25D366;
	--beyondwa-cta-txt: #FFFFFF;
	--beyondwa-size: 64px;
	--beyondwa-x: 24px;
	--beyondwa-y: 24px;
	--beyondwa-x-mobile: 16px;
	--beyondwa-y-mobile: 16px;
	--beyondwa-z: 99999;
}

.beyondwa-widget {
	position: fixed;
	z-index: var(--beyondwa-z);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.4;
	box-sizing: border-box;
}

.beyondwa-widget *,
.beyondwa-widget *::before,
.beyondwa-widget *::after {
	box-sizing: border-box;
}

/* --- Posiciones --------------------------------------------------------- */

.beyondwa-pos-bottom-right {
	right: var(--beyondwa-x);
	bottom: var(--beyondwa-y);
	align-items: flex-end;
}

.beyondwa-pos-bottom-left {
	left: var(--beyondwa-x);
	bottom: var(--beyondwa-y);
	align-items: flex-start;
}

.beyondwa-pos-top-right {
	right: var(--beyondwa-x);
	top: var(--beyondwa-y);
	flex-direction: column-reverse;
	align-items: flex-end;
}

.beyondwa-pos-top-left {
	left: var(--beyondwa-x);
	top: var(--beyondwa-y);
	flex-direction: column-reverse;
	align-items: flex-start;
}

.beyondwa-pos-middle-right {
	right: var(--beyondwa-x);
	top: 50%;
	transform: translateY(-50%);
	align-items: flex-end;
}

.beyondwa-pos-middle-left {
	left: var(--beyondwa-x);
	top: 50%;
	transform: translateY(-50%);
	align-items: flex-start;
}

/* --- Botón flotante ----------------------------------------------------- */

.beyondwa-fab {
	position: relative;
	width: var(--beyondwa-size);
	height: var(--beyondwa-size);
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--beyondwa-main);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
	transition: transform .18s ease, box-shadow .18s ease;
	-webkit-tap-highlight-color: transparent;
	appearance: none;
}

.beyondwa-fab:hover,
.beyondwa-fab:focus-visible {
	transform: scale(1.06);
	box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}

.beyondwa-fab:focus-visible {
	outline: 3px solid rgba(255, 255, 255, .9);
	outline-offset: 3px;
}

.beyondwa-fab .beyondwa-icon {
	width: 58%;
	height: 58%;
	display: block;
}

/* Pulso */
.beyondwa-has-pulse .beyondwa-fab::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--beyondwa-main);
	opacity: .55;
	z-index: -1;
	animation: beyondwa-pulse 2.4s cubic-bezier(.25, .8, .35, 1) infinite;
}

@keyframes beyondwa-pulse {
	0% { transform: scale(1); opacity: .5; }
	70% { transform: scale(1.7); opacity: 0; }
	100% { transform: scale(1.7); opacity: 0; }
}

.beyondwa-is-open .beyondwa-fab::after {
	display: none;
}

/* --- Ventana ------------------------------------------------------------ */

.beyondwa-panel {
	width: 360px;
	max-width: calc(100vw - 32px);
	border-radius: 22px;
	overflow: hidden;
	background: var(--beyondwa-body-bg);
	box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
	opacity: 0;
	transform: translateY(12px) scale(.96);
	transform-origin: bottom right;
	transition: opacity .2s ease, transform .2s ease;
	pointer-events: none;
}

.beyondwa-pos-bottom-left .beyondwa-panel,
.beyondwa-pos-middle-left .beyondwa-panel {
	transform-origin: bottom left;
}

.beyondwa-pos-top-right .beyondwa-panel {
	transform-origin: top right;
	transform: translateY(-12px) scale(.96);
}

.beyondwa-pos-top-left .beyondwa-panel {
	transform-origin: top left;
	transform: translateY(-12px) scale(.96);
}

.beyondwa-is-open .beyondwa-panel,
.beyondwa-is-preview .beyondwa-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.beyondwa-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 16px 16px 20px;
	background: var(--beyondwa-header);
	color: var(--beyondwa-header-txt);
}

.beyondwa-brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.beyondwa-brand .beyondwa-icon {
	width: 30px;
	height: 30px;
	flex: 0 0 auto;
}

.beyondwa-brand-txt {
	font-size: 21px;
	font-weight: 700;
	letter-spacing: -.01em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.beyondwa-close {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .18);
	color: currentColor;
	cursor: pointer;
	transition: background .15s ease;
	appearance: none;
}

.beyondwa-close:hover,
.beyondwa-close:focus-visible {
	background: rgba(0, 0, 0, .3);
}

.beyondwa-close svg {
	width: 18px;
	height: 18px;
	display: block;
}

.beyondwa-panel-body {
	padding: 22px 20px 20px;
	background:
		radial-gradient(circle at 18% 22%, rgba(0, 0, 0, .022) 0 2px, transparent 2px),
		radial-gradient(circle at 72% 68%, rgba(0, 0, 0, .022) 0 2px, transparent 2px),
		var(--beyondwa-body-bg);
	background-size: 46px 46px, 46px 46px, auto;
}

.beyondwa-bubble {
	position: relative;
	display: inline-block;
	max-width: 90%;
	padding: 14px 18px;
	border-radius: 4px 16px 16px 16px;
	background: var(--beyondwa-bubble-bg);
	color: var(--beyondwa-bubble-txt);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
	font-size: 15px;
}

.beyondwa-bubble::before {
	content: "";
	position: absolute;
	top: 0;
	left: -8px;
	width: 0;
	height: 0;
	border-top: 10px solid var(--beyondwa-bubble-bg);
	border-left: 9px solid transparent;
}

.beyondwa-line {
	display: block;
}

.beyondwa-line + .beyondwa-line {
	margin-top: 6px;
}

.beyondwa-line:empty {
	display: none;
}

.beyondwa-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	float: right;
	clear: both;
	margin-top: 26px;
	padding: 15px 26px;
	border-radius: 999px;
	background: var(--beyondwa-cta);
	color: var(--beyondwa-cta-txt);
	font-size: 17px;
	font-weight: 700;
	text-decoration: none;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
	transition: transform .15s ease, filter .15s ease;
}

.beyondwa-cta:hover,
.beyondwa-cta:focus-visible {
	transform: translateY(-1px);
	filter: brightness(1.05);
}

/*
 * Muchos temas definen el color de los enlaces con selectores muy
 * específicos (.entry-content a, #page a...) y teñían el texto y el icono
 * del botón. Se refuerza aquí para que mande siempre el ajuste del plugin.
 */
.beyondwa-widget .beyondwa-cta,
.beyondwa-widget .beyondwa-cta:link,
.beyondwa-widget .beyondwa-cta:visited,
.beyondwa-widget .beyondwa-cta:hover,
.beyondwa-widget .beyondwa-cta:focus,
.beyondwa-widget .beyondwa-cta:active {
	color: var(--beyondwa-cta-txt) !important;
	text-decoration: none !important;
	border: 0;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .16);
}

.beyondwa-widget .beyondwa-cta .beyondwa-send {
	color: inherit;
	stroke: currentColor;
}

.beyondwa-panel-body::after {
	content: "";
	display: block;
	clear: both;
}

.beyondwa-send {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
}

/* --- Botón dentro del contenido (shortcode) ----------------------------- */

.beyondwa-inline {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 22px;
	border-radius: 999px;
	background: var(--beyondwa-main, #25D366);
	color: #fff;
	font-weight: 700;
	text-decoration: none;
	line-height: 1.2;
}

.beyondwa-inline:hover,
.beyondwa-inline:focus-visible {
	filter: brightness(1.06);
}

/* Mismo refuerzo para el botón del shortcode, que vive dentro del contenido. */
a.beyondwa-inline,
a.beyondwa-inline:link,
a.beyondwa-inline:visited,
a.beyondwa-inline:hover,
a.beyondwa-inline:focus,
a.beyondwa-inline:active {
	color: var(--beyondwa-cta-txt, #fff) !important;
	text-decoration: none !important;
}

.beyondwa-inline .beyondwa-icon {
	width: 20px;
	height: 20px;
}

/* --- Dispositivos y responsive ------------------------------------------ */

@media (max-width: 782px) {
	.beyondwa-widget {
		--beyondwa-x: var(--beyondwa-x-mobile, 16px);
		--beyondwa-y: var(--beyondwa-y-mobile, 16px);
	}

	.beyondwa-pos-bottom-right,
	.beyondwa-pos-bottom-left,
	.beyondwa-pos-top-right,
	.beyondwa-pos-top-left,
	.beyondwa-pos-middle-right,
	.beyondwa-pos-middle-left {
		--beyondwa-x: var(--beyondwa-x-mobile, 16px);
		--beyondwa-y: var(--beyondwa-y-mobile, 16px);
	}

	.beyondwa-only-desktop {
		display: none !important;
	}

	.beyondwa-panel {
		width: min(360px, calc(100vw - 32px));
	}

	.beyondwa-brand-txt {
		font-size: 19px;
	}
}

@media (min-width: 783px) {
	.beyondwa-only-mobile {
		display: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.beyondwa-has-pulse .beyondwa-fab::after {
		animation: none;
	}

	.beyondwa-panel,
	.beyondwa-fab,
	.beyondwa-cta {
		transition: none;
	}
}

@media print {
	.beyondwa-widget {
		display: none !important;
	}
}
