/* =========================================================================
   Botón flotante de WhatsApp — [whatsapp_flotante]
   ========================================================================= */

.whp-widget {
	--whp-primary: var(--str-global-color-primaro-30, #2048b2);
	--whp-accent: #25d366;
	--whp-radius: 18px;
	--whp-shadow: 0 6px 24px rgba(18, 24, 39, 0.16), 0 2px 8px rgba(18, 24, 39, 0.08);
	--whp-gap: 22px;

	position: fixed;
	bottom: var(--whp-gap);
	z-index: 999;
	font-family: inherit;
	line-height: 1.4;
}

.whp-widget[data-position="right"] {
	right: var(--whp-gap);
}

.whp-widget[data-position="left"] {
	left: var(--whp-gap);
}

.whp-widget * {
	box-sizing: border-box;
}

/* ---------- Botón lanzador ---------- */

.whp-widget .whp-launcher {
	position: relative;
	background: transparent !important;
	width: 64px;
	height: 64px;
	border: 0;
	padding: 0;
	cursor: pointer;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	transition:
		transform 0.25s ease,
		box-shadow 0.25s ease;
}

.whp-launcher img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.whp-widget:hover .whp-launcher {
	transform: translateY(-2px) scale(1.04);
}

.whp-launcher:focus-visible {
	outline: 2px solid var(--whp-accent);
	outline-offset: 3px;
}

/* ---------- Tooltip ---------- */

.whp-tooltip {
	position: absolute;
	bottom: 14px;
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 120px;
	max-width: 240px;
	padding: 8px 16px;
	background: var(--whp-primary);
	color: #fff;
	border-radius: 14px;
	box-shadow: var(--whp-shadow);
	font-size: 0.85rem;
	line-height: 1em;
	text-align: center;
	font-weight: 500;
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition:
		opacity 0.35s ease,
		transform 0.35s ease,
		visibility 0.35s;
	pointer-events: none;
}

.whp-widget[data-position="right"] .whp-tooltip {
	right: 60px;
}

.whp-widget[data-position="left"] .whp-tooltip {
	left: 60px;
}

.whp-tooltip.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

.whp-widget.is-open .whp-tooltip {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.whp-tooltip-text {
	flex: 1;
}

.whp-tooltip-close {
	position: absolute;
	background: #f1f2f6;
	opacity: 0;
	top: -6px;
	left: -6px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border: 0;
	color: var(--whp-primary);
	cursor: pointer;
	border-radius: 50%;
	transition: opacity 0.2s ease;
}

.whp-tooltip:hover .whp-tooltip-close {
	opacity: 1;
}

/* ---------- Panel de chat ---------- */

.whp-panel {
	position: absolute;
	bottom: 78px;
	width: 320px;
	max-width: calc(100vw - 2 * var(--whp-gap));
	max-height: calc(100vh - 140px);
	background: #f4f5f8;
	border-radius: var(--whp-radius);
	box-shadow: var(--whp-shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px) scale(0.98);
	transition:
		opacity 0.28s ease,
		transform 0.28s ease,
		visibility 0.28s;
}

.whp-widget[data-position="right"] .whp-panel {
	right: 0;
	transform-origin: bottom right;
}

.whp-widget[data-position="left"] .whp-panel {
	left: 0;
	transform-origin: bottom left;
}

.whp-widget.is-open .whp-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.whp-panel-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px 18px;
	background: var(--whp-primary);
	color: #fff;
}

.whp-panel-avatar {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	overflow: hidden;
	background: #fff;
}

.whp-panel-avatar img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.whp-panel-heading {
	display: flex;
	flex-direction: column;
	justify-content: center;
	line-height: 1em;
	gap: 0px;
	flex: 1;
	min-width: 0;
}

.whp-panel-heading small {
	display: block;
	font-size: 0.72rem;
	font-weight: 500;
	opacity: 0.8;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.whp-panel-heading p {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.whp-panel-close {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease;
}

.whp-panel-close:hover {
	background: rgba(255, 255, 255, 0.24);
}

.whp-panel-body {
	padding: 18px 16px;
	overflow-y: auto;
}

.whp-bubble {
	position: relative;
	max-width: 88%;
	padding: 12px 14px;
	background: #fff;
	color: #262d3d;
	font-size: 0.88rem;
	font-weight: 500;
	line-height: 1.35;
	border-radius: 4px 14px 14px 14px;
	box-shadow: 0 2px 6px rgba(18, 24, 39, 0.06);
}

.whp-panel-footer {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding: 12px;
	background: #fff;
	border-top: 1px solid #ebedf2;
}

.whp-input {
	flex: 1;
	min-height: 40px;
	max-height: 96px;
	resize: none;
	padding: 10px 12px;
	background: #f4f5f8;
	border: 1px solid transparent;
	border-radius: 12px;
	font: inherit;
	font-size: 0.86rem;
	color: #1a1f36;
	transition:
		border-color 0.2s ease,
		background 0.2s ease;
}

.whp-input:focus {
	outline: none;
	background: #fff;
	border-color: var(--whp-primary);
}

.whp-send {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: var(--whp-accent);
	color: #fff;
	cursor: pointer;
	transition:
		transform 0.2s ease,
		filter 0.2s ease;
}

.whp-send:hover {
	transform: scale(1.06);
	filter: brightness(1.05);
}

.whp-send:active {
	transform: scale(0.96);
}

/* ---------- Responsive ---------- */

@media screen and (max-width: 480px) {
	.whp-widget {
		--whp-gap: 14px;
	}

	.whp-launcher {
		width: 56px;
		height: 56px;
	}

	.whp-panel {
		width: calc(100vw - 2 * var(--whp-gap));
		bottom: 70px;
	}

	.whp-tooltip {
		max-width: calc(100vw - 96px);
	}
}
