/* Widget del chatbot turístico. Colores propios (no del tema) para garantizar contraste AA. */

.st-chatbot {
	--stc-acento: #8f3a22;      /* 7,5:1 con blanco */
	--stc-acento-oscuro: #6f2c19;
	--stc-texto: #1f1b16;
	--stc-suave: #5b5249;       /* 7,6:1 con blanco */
	--stc-fondo: #ffffff;
	--stc-fondo-log: #faf6f1;
	--stc-borde: #e3d8cb;
	--stc-borde-campo: #847a70; /* 4,3:1 con blanco (componentes ≥ 3:1) */
	--stc-aviso: #fff6e5;
	bottom: 16px;
	color: var(--stc-texto);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.45;
	position: fixed;
	right: 16px;
	z-index: 99990;
}

.st-chatbot[hidden],
.st-chatbot [hidden] {
	display: none !important;
}

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

.st-chatbot__sr {
	border: 0 !important;
	clip: rect(1px, 1px, 1px, 1px) !important;
	clip-path: inset(50%) !important;
	height: 1px !important;
	margin: -1px !important;
	overflow: hidden !important;
	padding: 0 !important;
	position: absolute !important;
	white-space: nowrap !important;
	width: 1px !important;
}

.st-chatbot__icono {
	display: block;
	flex: none;
	height: 24px;
	width: 24px;
}

/* Foco visible sobre cualquier fondo: anillo doble claro/oscuro. */
.st-chatbot button:focus-visible,
.st-chatbot a:focus-visible,
.st-chatbot input:focus-visible,
.st-chatbot__mensajes:focus-visible {
	box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px var(--stc-texto);
	outline: 2px solid transparent;
	outline-offset: 2px;
}

/* ---------------- Botón lanzador ---------------- */

.st-chatbot__lanzador {
	align-items: center;
	background: var(--stc-acento);
	border: 2px solid #ffffff;
	border-radius: 999px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	color: #ffffff;
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-weight: 600;
	gap: 0.5rem;
	min-height: 56px;
	padding: 0 1.25rem 0 1rem;
}

.st-chatbot__lanzador:hover {
	background: var(--stc-acento-oscuro);
}

/* ---------------- Panel ---------------- */

.st-chatbot__panel {
	background: var(--stc-fondo);
	border: 1px solid var(--stc-borde);
	border-radius: 16px;
	bottom: calc(100% + 12px);
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
	display: flex;
	flex-direction: column;
	height: min(640px, calc(100vh - 110px));
	overflow: hidden;
	position: absolute;
	right: 0;
	width: min(400px, calc(100vw - 32px));
}

.st-chatbot__cabecera {
	align-items: center;
	background: var(--stc-acento);
	color: #ffffff;
	display: flex;
	gap: 0.25rem;
	padding: 0.75rem 0.5rem 0.75rem 1rem;
}

.st-chatbot__cabecera-texto {
	flex: 1;
	min-width: 0;
}

.st-chatbot .st-chatbot__titulo {
	color: #ffffff;
	font-family: inherit;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0;
	line-height: 1.25;
	margin: 0;
	text-transform: none;
}

.st-chatbot .st-chatbot__subtitulo {
	color: #ffffff;
	font-size: 0.85rem;
	margin: 0.15rem 0 0;
	opacity: 0.95;
}

.st-chatbot__boton-icono {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: 10px;
	color: #ffffff;
	cursor: pointer;
	display: inline-flex;
	height: 44px;
	justify-content: center;
	padding: 0;
	width: 44px;
}

.st-chatbot__boton-icono:hover {
	background: rgba(255, 255, 255, 0.16);
}

/* ---------------- Mensajes ---------------- */

.st-chatbot__mensajes {
	background: var(--stc-fondo-log);
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.75rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 1rem 0.85rem;
	position: relative;
}

.st-chatbot__msg {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	max-width: 100%;
}

.st-chatbot__msg--usuario {
	align-items: flex-end;
}

.st-chatbot__burbuja {
	border-radius: 14px;
	max-width: 88%;
	padding: 0.6rem 0.85rem;
	word-wrap: break-word;
}

.st-chatbot__msg--usuario .st-chatbot__burbuja {
	background: var(--stc-acento);
	border-bottom-right-radius: 4px;
	color: #ffffff;
}

.st-chatbot__msg--asistente .st-chatbot__burbuja {
	background: var(--stc-fondo);
	border: 1px solid var(--stc-borde);
	border-bottom-left-radius: 4px;
	color: var(--stc-texto);
}

.st-chatbot .st-chatbot__parrafo {
	font-size: 0.95rem;
	margin: 0;
}

.st-chatbot .st-chatbot__parrafo + .st-chatbot__parrafo {
	margin-top: 0.5rem;
}

/* Tarjetas */
.st-chatbot .st-chatbot__tarjetas {
	display: grid;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.st-chatbot .st-chatbot__tarjeta-item {
	margin: 0;
	padding: 0;
}

.st-chatbot .st-chatbot__tarjeta {
	align-items: start;
	background: var(--stc-fondo);
	border: 1px solid var(--stc-borde);
	border-radius: 12px;
	color: var(--stc-texto);
	display: grid;
	gap: 0.65rem;
	grid-template-columns: 72px 1fr;
	padding: 0.5rem;
	text-decoration: none;
}

.st-chatbot .st-chatbot__tarjeta:hover {
	border-color: var(--stc-acento);
}

.st-chatbot__tarjeta-img {
	border-radius: 8px;
	display: block;
	height: 72px;
	object-fit: cover;
	width: 72px;
}

.st-chatbot__tarjeta-img--vacia {
	background: linear-gradient(135deg, #f4ede4, #e3d3bf);
}

.st-chatbot__tarjeta-cuerpo {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

.st-chatbot__tarjeta-etiqueta {
	color: var(--stc-suave);
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.st-chatbot__tarjeta-titulo {
	color: var(--stc-acento);
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.3;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.st-chatbot__tarjeta-fecha {
	color: var(--stc-texto);
	font-size: 0.82rem;
	font-weight: 600;
}

.st-chatbot__tarjeta-texto {
	color: var(--stc-suave);
	font-size: 0.82rem;
	line-height: 1.35;
}

/* Mapa */
.st-chatbot .st-chatbot__mapa {
	border: 1px solid var(--stc-borde);
	border-radius: 12px;
	height: 200px;
	margin: 0;
	overflow: hidden;
	width: 100%;
}

/* Derivación */
.st-chatbot__derivacion {
	background: var(--stc-aviso);
	border: 1px solid #e8c98f;
	border-left: 4px solid var(--stc-acento);
	border-radius: 10px;
	font-size: 0.9rem;
	padding: 0.65rem 0.85rem;
}

.st-chatbot .st-chatbot__derivacion-titulo {
	color: var(--stc-suave);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	margin: 0;
	text-transform: uppercase;
}

.st-chatbot .st-chatbot__derivacion-nombre {
	font-weight: 700;
	margin: 0.15rem 0 0.35rem;
}

.st-chatbot .st-chatbot__derivacion-lista {
	list-style: none;
	margin: 0;
	padding: 0;
}

.st-chatbot .st-chatbot__derivacion-lista li {
	margin: 0.15rem 0;
}

.st-chatbot__derivacion-etiqueta {
	font-weight: 600;
}

.st-chatbot__derivacion a {
	color: var(--stc-acento);
	text-decoration: underline;
	word-break: break-word;
}

/* Escribiendo */
.st-chatbot__puntos {
	display: inline-flex;
	gap: 4px;
	padding: 0.2rem 0;
}

.st-chatbot__puntos span {
	animation: st-chatbot-punto 1.2s infinite ease-in-out;
	background: var(--stc-suave);
	border-radius: 50%;
	display: block;
	height: 8px;
	width: 8px;
}

.st-chatbot__puntos span:nth-child(2) {
	animation-delay: 0.15s;
}

.st-chatbot__puntos span:nth-child(3) {
	animation-delay: 0.3s;
}

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

/* ---------------- Sugerencias ---------------- */

.st-chatbot__sugerencias {
	background: var(--stc-fondo-log);
	padding: 0 0.85rem 0.75rem;
}

.st-chatbot .st-chatbot__sugerencias-titulo {
	color: var(--stc-suave);
	font-size: 0.8rem;
	margin: 0 0 0.4rem;
}

.st-chatbot__sugerencias-lista {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.st-chatbot__sugerencia {
	background: var(--stc-fondo);
	border: 1px solid var(--stc-acento);
	border-radius: 999px;
	color: var(--stc-acento);
	cursor: pointer;
	font: inherit;
	font-size: 0.88rem;
	font-weight: 600;
	min-height: 36px;
	padding: 0.35rem 0.8rem;
}

.st-chatbot__sugerencia:hover {
	background: #f7ebe4;
}

/* ---------------- Formulario ---------------- */

.st-chatbot__formulario {
	align-items: center;
	border-top: 1px solid var(--stc-borde);
	display: flex;
	gap: 0.5rem;
	margin: 0;
	padding: 0.65rem 0.75rem 0.4rem;
}

.st-chatbot .st-chatbot__campo {
	background: var(--stc-fondo);
	border: 1px solid var(--stc-borde-campo);
	border-radius: 10px;
	color: var(--stc-texto);
	flex: 1;
	font: inherit;
	font-size: 16px; /* evita el zoom automático en iOS */
	margin: 0;
	min-height: 44px;
	min-width: 0;
	padding: 0.5rem 0.75rem;
}

.st-chatbot .st-chatbot__campo::placeholder {
	color: #6b625a;
	opacity: 1;
}

.st-chatbot__enviar {
	align-items: center;
	background: var(--stc-acento);
	border: 0;
	border-radius: 10px;
	color: #ffffff;
	cursor: pointer;
	display: inline-flex;
	flex: none;
	height: 44px;
	justify-content: center;
	padding: 0;
	width: 44px;
}

.st-chatbot__enviar:hover {
	background: var(--stc-acento-oscuro);
}

.st-chatbot__formulario[aria-busy="true"] .st-chatbot__enviar {
	opacity: 0.7;
}

.st-chatbot .st-chatbot__aviso {
	color: var(--stc-suave);
	font-size: 0.75rem;
	line-height: 1.35;
	margin: 0;
	padding: 0 0.85rem 0.65rem;
}

/* ---------------- Móvil ---------------- */

@media (max-width: 600px) {
	.st-chatbot {
		bottom: 12px;
		right: 12px;
	}

	.st-chatbot__lanzador {
		height: 56px;
		justify-content: center;
		padding: 0;
		width: 56px;
	}

	.st-chatbot__lanzador-texto {
		display: none;
	}

	.st-chatbot__panel {
		border-radius: 14px;
		bottom: 80px;
		height: calc(100vh - 96px);
		height: calc(100dvh - 96px);
		left: 8px;
		position: fixed;
		right: 8px;
		width: auto;
	}
}

@media (max-height: 520px) {
	.st-chatbot__panel {
		height: calc(100vh - 90px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.st-chatbot__puntos span {
		animation: none;
		opacity: 0.7;
	}
}

@media (forced-colors: active) {
	.st-chatbot__lanzador,
	.st-chatbot__enviar,
	.st-chatbot__burbuja,
	.st-chatbot__tarjeta,
	.st-chatbot__derivacion {
		border: 1px solid CanvasText;
	}
}
