/**
 * 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 .3s ease, box-shadow .3s 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;
	}
}

/* --- Texto junto al botón (1.2.0) -------------------------------------- */

.beyondwa-fab-wrap {
	position: relative;
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}

.beyondwa-tip {
	position: absolute;
	top: 50%;
	right: calc(100% + 14px);
	transform: translateY(-50%);
	width: max-content;
	max-width: min(320px, calc(100vw - var(--beyondwa-size) - 48px));
	padding: 9px 16px;
	border-radius: 22px;
	background: var(--beyondwa-bubble-bg);
	color: var(--beyondwa-bubble-txt);
	font-size: 16px;
	font-weight: 500;
	line-height: 1.3;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	cursor: pointer;
	transition: opacity .2s ease, visibility .2s ease;
}

/* Flecha hacia el botón */
.beyondwa-tip::after {
	content: "";
	position: absolute;
	top: 50%;
	right: -5px;
	width: 12px;
	height: 12px;
	background: inherit;
	border-radius: 2px;
	transform: translateY(-50%) rotate(45deg);
}

.beyondwa-pos-bottom-left .beyondwa-tip,
.beyondwa-pos-top-left .beyondwa-tip,
.beyondwa-pos-middle-left .beyondwa-tip {
	right: auto;
	left: calc(100% + 14px);
}

.beyondwa-pos-bottom-left .beyondwa-tip::after,
.beyondwa-pos-top-left .beyondwa-tip::after,
.beyondwa-pos-middle-left .beyondwa-tip::after {
	right: auto;
	left: -5px;
}

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

/* Con el chat abierto el globo sobra. */
.beyondwa-is-open .beyondwa-tip,
.beyondwa-tip-hover .beyondwa-tip {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.beyondwa-tip-hover:not(.beyondwa-is-open) .beyondwa-fab-wrap:hover .beyondwa-tip {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.beyondwa-is-preview .beyondwa-tip {
	opacity: 1;
	visibility: visible;
}

@media (max-width: 782px) {
	.beyondwa-tip {
		font-size: 14px;
		padding: 7px 13px;
	}
}

/* 1.1.1: blindaje de los botones contra estilos globales del tema.
   Hay temas y CSS personalizados que pintan todos los <button> (ej. "button, [type=button]
   { background: verde }" o esquinas rectas en Woodmart). Con el ID del widget delante, estas
   reglas les ganan a esas sin depender del orden de carga. Detectado en mastermachine.cl. */
#beyondwa-widget .beyondwa-fab,
#beyondwa-widget .beyondwa-close {
	-webkit-appearance: none !important;
	appearance: none !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	line-height: 1 !important;
	text-indent: 0 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	background-image: none !important;
	cursor: pointer !important;
}

#beyondwa-widget .beyondwa-fab {
	transition: transform .3s ease, box-shadow .3s ease !important; /* 1.2.1: el tema la pisaba */
	width: var(--beyondwa-size) !important;
	height: var(--beyondwa-size) !important;
	background-color: var(--beyondwa-main) !important;
	color: #fff !important;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22) !important;
}

#beyondwa-widget .beyondwa-fab:hover,
#beyondwa-widget .beyondwa-fab:focus-visible {
	transform: scale(1.06) !important;
	background-color: var(--beyondwa-main) !important;
	box-shadow: 0 12px 30px rgba(0, 0, 0, .28) !important;
}

#beyondwa-widget .beyondwa-close {
	width: 38px !important;
	height: 38px !important;
	background-color: rgba(0, 0, 0, .18) !important;
	color: var(--beyondwa-header-txt) !important;
	box-shadow: none !important;
}

#beyondwa-widget .beyondwa-close:hover,
#beyondwa-widget .beyondwa-close:focus-visible {
	background-color: rgba(0, 0, 0, .3) !important;
}

#beyondwa-widget .beyondwa-fab .beyondwa-icon {
	width: 58% !important;
	height: 58% !important;
	display: block !important;
}

#beyondwa-widget .beyondwa-close svg {
	width: 18px !important;
	height: 18px !important;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

#beyondwa-widget .beyondwa-tip {
	background-color: var(--beyondwa-bubble-bg) !important;
	color: var(--beyondwa-bubble-txt) !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	margin: 0 !important;
}

#beyondwa-widget .beyondwa-close svg path {
	fill: none !important;
	stroke: currentColor !important;
}

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