/* ==========================================================================
   Chat bot (plantilla) — burbuja flotante + panel glass azul noche. Todo el sitio.
   ========================================================================== */

.eia-chat {
	--ch-night: rgba(10, 18, 48, .9);
	--ch-line: rgba(255, 255, 255, .14);
	--ch-glass: rgba(255, 255, 255, .08);
	--ch-on: #eef2ff;
	--ch-on-2: #a3add0;
	--ch-blue: var(--ast-global-color-0, #0056ef);
	--ch-cyan: #5ee0f2;
	--ch-font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
	--ch-ease: cubic-bezier(.16, 1, .3, 1);

	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 1000;
	font-family: var(--ch-font);
}

/* Botón flotante */
.eia-chat__launcher {
	position: relative;
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	margin-left: auto;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, #0056ef, #7c5cff);
	color: #fff;
	box-shadow: 0 16px 36px -12px rgba(0, 86, 239, .7), inset 0 1px 0 rgba(255, 255, 255, .3);
	cursor: pointer;
	transition: transform .5s var(--ch-ease), box-shadow .3s ease;
}
.eia-chat__launcher:hover { transform: translateY(-3px) scale(1.04); }
.eia-chat__launcher:focus-visible { outline: 3px solid var(--ch-cyan); outline-offset: 3px; }
.eia-chat__launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid rgba(94, 224, 242, .6);
	animation: eia-chat-pulse 2.4s ease-out infinite;
	pointer-events: none;
}
.eia-chat.is-open .eia-chat__launcher::after { animation: none; opacity: 0; }
.eia-chat__icon-close { display: none; }
.eia-chat.is-open .eia-chat__icon-open { display: none; }
.eia-chat.is-open .eia-chat__icon-close { display: block; }

@keyframes eia-chat-pulse {
	0% { transform: scale(1); opacity: .9; }
	100% { transform: scale(1.45); opacity: 0; }
}

/* Panel */
.eia-chat__panel {
	position: absolute;
	right: 0;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	width: min(380px, calc(100vw - 40px));
	height: min(560px, calc(100svh - 140px));
	overflow: hidden;
	border: 1px solid var(--ch-line);
	border-radius: 28px;
	background: var(--ch-night);
	-webkit-backdrop-filter: blur(24px) saturate(170%);
	backdrop-filter: blur(24px) saturate(170%);
	box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6);
	color: var(--ch-on);
	transform-origin: bottom right;
	animation: eia-chat-in .45s var(--ch-ease) both;
}
.eia-chat__panel[hidden] { display: none; }

@keyframes eia-chat-in {
	from { opacity: 0; transform: translateY(12px) scale(.96); }
	to { opacity: 1; transform: none; }
}

.eia-chat__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px 14px 18px;
	border-bottom: 1px solid var(--ch-line);
	background: linear-gradient(135deg, rgba(0, 86, 239, .35), rgba(124, 92, 255, .2));
}
.eia-chat__avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 13px;
	background: linear-gradient(135deg, #0056ef, #5ee0f2);
	color: #fff;
}
.eia-chat .eia-chat__title { margin: 0; font-family: var(--ch-font); font-size: 1rem; font-weight: 600; line-height: 1.2; color: #fff; text-transform: none; }
.eia-chat__status { margin: 2px 0 0; font-size: .8125rem; color: var(--ch-on-2); }
.eia-chat__close {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	margin-left: auto;
	padding: 0;
	border: 1px solid var(--ch-line);
	border-radius: 50%;
	background: var(--ch-glass);
	color: #fff;
	cursor: pointer;
}
.eia-chat__close:hover { background: rgba(255, 255, 255, .16); }

/* Mensajes */
.eia-chat__log {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 8px;
	padding: 18px 16px;
	overflow-y: auto;
	scrollbar-width: thin;
}
.eia-chat__msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 18px;
	font-size: .9375rem;
	line-height: 1.45;
	animation: eia-chat-in .35s var(--ch-ease) both;
}
.eia-chat__msg--bot { align-self: flex-start; border-bottom-left-radius: 6px; background: rgba(255, 255, 255, .1); color: var(--ch-on); }
.eia-chat__msg--user { align-self: flex-end; border-bottom-right-radius: 6px; background: var(--ch-blue); color: #fff; }
.eia-chat__msg--cta { padding: 0; background: none; }
.eia-chat .eia-chat__cta {
	display: inline-block;
	padding: 10px 16px;
	border-radius: 999px;
	background: #fff;
	color: #0a1230;
	font-size: .875rem;
	font-weight: 600;
	text-decoration: none;
}
.eia-chat .eia-chat__cta:hover { background: var(--ch-cyan); color: #0a1230; }

.eia-chat__typing { display: inline-flex; gap: 4px; padding: 14px; }
.eia-chat__typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--ch-on-2);
	animation: eia-chat-dot 1s ease-in-out infinite;
}
.eia-chat__typing span:nth-child(2) { animation-delay: .15s; }
.eia-chat__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes eia-chat-dot {
	0%, 60%, 100% { transform: translateY(0); opacity: .5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* Respuestas rápidas */
.eia-chat__quick {
	display: flex;
	gap: 6px;
	padding: 0 16px 12px;
	overflow-x: auto;
	scrollbar-width: none;
}
.eia-chat__quick::-webkit-scrollbar { display: none; }
.eia-chat .eia-chat__chip {
	flex: none;
	padding: 8px 12px;
	border: 1px solid var(--ch-line);
	border-radius: 999px;
	background: var(--ch-glass);
	color: var(--ch-on);
	font-family: var(--ch-font);
	font-size: .8125rem;
	line-height: 1.2;
	white-space: nowrap;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease;
}
.eia-chat .eia-chat__chip:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); color: #fff; }
.eia-chat .eia-chat__chip--cta { background: var(--ch-blue); border-color: var(--ch-blue); color: #fff; }

/* Campo de texto */
.eia-chat__form {
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 12px 12px 14px;
	border-top: 1px solid var(--ch-line);
}
.eia-chat__form input {
	flex: 1;
	min-width: 0;
	height: 46px;
	padding: 0 16px;
	border: 1px solid var(--ch-line);
	border-radius: 999px;
	background: var(--ch-glass);
	color: #fff;
	font-family: var(--ch-font);
	font-size: 1rem;
}
.eia-chat__form input::placeholder { color: var(--ch-on-2); }
.eia-chat__form input:focus { outline: none; border-color: var(--ch-cyan); background: rgba(255, 255, 255, .12); }
.eia-chat__form button {
	display: grid;
	place-items: center;
	flex: none;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ch-blue);
	color: #fff;
	cursor: pointer;
}
.eia-chat__form button:hover { background: #0047c7; }
.eia-chat button:focus-visible,
.eia-chat a:focus-visible { outline: 3px solid var(--ch-cyan); outline-offset: 2px; }

/* Astra pone "Mayúscula En Cada Palabra" en botones */
.eia-chat button,
.eia-chat a { text-transform: none; letter-spacing: normal; }

/* El botón "subir" de Astra va encima del chat */
#ast-scroll-top { bottom: 92px !important; right: 26px !important; }

/* Móvil: panel casi a pantalla completa */
@media (max-width: 480px) {
	.eia-chat { right: 14px; bottom: 14px; }
	.eia-chat__panel {
		position: fixed;
		inset: auto 10px 86px 10px;
		width: auto;
		height: min(70svh, 560px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.eia-chat *,
	.eia-chat *::after { animation: none !important; transition: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
	.eia-chat__panel { background: #0a1230; }
}
