/**
 * JabaWhatsApp Frontend Styles (v1.0.0)
 * Peso ultraligero (< 3.5 KB), propiedades CSS modernas, compositor animations y foco accesible WCAG 1.4.11.
 */
#jaba-whatsapp-root {
	--jwa-bg: #25D366;
	--jwa-text: #FFFFFF;
	--jwa-bottom: 24px;
	--jwa-side: 24px;
	--jwa-size: 58px;
	--jwa-z: 9998;
	position: fixed;
	inset-block-end: var(--jwa-bottom);
	z-index: var(--jwa-z);
	display: flex;
	align-items: center;
	gap: 10px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
	line-height: 1.4;
	box-sizing: border-box;
}

#jaba-whatsapp-root *,
#jaba-whatsapp-root *::before,
#jaba-whatsapp-root *::after {
	box-sizing: border-box;
}

#jaba-whatsapp-root.jwa-pos-right {
	inset-inline-end: var(--jwa-side);
	flex-direction: row;
}

#jaba-whatsapp-root.jwa-pos-left {
	inset-inline-start: var(--jwa-side);
	flex-direction: row-reverse;
}

/* Visibilidad por dispositivo */
@media (max-width: 767px) {
	#jaba-whatsapp-root.jwa-dev-desktop_only {
		display: none !important;
	}
	#jaba-whatsapp-root {
		--jwa-bottom: 16px;
		--jwa-side: 16px;
	}
}

@media (min-width: 768px) {
	#jaba-whatsapp-root.jwa-dev-mobile_only {
		display: none !important;
	}
}

/* Botón Disparador (Enlace Directo o Botón Toggle) */
.jwa-trigger {
	appearance: none;
	border: none;
	margin: 0;
	background: var(--jwa-bg);
	color: var(--jwa-text) !important;
	text-decoration: none !important;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	min-inline-size: var(--jwa-size);
	block-size: var(--jwa-size);
	border-radius: 999px;
	padding-inline: 0;
	box-shadow: 0 6px 20px rgba(15, 23, 42, 0.22);
	position: relative;
	transition: box-shadow 150ms ease-out, scale 150ms ease-out, filter 150ms ease-out;
}

.jwa-style-pill .jwa-trigger {
	padding-inline: 18px 22px;
	block-size: calc(var(--jwa-size) - 6px);
}

.jwa-trigger:hover {
	box-shadow: 0 10px 26px rgba(15, 23, 42, 0.3);
	filter: brightness(1.04);
	color: var(--jwa-text) !important;
}

.jwa-trigger:active {
	scale: 0.96;
}

.jwa-trigger:focus-visible,
.jwa-chatbox-close:focus-visible,
.jwa-chatbox-send:focus-visible,
.jwa-chatbox-input:focus-visible {
	outline: 2px solid CanvasText;
	outline-offset: 3px;
}

.jwa-trigger-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.jwa-trigger-label {
	font-size: 14.5px;
	font-weight: 600;
	letter-spacing: -0.01em;
	white-space: nowrap;
}

/* Pulso sutil en compositor (solo cuando el usuario no prefiere reducir movimiento) */
@media (prefers-reduced-motion: no-preference) {
	.jwa-has-pulse .jwa-trigger::before {
		content: "";
		position: absolute;
		inset: 0;
		border-radius: 999px;
		background: var(--jwa-bg);
		z-index: -1;
		opacity: 0.55;
		animation: jwa-pulse 2.8s ease-out infinite;
		pointer-events: none;
	}
}

@keyframes jwa-pulse {
	0% {
		scale: 1;
		opacity: 0.5;
	}
	70%, 100% {
		scale: 1.38;
		opacity: 0;
	}
}

/* Etiqueta Flotante (Tooltip discreto) */
.jwa-tooltip {
	background: #ffffff;
	color: #0f172a;
	font-size: 13px;
	font-weight: 600;
	padding: 7px 13px;
	border-radius: 8px;
	box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
	border: 1px solid rgba(15, 23, 42, 0.08);
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 150ms ease-out, translate 150ms ease-out;
}

#jaba-whatsapp-root:hover .jwa-tooltip,
#jaba-whatsapp-root:focus-within .jwa-tooltip {
	opacity: 1;
}

#jaba-whatsapp-root.is-open .jwa-tooltip {
	opacity: 0 !important;
}

@media (max-width: 640px) {
	.jwa-tooltip {
		display: none;
	}
}

/* Mini-Caja de Chat Interactiva */
.jwa-chatbox {
	position: absolute;
	inset-block-end: calc(var(--jwa-size) + 14px);
	inline-size: min(350px, calc(100vw - 32px));
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
	border: 1px solid rgba(15, 23, 42, 0.08);
	overflow: hidden;
	color: #0f172a;
}

.jwa-pos-right .jwa-chatbox {
	inset-inline-end: 0;
	transform-origin: bottom right;
}

.jwa-pos-left .jwa-chatbox {
	inset-inline-start: 0;
	transform-origin: bottom left;
}

.jwa-chatbox[hidden] {
	display: none !important;
}

.jwa-chatbox:not([hidden]) {
	animation: jwa-fade-in 150ms ease-out both;
}

@media (prefers-reduced-motion: no-preference) {
	.jwa-chatbox:not([hidden]) {
		animation: jwa-grow 280ms ease-out both, jwa-fade-in 150ms ease-out both;
		animation: jwa-grow 300ms linear(0, 0.45 15%, 1.06 38%, 0.98 60%, 1) both, jwa-fade-in 150ms ease-out both;
	}
}

@keyframes jwa-grow {
	from {
		scale: 0.9;
	}
}

@keyframes jwa-fade-in {
	from {
		opacity: 0;
	}
}

.jwa-chatbox-header {
	background: var(--jwa-bg);
	color: var(--jwa-text);
	padding: 15px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.jwa-chatbox-brand {
	display: flex;
	align-items: center;
	gap: 11px;
	min-inline-size: 0;
}

.jwa-chatbox-avatar {
	position: relative;
	inline-size: 40px;
	block-size: 40px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.18);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.jwa-status-dot {
	position: absolute;
	inset-block-end: 1px;
	inset-inline-end: 1px;
	inline-size: 10px;
	block-size: 10px;
	border-radius: 999px;
	border: 2px solid #ffffff;
}

.jwa-status-dot.is-online {
	background: #22c55e;
}

.jwa-status-dot.is-offline {
	background: #f59e0b;
}

.jwa-chatbox-meta {
	display: flex;
	flex-direction: column;
	min-inline-size: 0;
}

.jwa-chatbox-title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	color: inherit;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.jwa-chatbox-subtitle {
	font-size: 12px;
	opacity: 0.92;
	line-height: 1.3;
}

.jwa-chatbox-close {
	appearance: none;
	background: rgba(255, 255, 255, 0.16);
	color: inherit;
	border: none;
	inline-size: 30px;
	block-size: 30px;
	border-radius: 999px;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 150ms ease-out, scale 150ms ease-out;
}

.jwa-chatbox-close:hover {
	background: rgba(255, 255, 255, 0.28);
}

.jwa-chatbox-close:active {
	scale: 0.94;
}

.jwa-chatbox-body {
	background: #efeae2;
	padding: 18px 16px;
}

.jwa-chatbox-bubble {
	background: #ffffff;
	color: #1e293b;
	padding: 12px 14px;
	border-radius: 0 12px 12px 12px;
	font-size: 13.5px;
	line-height: 1.5;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
	position: relative;
}

.jwa-chatbox-time {
	display: block;
	text-align: end;
	font-size: 11px;
	color: #64748b;
	margin-block-start: 5px;
}

.jwa-chatbox-footer {
	padding: 12px 14px 14px;
	background: #ffffff;
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0;
}

.jwa-chatbox-input {
	inline-size: 100%;
	border: 1px solid #cbd5e1;
	border-radius: 10px;
	padding: 9px 11px;
	font-size: 13.5px;
	font-family: inherit;
	color: #0f172a;
	background: #f8fafc;
	resize: none;
	line-height: 1.4;
}

.jwa-chatbox-input:focus {
	background: #ffffff;
	border-color: #64748b;
}

.jwa-chatbox-send {
	appearance: none;
	border: none;
	border-radius: 999px;
	background: var(--jwa-bg);
	color: var(--jwa-text);
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: filter 150ms ease-out, scale 150ms ease-out, box-shadow 150ms ease-out;
}

.jwa-chatbox-send:hover {
	filter: brightness(1.05);
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
}

.jwa-chatbox-send:active {
	scale: 0.97;
}
