/*! Horizon CX – Demos de agentes v1.1.0
 * Colores, tipografías, rellenos y radios viven en los widgets de Elementor.
 * Acá va solo lo que Elementor no tiene como control: estados de la
 * animación, scroll interno del chat y detalles decorativos.
 */

/* ---------- Módulo ---------- */
.hcx-agente { scroll-margin-top: 140px; }
.hcx-agentes .elementor-widget-text-editor p:last-child,
.hcx-agente .elementor-widget-text-editor p:last-child { margin-block-end: 0; }

/* Barra de pestañas de agentes: desliza en horizontal si no entra */
.hcx-agentes-nav { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.hcx-agentes-nav > .e-con-inner { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
.hcx-agentes-nav > .e-con-inner::-webkit-scrollbar { display: none; }
.hcx-agentes-nav .elementor-button { white-space: nowrap; }

/* Viñetas: tilde dentro de un círculo con el color de acento del Kit.
   El círculo es el propio ícono + 4px de relleno (ícono de 10px = círculo de 18px);
   la separación con el texto sigue saliendo de "Sangría del texto". */
.hcx-checks .elementor-icon-list-icon svg,
.hcx-checks .elementor-icon-list-icon i {
	box-sizing: content-box;
	flex-shrink: 0;
	padding: 4px;
	border-radius: 50%;
	background: var(--e-global-color-accent, #FFB30D);
}
.hcx-checks .elementor-icon-list-icon i { width: 1em; height: 1em; line-height: 1; text-align: center; }

/* ---------- Navegador ---------- */
.hcx-browser__dots .elementor-icon-list-item:nth-child(1) { --hcx-dot: #FF5F57; }
.hcx-browser__dots .elementor-icon-list-item:nth-child(2) { --hcx-dot: #FEBC2E; }
.hcx-browser__dots .elementor-icon-list-item:nth-child(3) { --hcx-dot: #28C840; }
/* Sin transition: Chrome deja "trabado" un fill/color que sale de var() si se transiciona */
.hcx-browser__dots .elementor-icon-list-icon i { color: var(--hcx-dot) !important; transition: none !important; }
.hcx-browser__dots .elementor-icon-list-icon svg { fill: var(--hcx-dot) !important; transition: none !important; }
.hcx-browser__tab { min-width: 0; }
.hcx-browser__tab .elementor-heading-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Chat ---------- */
/* El alto del chat es el "Alto mínimo" del contenedor, así el cuerpo scrollea */
.hcx-chat { height: var(--min-height, 412px); }
.hcx-chat__body {
	flex: 1 1 0 !important;
	min-height: 0;
	overflow-y: auto !important;
	scroll-behavior: smooth;
	scrollbar-width: none;
}
.hcx-chat__body::-webkit-scrollbar { display: none; }

/* Punto verde de "en línea" sobre el avatar */
.hcx-chat__avatar { position: relative; overflow: visible; line-height: 0; } /* sin interlineado: círculo exacto */
.hcx-chat__avatar::after {
	content: "";
	position: absolute;
	right: -1px;
	bottom: -1px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #2BD67B;
	border: 2px solid var(--hcx-chat-head, #0E1215);
}

/* Burbujas: ancho según el texto, con tope */
.hcx-msg { max-width: var(--hcx-msg-max, 86%) !important; flex-shrink: 0; }
.hcx-msg p { margin: 0; }
.hcx-msg small {
	display: block;
	margin-top: 3px;
	text-align: right;
	font-size: .8em;
	line-height: 1.2;
	opacity: .65;
}

/* Ficha de producto dentro del chat: Elementor apila el Image Box en mobile
   (imagen arriba, centrada); en una burbuja tiene que seguir en fila */
@media (max-width: 767px) {
	.hcx-chat .elementor-widget-image-box.elementor-position-left .elementor-image-box-wrapper {
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: start;
	}
	.hcx-chat .elementor-widget-image-box.elementor-position-left .elementor-image-box-img {
		margin-inline: 0 10px !important;
		margin-bottom: 0 !important;
	}
}

/* Indicador "escribiendo" (lo agrega el JS; toma el fondo y el borde de la burbuja del agente) */
.hcx-typing {
	align-self: flex-start;
	display: none;
	gap: 4px;
	padding: 9px 12px;
	border-radius: var(--hcx-typing-radius, 12px);
	background: var(--hcx-typing-bg, #fff);
	border: var(--hcx-typing-border, 1px solid #E3E8E9);
}
.hcx-typing.is-on { display: inline-flex; }
.hcx-typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--hcx-typing-dot, #9AA6A9);
	animation: hcx-bounce 1s infinite;
}
.hcx-typing i:nth-child(2) { animation-delay: .15s; }
.hcx-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes hcx-bounce {
	0%, 60%, 100% { transform: none; opacity: .5; }
	30% { transform: translateY(-3px); opacity: 1; }
}

/* ---------- Teléfono con WhatsApp ---------- */
/* Elementor usa el ::before de los contenedores para la superposición del fondo:
   todos los detalles del teléfono van en ::after. */
.hcx-phone { height: var(--min-height, 624px); }
/* Botones laterales: el de volumen a la izquierda y, por sombra, el segundo y el de
   encendido (303px = ancho del teléfono + 3px; si cambiás el ancho, ajustalo) */
.hcx-phone::after {
	content: "";
	position: absolute;
	left: -3px;
	top: 120px;
	width: 3px;
	height: 60px;
	border-radius: 2px 0 0 2px;
	background: #2A3034;
	box-shadow: 0 74px 0 #2A3034, 303px 30px 0 #2A3034;
}
.hcx-phone__screen { flex: 1 1 0 !important; min-height: 0; position: relative; }
/* Isla dinámica */
.hcx-phone__screen::after {
	content: "";
	position: absolute;
	top: 10px;
	left: 50%;
	width: 92px;
	height: 27px;
	margin-left: -46px;
	border-radius: 15px;
	background: #000;
	z-index: 6;
}
/* Barra de inicio */
.hcx-wa__pie { position: relative; }
.hcx-wa__pie::after {
	content: "";
	position: absolute;
	bottom: 9px;
	left: 50%;
	width: 112px;
	height: 4.5px;
	margin-left: -56px;
	border-radius: 3px;
	background: #111;
}

.hcx-wa__avatar { line-height: 0; overflow: hidden; } /* círculo exacto */
/* Nombre largo: una línea con puntos suspensivos, como en WhatsApp */
.hcx-wa__nombre { min-width: 0; }
.hcx-wa__nombre .elementor-heading-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hcx-demo--wa { --hcx-msg-max: 80%; }
.hcx-demo--wa .hcx-msg--out,
.hcx-demo--wa .hcx-msg--in { position: relative; }

/* Colita de la primera burbuja de cada tanda (clase hcx-tail en el mensaje).
   Toma el fondo de la burbuja; según la versión de Elementor el fondo está en el
   widget o en su .elementor-widget-container, por eso las dos variantes. */
.hcx-tail::after,
.hcx-tail > .elementor-widget-container::after {
	content: "";
	position: absolute;
	top: 0;
	width: 8px;
	height: 10px;
	background: inherit;
}
.hcx-tail > .elementor-widget-container { position: relative; }
.hcx-tail.hcx-msg--in::after,
.hcx-tail.hcx-msg--in > .elementor-widget-container::after { left: -7px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.hcx-tail.hcx-msg--out::after,
.hcx-tail.hcx-msg--out > .elementor-widget-container::after { right: -7px; clip-path: polygon(0 0, 100% 0, 0 100%); }

/* Hora al final de la línea, como en WhatsApp, con doble tilde en los mensajes del cliente */
.hcx-demo--wa .hcx-msg p::after { content: ""; display: block; clear: both; }
.hcx-demo--wa .hcx-msg small {
	float: right;
	display: inline-flex;
	align-items: center;
	gap: 3px;
	margin: 7px 0 -5px 10px;
	color: #667781;
	opacity: 1;
}
.hcx-demo--wa .hcx-msg--out small::after {
	content: "";
	width: 16px;
	height: 10px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 11'%3E%3Cpath d='M1 6l3 3 6-7M7 9l1 1 6-8' fill='none' stroke='%2353BDEB' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Estados de la animación (solo cuando el JS tomó el control) ---------- */
.hcx-demo.is-ready .hcx-msg {
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .35s ease, transform .35s ease !important;
}
.hcx-demo.is-ready .hcx-msg.is-off { display: none !important; }
.hcx-demo.is-ready .hcx-msg.is-in { opacity: 1; transform: none; }

.hcx-demo.is-ready .hcx-toast {
	opacity: 0;
	transform: translateY(10px);
	transition: opacity .4s ease, transform .4s ease !important;
	pointer-events: none;
}
.hcx-demo.is-ready .hcx-toast.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
	.hcx-typing i { animation: none; }
	.hcx-chat__body { scroll-behavior: auto; }
}
