/**
 * Alteria — hero: demo animada del asistente (modo "Chat animado").
 *
 * Reemplaza la tarjeta del taladro de la portada por una réplica del widget
 * real (bot-ui) en su tema oscuro, el mismo que usa el sitio: cabecera de la
 * tienda, burbuja del cliente, estados "Analizando la consulta" / "Generando
 * respuesta", respuesta en texto, carrusel de productos y valoración. Medidas
 * y colores copiados del widget en producción (casos-de-uso, 2026-11-05); el
 * contenido llega en un JSON y aquí solo va el aspecto.
 */

.alteria-hero-chat {
	--hc-page: #0F1419;
	--hc-header: #0F2E3B;
	--hc-card: #071A22;
	--hc-img: #0F2E3B;
	--hc-teal: #35A5A5;
	--hc-green: #45CD81;
	--hc-text: #F4F8F8;
	--hc-user: #0F2E3B;
	--hc-user-text: #F1EDE2;
	--hc-muted: #93AFB6;
	--hc-line: rgba(53, 165, 165, .28);
	--hc-w: 460px;
	--hc-h: 620px;
	--hc-card-w: 200px;

	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
	font-family: "Nunito Sans", system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
}

/* ── Panel del widget ───────────────────────────────────────────────── */
.alteria-hero-chat__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: var(--hc-w);
	max-width: 100%;
	height: var(--hc-h);
	overflow: hidden;
	border: 1px solid var(--hc-line);
	border-radius: 16px;
	background: var(--hc-page);
	box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .7);
}

.alteria-hero-chat__header {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	background: var(--hc-header);
}

/* Las imágenes llevan el prefijo del contenedor: las reglas globales de img del
   theme y de Elementor (height: auto) ganaban a una sola clase. */
.alteria-hero-chat .alteria-hero-chat__logo {
	display: block;
	flex: none;
	width: 48px;
	height: 48px;
	border-radius: 10px;
	object-fit: cover;
	background: #0b0b0b;
}

/* El favicon ya es una baldosa redondeada con esquinas transparentes: entero,
   sin recorte ni fondo, para que conserve su propio redondeo. */
.alteria-hero-chat .alteria-hero-chat__logo--brand {
	border-radius: 0;
	object-fit: contain;
	background: none;
}

.alteria-hero-chat__store {
	flex: 1;
	overflow: hidden;
	color: var(--hc-text);
	font-size: 17px;
	font-weight: 700;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.alteria-hero-chat__reset {
	display: grid;
	flex: none;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 10px;
	background: rgba(255, 255, 255, .15);
	color: #fff;
}

/* ── Conversación ───────────────────────────────────────────────────── */
.alteria-hero-chat__viewport {
	position: relative;
	flex: 1;
	overflow: hidden;
}

.alteria-hero-chat__track {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 16px;
	transition: transform .5s cubic-bezier(.22, .8, .3, 1), opacity .4s ease;
}

.alteria-hero-chat__track.is-leaving { opacity: 0; }

.alteria-hero-chat__in {
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .3s ease, transform .3s ease;
}

.alteria-hero-chat__in.is-in {
	opacity: 1;
	transform: none;
}

/* Estado vacío: logo y saludo, como el widget antes del primer mensaje */
.alteria-hero-chat__welcome {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 18px;
	color: var(--hc-text);
	font-size: 16px;
	transition: opacity .3s ease;
}

.alteria-hero-chat .alteria-hero-chat__welcome .alteria-hero-chat__logo {
	width: 88px;
	height: 88px;
	border-radius: 12px;
}

.alteria-hero-chat__welcome.is-hidden { opacity: 0; }

/* Mensaje del cliente */
.alteria-hero-chat__user {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
}

.alteria-hero-chat__bubble {
	max-width: 80%;
	padding: 11px 16px;
	border-radius: 16px;
	background: var(--hc-user);
	color: var(--hc-user-text);
	font-size: 15px;
	line-height: 1.35;
}

.alteria-hero-chat__time {
	color: var(--hc-muted);
	font-size: 12px;
}

/* Estado de trabajo: ✦ + texto con brillo que lo recorre */
.alteria-hero-chat__status {
	display: flex;
	align-items: center;
	gap: 9px;
	padding-left: 14px;
	font-size: 15px;
}

.alteria-hero-chat__spark {
	color: var(--hc-green);
	font-size: 12px;
	animation: alteria-hc-spin 2.4s linear infinite;
}

.alteria-hero-chat__shimmer {
	background: linear-gradient(90deg, #C9D4D7 0%, #C9D4D7 40%, var(--hc-green) 50%, #C9D4D7 60%, #C9D4D7 100%);
	background-size: 250% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	animation: alteria-hc-shimmer 1.6s linear infinite;
}

@keyframes alteria-hc-shimmer {
	from { background-position: 100% 0; }
	to   { background-position: -150% 0; }
}

@keyframes alteria-hc-spin {
	to { transform: rotate(360deg); }
}

/* Respuesta: texto corrido, sin burbuja */
.alteria-hero-chat__answer {
	display: flex;
	flex-direction: column;
	gap: 10px;
	color: var(--hc-text);
	font-size: 15px;
	line-height: 1.55;
}

.alteria-hero-chat__answer p { margin: 0; }

.alteria-hero-chat__preview {
	color: var(--hc-text);
	font-size: 15px;
	line-height: 1.55;
}

.alteria-hero-chat__word {
	opacity: 0;
	transition: opacity .2s ease;
}

.alteria-hero-chat__word.is-on { opacity: 1; }

/* ── Carrusel ───────────────────────────────────────────────────────── */
.alteria-hero-chat__carousel {
	position: relative;
	overflow: hidden;
	margin-right: -16px;
}

.alteria-hero-chat__strip {
	display: flex;
	gap: 12px;
	transition: transform .55s cubic-bezier(.45, 0, .2, 1);
}

.alteria-hero-chat__card {
	display: flex;
	flex: 0 0 var(--hc-card-w);
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--hc-teal);
	border-radius: 12px;
	background: var(--hc-card);
	opacity: 0;
	transform: translateX(14px);
	transition: opacity .35s ease, transform .4s cubic-bezier(.22, .8, .3, 1);
}

.alteria-hero-chat__card.is-in {
	opacity: 1;
	transform: none;
}

.alteria-hero-chat .alteria-hero-chat__photo {
	display: block;
	max-width: none;
	width: 100%;
	height: 124px;
	object-fit: contain;
	background: var(--hc-img);
}

.alteria-hero-chat__card-body {
	display: flex;
	flex-direction: column;
	padding: 11px 12px 12px;
}

.alteria-hero-chat__brand {
	overflow: hidden;
	margin-bottom: 2px;
	color: var(--hc-text);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .08em;
	line-height: 1.3;
	text-transform: uppercase;
	white-space: nowrap;
	text-overflow: ellipsis;
	opacity: .65;
}

.alteria-hero-chat__name {
	display: -webkit-box;
	overflow: hidden;
	min-height: 3.9em;
	margin-bottom: 6px;
	color: var(--hc-text);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.alteria-hero-chat__price {
	color: var(--hc-text);
	font-size: 16px;
	font-weight: 700;
}

.alteria-hero-chat__next {
	position: absolute;
	top: 46px;
	right: 22px;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border: 1px solid var(--hc-teal);
	border-radius: 50%;
	background: var(--hc-card);
	color: var(--hc-text);
	transition: transform .15s ease, opacity .3s ease;
}

.alteria-hero-chat__next.is-pressed { transform: scale(.88); }
.alteria-hero-chat__next.is-hidden { opacity: 0; }

/* Hora y valoración bajo cada respuesta */
.alteria-hero-chat__meta {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--hc-muted);
	font-size: 12px;
}

.alteria-hero-chat__meta svg { width: 15px; height: 15px; opacity: .85; }

/* ── Caja de texto ──────────────────────────────────────────────────── */
.alteria-hero-chat__composer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px 6px;
}

.alteria-hero-chat__icon {
	display: grid;
	flex: none;
	place-items: center;
	width: 36px;
	height: 36px;
	border: 1.5px solid var(--hc-teal);
	border-radius: 50%;
	color: #A9C2C7;
}

.alteria-hero-chat__field {
	display: flex;
	flex: 1;
	align-items: center;
	gap: 8px;
	min-width: 0;
	padding: 4px 6px 4px 16px;
	border: 2px solid var(--hc-teal);
	border-radius: 18px;
	background: var(--hc-card);
}

.alteria-hero-chat__input {
	flex: 1;
	overflow: hidden;
	color: var(--hc-text);
	font-size: 15px;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.alteria-hero-chat__input:empty::before {
	content: attr(data-placeholder);
	color: #7F969D;
}

.alteria-hero-chat__input.is-typing::after {
	content: "";
	display: inline-block;
	width: 1.5px;
	height: 1.05em;
	margin-left: 1px;
	vertical-align: -2px;
	background: var(--hc-text);
	animation: alteria-hc-caret .9s steps(1) infinite;
}

@keyframes alteria-hc-caret {
	50% { opacity: 0; }
}

/* Micrófono, que pasa a botón de envío cuando hay texto */
.alteria-hero-chat__action {
	display: grid;
	flex: none;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	color: #A9C2C7;
	transition: background .2s ease, color .2s ease, transform .15s ease;
}

.alteria-hero-chat__action.is-send {
	background: var(--hc-teal);
	color: var(--hc-page);
}

.alteria-hero-chat__action.is-pressed { transform: scale(.86); }

.alteria-hero-chat__footer {
	padding: 6px 16px 10px;
	color: var(--hc-text);
	font-size: 12px;
	text-align: center;
}

.alteria-hero-chat__footer strong,
.alteria-hero-chat__footer b {
	color: var(--hc-teal);
	font-weight: 700;
}

.alteria-hero-chat__footer u { text-decoration: underline; }

/* ── Selector de rubro ──────────────────────────────────────────────── */
.alteria-hero-chat__tabs {
	display: flex;
	gap: 6px;
	padding: 5px;
	border: 1px solid var(--alteria-border, #1B4A5A);
	border-radius: 999px;
	background: rgba(15, 46, 59, .6);
	font-family: var(--alteria-font-body, "League Spartan", system-ui, sans-serif);
}

.alteria-hero-chat__tab {
	position: relative;
	overflow: hidden;
	padding: 8px 14px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--hc-muted);
	font: inherit;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: color .3s ease, background .3s ease;
}

.alteria-hero-chat__tab:hover { color: var(--hc-text); }

.alteria-hero-chat__tab:focus-visible {
	outline: 2px solid var(--hc-green);
	outline-offset: 2px;
}

.alteria-hero-chat__tab[aria-pressed="true"] {
	background: rgba(69, 205, 129, .12);
	color: var(--hc-text);
}

/* El JS mueve --hc-p (0…1) al ritmo de la escena: se detiene con ella. */
.alteria-hero-chat__tab::after {
	content: "";
	position: absolute;
	right: 14px;
	bottom: 4px;
	left: 14px;
	height: 2px;
	border-radius: 2px;
	background: var(--hc-green);
	transform: scaleX(0);
	transform-origin: left;
}

.alteria-hero-chat__tab.is-running::after { transform: scaleX(var(--hc-p, 0)); }

.alteria-hero-chat__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

@media (max-width: 480px) {
	.alteria-hero-chat {
		--hc-h: 580px;
		--hc-card-w: 180px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.alteria-hero-chat__in,
	.alteria-hero-chat__card,
	.alteria-hero-chat__word,
	.alteria-hero-chat__track,
	.alteria-hero-chat__strip { transition: none; }

	.alteria-hero-chat__shimmer,
	.alteria-hero-chat__spark { animation: none; }

	.alteria-hero-chat__tab::after { display: none; }
}
