/*
 * EENDA
 * Marketing, Desarrollo & Consulting
 * www.eenda.com
 * © 2026
 *
 * xpiabot.css — el chat del bot en la web. Todo cuelga de .xpiabot para no
 * chocar con los estilos de la web. El color se cambia con --xpiabot-color
 * (Bot IA → Ajustes, o en el CSS de la web).
 */

.xpiabot{
	--xpiabot-color: #2563eb;
	--xpiabot-texto-color: #ffffff;
	--xpiabot-fondo: #ffffff;
	--xpiabot-tinta: #1f2328;
	--xpiabot-suave: #f2f4f7;
	--xpiabot-borde: rgba(0, 0, 0, .12);
	--xpiabot-tenue: #5c6470;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 2147483000;
	font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--xpiabot-tinta);
}

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

.xpiabot-oculto{
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.xpiabot-boton{
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	border: 0;
	border-radius: 50%;
	background: var(--xpiabot-color);
	color: var(--xpiabot-texto-color);
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
	cursor: pointer;
	transition: transform .15s ease;
}

.xpiabot-boton:hover{ transform: scale(1.05); }
.xpiabot-boton:focus-visible,
.xpiabot-cerrar:focus-visible,
.xpiabot-enviar:focus-visible{ outline: 3px solid var(--xpiabot-color); outline-offset: 3px; }

.xpiabot--abierto .xpiabot-boton{ display: none; }

.xpiabot-panel{
	display: flex;
	flex-direction: column;
	width: 370px;
	height: min(580px, calc(100vh - 40px));
	background: var(--xpiabot-fondo);
	border: 1px solid var(--xpiabot-borde);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
	overflow: hidden;
}

.xpiabot-panel[hidden]{ display: none; }

.xpiabot-cabecera{
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 12px 12px 16px;
	background: var(--xpiabot-color);
	color: var(--xpiabot-texto-color);
}

.xpiabot-avatar{
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	background: rgba(255, 255, 255, .2);
}

.xpiabot-titulos{
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
}

.xpiabot-titulos strong{ font-size: 16px; }

.xpiabot-aviso{
	font-size: 12px;
	opacity: .85;
}

.xpiabot-cerrar{
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.xpiabot-cerrar:hover{ background: rgba(255, 255, 255, .15); }

.xpiabot-mensajes{
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.xpiabot-msg{
	max-width: 85%;
	padding: 9px 13px;
	border-radius: 14px;
	overflow-wrap: anywhere;
}

.xpiabot-msg p{ margin: 0 0 .5em; }
.xpiabot-msg p:last-child,
.xpiabot-msg ul:last-child{ margin-bottom: 0; }
.xpiabot-msg ul{ margin: 0 0 .5em; padding-left: 1.2em; }
.xpiabot-msg a{ color: inherit; text-decoration: underline; }

.xpiabot-msg--bot{
	align-self: flex-start;
	background: var(--xpiabot-suave);
	border-bottom-left-radius: 4px;
}

.xpiabot-msg--usuario{
	align-self: flex-end;
	background: var(--xpiabot-color);
	color: var(--xpiabot-texto-color);
	border-bottom-right-radius: 4px;
	white-space: pre-wrap;
}

.xpiabot-escribiendo{
	display: flex;
	gap: 4px;
	padding: 13px;
}

.xpiabot-escribiendo span{
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--xpiabot-tenue);
	animation: xpiabot-punto 1s infinite ease-in-out;
}

.xpiabot-escribiendo span:nth-child(2){ animation-delay: .15s; }
.xpiabot-escribiendo span:nth-child(3){ animation-delay: .3s; }

@keyframes xpiabot-punto{
	0%, 80%, 100%{ opacity: .3; transform: translateY(0); }
	40%{ opacity: 1; transform: translateY(-3px); }
}

.xpiabot-escribir{
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--xpiabot-borde);
}

.xpiabot-escribir textarea{
	flex: 1;
	min-height: 40px;
	max-height: 120px;
	padding: 9px 12px;
	border: 1px solid var(--xpiabot-borde);
	border-radius: 12px;
	font: inherit;
	color: inherit;
	background: var(--xpiabot-fondo);
	resize: none;
}

.xpiabot-escribir textarea:focus{
	outline: none;
	border-color: var(--xpiabot-color);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--xpiabot-color) 20%, transparent);
}

.xpiabot-enviar{
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: var(--xpiabot-color);
	color: var(--xpiabot-texto-color);
	cursor: pointer;
}

.xpiabot-form{
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	max-width: 100%;
}

.xpiabot-form-fila{
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.xpiabot-form label{ font-size: 13px; color: var(--xpiabot-tenue); }

.xpiabot-form input,
.xpiabot-form textarea,
.xpiabot-form select{
	width: 100%;
	padding: 7px 10px;
	border: 1px solid var(--xpiabot-borde);
	border-radius: 8px;
	font: inherit;
	color: inherit;
	background: var(--xpiabot-fondo);
}

.xpiabot-form-error{ color: #b42318; font-size: 12px; }
.xpiabot-form-error:empty{ display: none; }

.xpiabot-form-enviar{
	align-self: flex-start;
	padding: 8px 16px;
	border: 0;
	border-radius: 8px;
	background: var(--xpiabot-color);
	color: var(--xpiabot-texto-color);
	font: inherit;
	cursor: pointer;
}

.xpiabot-form-enviar:disabled{ opacity: .6; cursor: wait; }

/* En el móvil, a pantalla casi completa */
@media (max-width: 480px){
	.xpiabot{ right: 12px; bottom: 12px; }
	.xpiabot--abierto{ left: 0; right: 0; bottom: 0; top: 0; }
	.xpiabot--abierto .xpiabot-panel{ width: 100%; height: 100%; border-radius: 0; border: 0; }
}

@media (prefers-reduced-motion: reduce){
	.xpiabot-boton,
	.xpiabot-escribiendo span{ transition: none; animation: none; }
}

/* «Seguir por WhatsApp» (0.3.0) */
.xpiabot-whatsapp-caja{ background: transparent; padding: 0; }
.xpiabot-whatsapp{
	display: inline-flex; align-items: center; gap: .4em;
	padding: .55em 1em; border-radius: 999px;
	background: #25d366; color: #fff; font-weight: 600; text-decoration: none;
}
.xpiabot-whatsapp::before{
	content: ""; width: 1.1em; height: 1.1em; flex: none;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm5.3 14.1c-.2.6-1.3 1.2-1.8 1.2-.5.1-1 .2-3.3-.7-2.8-1.1-4.6-4-4.7-4.2-.1-.2-1.1-1.5-1.1-2.9s.7-2 1-2.3c.3-.3.6-.3.8-.3h.6c.2 0 .4 0 .6.5l.8 2c.1.2.1.4 0 .5l-.3.5-.4.4c-.1.1-.3.3-.1.6.2.3.8 1.3 1.7 2.1 1.2 1 2.1 1.4 2.4 1.5.3.1.5.1.6-.1l.9-1c.2-.3.4-.2.6-.1l1.9.9c.3.1.5.2.5.3.1.2.1.7-.1 1.3z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm5.3 14.1c-.2.6-1.3 1.2-1.8 1.2-.5.1-1 .2-3.3-.7-2.8-1.1-4.6-4-4.7-4.2-.1-.2-1.1-1.5-1.1-2.9s.7-2 1-2.3c.3-.3.6-.3.8-.3h.6c.2 0 .4 0 .6.5l.8 2c.1.2.1.4 0 .5l-.3.5-.4.4c-.1.1-.3.3-.1.6.2.3.8 1.3 1.7 2.1 1.2 1 2.1 1.4 2.4 1.5.3.1.5.1.6-.1l.9-1c.2-.3.4-.2.6-.1l1.9.9c.3.1.5.2.5.3.1.2.1.7-.1 1.3z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.xpiabot-whatsapp:hover, .xpiabot-whatsapp:focus-visible{ background: #1ebe5a; color: #fff; }

