/* Beforeboarding Chat BBAI */
.bbai-chat {
	--bbai-color: #9E0B0F;
	--bbai-bg: #fff;
	--bbai-text: #1f1f1f;
	--bbai-muted: #6b6b6b;
	--bbai-bubble: #f2f2f2;
	--bbai-border: #e4e4e4;
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 999999;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--bbai-text);
}
.bbai-chat--left { right: auto; left: 24px; }
.bbai-chat *, .bbai-chat *::before, .bbai-chat *::after { box-sizing: border-box; }

.bbai-chat__launcher {
	display: block;
	width: 64px;
	height: 64px;
	padding: 0;
	margin: 0 0 0 auto;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .28));
	transition: transform .15s ease;
}
.bbai-chat--left .bbai-chat__launcher { margin: 0 auto 0 0; }
.bbai-chat__launcher:hover { transform: scale(1.06); }
.bbai-chat__launcher:focus-visible { outline: 3px solid var(--bbai-color); outline-offset: 3px; }
.bbai-chat__launcher img { display: block; width: 100%; height: 100%; }

.bbai-chat__panel {
	position: absolute;
	bottom: 80px;
	right: 0;
	display: flex;
	flex-direction: column;
	width: 370px;
	height: 560px;
	max-height: calc(100vh - 120px);
	overflow: hidden;
	background: var(--bbai-bg);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
	visibility: hidden;
	transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.bbai-chat--left .bbai-chat__panel { right: auto; left: 0; }
.bbai-chat.is-open .bbai-chat__panel {
	opacity: 1;
	transform: none;
	pointer-events: auto;
	visibility: visible;
	transition: opacity .18s ease, transform .18s ease;
}

.bbai-chat__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 12px 14px 16px;
	background: var(--bbai-color);
	color: #fff;
}
.bbai-chat__avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; background: #fff; padding: 4px; }
.bbai-chat__heading { flex: 1; min-width: 0; }
.bbai-chat__title { margin: 0; padding: 0; font-size: 16px; font-weight: 700; line-height: 1.2; color: #fff; }
.bbai-chat__subtitle { margin: 0; font-size: 12px; opacity: .85; }
.bbai-chat__icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	cursor: pointer;
}
.bbai-chat__icon-btn:hover { background: rgba(255, 255, 255, .15); }
.bbai-chat__icon-btn svg { width: 20px; height: 20px; }

.bbai-chat__messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #fafafa;
	overscroll-behavior: contain;
}
.bbai-chat__msg { display: flex; margin: 0 0 10px; }
.bbai-chat__msg--user { justify-content: flex-end; }
.bbai-chat__bubble {
	max-width: 85%;
	padding: 9px 13px;
	border-radius: 14px;
	background: var(--bbai-bg);
	border: 1px solid var(--bbai-border);
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.bbai-chat__msg--user .bbai-chat__bubble {
	background: var(--bbai-color);
	border-color: var(--bbai-color);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.bbai-chat__msg--bot .bbai-chat__bubble { border-bottom-left-radius: 4px; }
.bbai-chat__msg--error .bbai-chat__bubble { background: #fff4f4; border-color: #f1c7c7; color: #8a1c1c; }
.bbai-chat__bubble p { margin: 0 0 .5em; padding: 0; }
.bbai-chat__bubble p:last-child { margin-bottom: 0; }
.bbai-chat__bubble ul, .bbai-chat__bubble ol { margin: .25em 0 .5em 1.2em; padding: 0; }
.bbai-chat__bubble ul { list-style: disc outside; }
.bbai-chat__bubble ol { list-style: decimal outside; }
.bbai-chat__bubble li { display: list-item; margin: 0 0 .2em; padding: 0; }
.bbai-chat__bubble a { color: var(--bbai-color); text-decoration: underline; }
.bbai-chat__sources { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--bbai-border); font-size: 12px; color: var(--bbai-muted); }

.bbai-chat__typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.bbai-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #9a9a9a;
	animation: bbai-chat-dot 1.2s infinite ease-in-out;
}
.bbai-chat__typing span:nth-child(2) { animation-delay: .15s; }
.bbai-chat__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bbai-chat-dot {
	0%, 80%, 100% { opacity: .3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

.bbai-chat__form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--bbai-border);
	background: var(--bbai-bg);
}
.bbai-chat__input {
	flex: 1;
	min-height: 40px;
	max-height: 120px;
	margin: 0;
	padding: 9px 12px;
	border: 1px solid var(--bbai-border);
	border-radius: 20px;
	font: inherit;
	line-height: 20px;
	color: var(--bbai-text);
	background: #fff;
	resize: none;
	overflow-y: hidden;
	scrollbar-width: thin;
	box-shadow: none;
}
.bbai-chat__input:focus { outline: none; border-color: var(--bbai-color); }
.bbai-chat__send {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--bbai-color);
	color: #fff;
	cursor: pointer;
}
.bbai-chat__send:disabled { opacity: .5; cursor: default; }
.bbai-chat__send svg { width: 18px; height: 18px; vertical-align: middle; }

.bbai-chat.is-handoff { display: none !important; }
.bbai-chat__human,
.bbai-chat__offer {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	border: 1px solid var(--bbai-color);
	border-radius: 18px;
	background: #fff;
	color: var(--bbai-color);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}
.bbai-chat__human svg,
.bbai-chat__offer svg { flex: 0 0 16px; width: 16px; height: 16px; }
.bbai-chat__human:hover,
.bbai-chat__offer:hover { background: var(--bbai-color); color: #fff; }
.bbai-chat__human {
	align-self: center;
	margin: 12px auto;
	padding: 7px 16px;
	border-color: var(--bbai-border);
	color: var(--bbai-muted);
	font-weight: 500;
}
.bbai-chat__human:hover { border-color: var(--bbai-color); }
.bbai-chat__offer { margin-top: 8px; padding: 7px 14px; }

@media (max-width: 480px) {
	.bbai-chat { bottom: 16px; right: 16px; }
	.bbai-chat--left { left: 16px; }
	.bbai-chat__launcher { width: 56px; height: 56px; }
	.bbai-chat.is-open .bbai-chat__launcher { display: none; }
	.bbai-chat__panel {
		position: fixed;
		inset: 0;
		width: auto;
		height: auto;
		max-height: none;
		border-radius: 0;
	}
	.bbai-chat__input { font-size: 16px; } /* evita el zoom de iOS */
}

@media print { .bbai-chat { display: none !important; } }
