/* Criterio Operativo — Chatbot IA (widget)
 * Estilo sobrio: hereda la tipografía del tema, un solo color de acento
 * (configurable en Ajustes), bordes finos y sin animaciones gratuitas.
 */

.co-cb {
	--co-cb-accent: #101828;
	--co-cb-ink: #1a1f2b;
	--co-cb-line: rgba(16, 24, 40, 0.14);
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--co-cb-ink);
}

/* ---------- Botón flotante ---------- */

.co-cb__launcher {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 12px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--co-cb-accent);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.01em;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(16, 24, 40, 0.22);
}

.co-cb__launcher:hover { filter: brightness(1.12); }
.co-cb__launcher:focus-visible,
.co-cb__close:focus-visible,
.co-cb__send:focus-visible,
.co-cb__input:focus-visible {
	outline: 2px solid var(--co-cb-accent);
	outline-offset: 2px;
}

.co-cb__launcher-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #4ade80;
	flex: 0 0 auto;
}

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

.co-cb__panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 12px);
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 110px);
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--co-cb-line);
	border-radius: 14px;
	box-shadow: 0 18px 50px rgba(16, 24, 40, 0.25);
	overflow: hidden;
}

.co-cb__panel[hidden] { display: none; }

/* ---------- Cabecera ---------- */

.co-cb__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: var(--co-cb-accent);
	color: #fff;
}

.co-cb__title { font-weight: 700; font-size: 15px; }
.co-cb__subtitle { font-size: 12px; opacity: 0.75; margin-top: 1px; }

.co-cb__close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 6px;
	opacity: 0.85;
}
.co-cb__close:hover { opacity: 1; }

/* ---------- Conversación ---------- */

.co-cb__log {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafafa;
}

.co-cb__msg {
	max-width: 86%;
	padding: 9px 13px;
	border-radius: 12px;
	white-space: normal;
	overflow-wrap: break-word;
}

.co-cb__msg--bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--co-cb-line);
	border-bottom-left-radius: 4px;
}

.co-cb__msg--user {
	align-self: flex-end;
	background: var(--co-cb-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}

/* Indicador de escritura */

.co-cb__typing { display: inline-flex; gap: 5px; padding: 12px 14px; }
.co-cb__typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(16, 24, 40, 0.45);
	animation: co-cb-blink 1.1s infinite ease-in-out;
}
.co-cb__typing span:nth-child(2) { animation-delay: 0.18s; }
.co-cb__typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes co-cb-blink {
	0%, 70%, 100% { opacity: 0.25; }
	35% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.co-cb__typing span { animation: none; opacity: 0.6; }
}

/* ---------- Entrada ---------- */

.co-cb__form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--co-cb-line);
	background: #fff;
}

.co-cb__input {
	flex: 1;
	resize: none;
	border: 1px solid var(--co-cb-line);
	border-radius: 10px;
	padding: 9px 12px;
	font: inherit;
	font-size: 14px;
	color: var(--co-cb-ink);
	background: #fff;
	max-height: 110px;
}

.co-cb__send {
	border: 0;
	border-radius: 10px;
	background: var(--co-cb-accent);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	padding: 10px 16px;
	cursor: pointer;
}

.co-cb__send:disabled { opacity: 0.55; cursor: default; }
.co-cb__send:hover:not(:disabled) { filter: brightness(1.12); }

/* ---------- Móvil: hoja inferior a pantalla completa ---------- */

@media (max-width: 480px) {
	.co-cb { right: 14px; bottom: 14px; }
	.co-cb__panel {
		position: fixed;
		inset: auto 0 0 0;
		width: 100%;
		max-width: none;
		height: 82vh;
		max-height: none;
		border-radius: 16px 16px 0 0;
	}
	.co-cb--open .co-cb__launcher { display: none; }
}

/* Enlaces dentro de los mensajes */

.co-cb__msg--bot a { color: var(--co-cb-accent); font-weight: 600; text-decoration: underline; }
.co-cb__msg--user a { color: #fff; text-decoration: underline; }
