/* Chatbot Asistente del Sitio — estilos del widget */

/* Botón flotante (abajo a la izquierda, para no tapar el botón de WhatsApp) */
.cba-boton {
	position: fixed;
	bottom: 24px;
	left: 24px;
	z-index: 99998;
	width: 60px;
	height: 60px;
	border: none;
	border-radius: 50%;
	background: #1f3a5f;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cba-boton:hover,
.cba-boton:focus {
	transform: scale(1.08);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
	background: #2a4d7d;
}
.cba-boton.cba-oculto {
	display: none;
}

/* Panel del chat */
.cba-panel {
	position: fixed;
	bottom: 24px;
	left: 24px;
	z-index: 99999;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 48px);
	display: none;
	flex-direction: column;
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}
.cba-panel.cba-abierto {
	display: flex;
}

/* Cabecera */
.cba-cabecera {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: #1f3a5f;
	color: #fff;
}
.cba-cabecera-texto {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.cba-cabecera-texto strong {
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.cba-estado {
	font-size: 12px;
	opacity: 0.8;
}
.cba-estado::before {
	content: "●";
	color: #4ade80;
	margin-right: 5px;
	font-size: 10px;
}
.cba-cerrar {
	border: none;
	background: transparent;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	opacity: 0.85;
}
.cba-cerrar:hover {
	opacity: 1;
}

/* Zona de mensajes */
.cba-mensajes {
	flex: 1;
	overflow-y: auto;
	padding: 16px 12px;
	background: #f4f6f9;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.cba-fila {
	display: flex;
	flex-direction: column;
	max-width: 85%;
}
.cba-fila-assistant {
	align-self: flex-start;
	align-items: flex-start;
}
.cba-fila-user {
	align-self: flex-end;
	align-items: flex-end;
}
.cba-burbuja {
	padding: 10px 13px;
	border-radius: 14px;
	word-wrap: break-word;
	overflow-wrap: break-word;
}
.cba-fila-assistant .cba-burbuja {
	background: #fff;
	color: #1f2937;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 4px;
}
.cba-fila-user .cba-burbuja {
	background: #1f3a5f;
	color: #fff;
	border-bottom-right-radius: 4px;
}

/* Enlaces sugeridos bajo una respuesta */
.cba-enlaces {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 6px;
}
.cba-enlace {
	display: inline-block;
	padding: 6px 12px;
	border-radius: 999px;
	background: #e8eef7;
	color: #1f3a5f !important;
	text-decoration: none !important;
	font-size: 13px;
	border: 1px solid #c9d6ea;
	transition: background 0.15s ease;
}
.cba-enlace:hover {
	background: #d9e4f2;
}

/* Sugerencias iniciales */
.cba-sugerencias {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.cba-sugerencia {
	border: 1px solid #c9d6ea;
	background: #fff;
	color: #1f3a5f;
	border-radius: 999px;
	padding: 7px 13px;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s ease;
}
.cba-sugerencia:hover {
	background: #e8eef7;
}

/* Indicador escribiendo */
.cba-escribiendo .cba-burbuja {
	display: flex;
	gap: 4px;
	align-items: center;
	padding: 12px 14px;
}
.cba-punto {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #94a3b8;
	animation: cba-rebote 1.2s infinite ease-in-out;
}
.cba-punto:nth-child(2) {
	animation-delay: 0.15s;
}
.cba-punto:nth-child(3) {
	animation-delay: 0.3s;
}
@keyframes cba-rebote {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* Pie con el campo de texto */
.cba-pie {
	display: flex;
	gap: 8px;
	padding: 10px;
	background: #fff;
	border-top: 1px solid #e5e7eb;
	margin: 0;
}
.cba-campo {
	flex: 1;
	border: 1px solid #d1d5db;
	border-radius: 999px;
	padding: 9px 15px;
	font-size: 14px;
	outline: none;
	min-width: 0;
}
.cba-campo:focus {
	border-color: #1f3a5f;
	box-shadow: 0 0 0 2px rgba(31, 58, 95, 0.15);
}
.cba-enviar {
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	border: none;
	border-radius: 50%;
	background: #1f3a5f;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}
.cba-enviar:hover:not(:disabled) {
	background: #2a4d7d;
}
.cba-enviar:disabled {
	opacity: 0.5;
	cursor: default;
}

/* Móvil: el panel ocupa casi toda la pantalla */
@media (max-width: 480px) {
	.cba-boton {
		width: 52px;
		height: 52px;
		bottom: 16px;
		left: 16px;
	}
	.cba-panel {
		left: 8px;
		right: 8px;
		bottom: 8px;
		width: auto;
		height: calc(100vh - 90px);
		max-height: none;
	}
}
