/**
 * Botón flotante (asistente FAQ) + panel con animaciones.
 */

.bc-faq-launcher {
	--bc-faq-launcher-size: 60px;
	--bc-faq-launcher-gap: 14px;
	--bc-faq-launcher-panel-w: min(400px, calc(100vw - 32px));

	position: fixed;
	right: max(18px, env(safe-area-inset-right, 0px));
	bottom: max(18px, env(safe-area-inset-bottom, 0px));
	z-index: 99999;
}

.bc-faq-launcher__backdrop {
	position: fixed;
	inset: 0;
	z-index: 99998;
	border: none;
	padding: 0;
	background: rgb(0 51 68 / 42%);
	opacity: 0;
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	transition: opacity 0.32s ease;
	pointer-events: none;
	cursor: pointer;
}

.bc-faq-launcher__backdrop[hidden] {
	display: block !important;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__backdrop {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

.bc-faq-launcher__fab {
	position: relative;
	z-index: 100000;
	display: grid;
	place-items: center;
	width: var(--bc-faq-launcher-size);
	height: var(--bc-faq-launcher-size);
	padding: 0;
	border: 2px solid rgb(255 255 255 / 22%);
	border-radius: 999px;
	background: linear-gradient(145deg, #008aa8 0%, #007392 52%, #005f78 100%);
	box-shadow:
		0 14px 34px rgb(0 51 68 / 32%),
		0 0 0 0 rgb(0 115 146 / 45%);
	color: var(--bc-color-white, #fff);
	cursor: pointer;
	animation: bc-faq-bot-idle 3.6s ease-in-out infinite;
	transition:
		transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1),
		box-shadow 0.28s ease,
		border-color 0.28s ease;
}

.bc-faq-launcher__fab::before {
	content: "";
	position: absolute;
	inset: -6px;
	border-radius: inherit;
	border: 2px solid rgb(0 115 146 / 35%);
	opacity: 0;
	animation: bc-faq-bot-ring 2.8s ease-out infinite;
	pointer-events: none;
}

.bc-faq-launcher__fab:hover,
.bc-faq-launcher__fab:focus-visible {
	transform: translateY(-3px) scale(1.04);
	box-shadow:
		0 18px 40px rgb(0 51 68 / 38%),
		0 0 0 6px rgb(0 115 146 / 18%);
	border-color: rgb(255 255 255 / 36%);
	animation-play-state: paused;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__fab {
	animation: none;
	transform: scale(0.96);
	box-shadow: 0 10px 24px rgb(0 51 68 / 28%);
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__fab::before {
	animation: none;
	opacity: 0;
}

.bc-faq-launcher__bot {
	display: block;
	width: 34px;
	height: 34px;
	transition: transform 0.28s ease;
}

.bc-faq-launcher__fab:hover .bc-faq-launcher__bot,
.bc-faq-launcher__fab:focus-visible .bc-faq-launcher__bot {
	transform: scale(1.06);
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__bot-face {
	opacity: 0;
	transform: scale(0.85);
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__bot-close {
	opacity: 1;
	transform: scale(1);
}

.bc-faq-launcher__bot-face,
.bc-faq-launcher__bot-close {
	position: absolute;
	transition:
		opacity 0.22s ease,
		transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.bc-faq-launcher__bot-close {
	opacity: 0;
	transform: scale(0.7);
	font-size: 1.625rem;
	font-weight: 300;
	line-height: 1;
}

.bc-faq-launcher__badge {
	position: absolute;
	top: -2px;
	right: -2px;
	display: grid;
	place-items: center;
	width: 20px;
	height: 20px;
	border: 2px solid var(--bc-color-white, #fff);
	border-radius: 999px;
	background: #003344;
	font-family: var(--bc-font-heading, "Albert Sans", sans-serif);
	font-size: 0.6875rem;
	font-weight: 800;
	line-height: 1;
	animation: bc-faq-badge-pop 3.6s ease-in-out infinite;
	pointer-events: none;
}

.bc-faq-launcher__panel {
	position: absolute;
	right: 0;
	bottom: calc(var(--bc-faq-launcher-size) + var(--bc-faq-launcher-gap));
	z-index: 99999;
	display: flex;
	flex-direction: column;
	width: var(--bc-faq-launcher-panel-w);
	min-height: 420px;
	max-height: min(78vh, 680px);
	overflow: hidden;
	border: 1px solid rgb(255 255 255 / 18%);
	border-radius: 16px;
	background: var(--bc-color-bg-white, #fff);
	box-shadow:
		0 24px 60px rgb(0 51 68 / 28%),
		0 8px 20px rgb(0 51 68 / 12%);
	opacity: 0;
	visibility: hidden;
	transform: translateY(18px) scale(0.94);
	transform-origin: right bottom;
	transition:
		opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
		transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
		visibility 0.34s;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

.bc-faq-launcher__panel[hidden] {
	display: none !important;
}

.bc-faq-launcher[data-state="closed"] .bc-faq-launcher__panel {
	pointer-events: none;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__panel {
	pointer-events: auto;
}

.bc-faq-launcher__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--bc-color-border, #d8e4ea);
	background: linear-gradient(180deg, rgb(245 248 249 / 100%) 0%, rgb(255 255 255 / 100%) 100%);
	opacity: 0;
	transform: translateY(8px);
	transition:
		opacity 0.32s ease 0.08s,
		transform 0.36s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

.bc-faq-launcher__head-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.bc-faq-launcher__head-avatar {
	display: grid;
	place-items: center;
	flex-shrink: 0;
	width: 38px;
	height: 38px;
	border-radius: 999px;
	background: linear-gradient(145deg, #008aa8 0%, #007392 100%);
	color: var(--bc-color-white, #fff);
}

.bc-faq-launcher__head-avatar svg {
	width: 24px;
	height: 24px;
}

.bc-faq-launcher__status {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 2px 0 0;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--bc-color-text-muted, #5a7280);
}

.bc-faq-launcher__status-dot {
	width: 7px;
	height: 7px;
	border-radius: 999px;
	background: #2ecc71;
	box-shadow: 0 0 0 0 rgb(46 204 113 / 55%);
	animation: bc-faq-status-pulse 2.4s ease infinite;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__head {
	opacity: 1;
	transform: translateY(0);
}

.bc-faq-launcher__eyebrow {
	display: none;
}

.bc-faq-launcher__title {
	margin: 0;
	font-family: var(--bc-font-heading, "Albert Sans", sans-serif);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	color: var(--bc-color-primary, #003344);
}

.bc-faq-launcher__close {
	display: grid;
	place-items: center;
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	padding: 0;
	border: none;
	border-radius: 999px;
	background: transparent;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--bc-color-text-muted, #5a7280);
	cursor: pointer;
	transition:
		background-color 0.2s ease,
		transform 0.2s ease;
}

.bc-faq-launcher__close:hover,
.bc-faq-launcher__close:focus-visible {
	background: rgb(0 115 146 / 10%);
	color: var(--bc-color-primary, #003344);
	transform: rotate(90deg);
}

.bc-faq-launcher__body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	padding: 0;
	overflow: hidden;
}

/* --- Chat --- */

.bc-faq-launcher__chat {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	background: rgb(245 248 249 / 90%);
}

.bc-faq-launcher__messages {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px 14px 10px;
	overflow-y: auto;
	scroll-behavior: smooth;
}

.bc-faq-launcher__msg {
	max-width: 92%;
	animation: bc-faq-msg-in 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.bc-faq-launcher__msg--bot {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	align-self: flex-start;
}

.bc-faq-launcher__msg--user {
	align-self: flex-end;
}

.bc-faq-launcher__avatar {
	display: grid;
	place-items: center;
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 999px;
	background: linear-gradient(145deg, #008aa8 0%, #007392 100%);
	color: var(--bc-color-white, #fff);
}

.bc-faq-launcher__avatar svg {
	width: 18px;
	height: 18px;
}

.bc-faq-launcher__bubble {
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 0.875rem;
	line-height: 1.55;
}

.bc-faq-launcher__msg--bot .bc-faq-launcher__bubble {
	border: 1px solid rgb(0 115 146 / 12%);
	border-bottom-left-radius: 6px;
	background: var(--bc-color-bg-white, #fff);
	color: var(--bc-color-text, #003344);
	box-shadow: 0 2px 8px rgb(0 51 68 / 6%);
}

.bc-faq-launcher__msg--user .bc-faq-launcher__bubble {
	border-bottom-right-radius: 6px;
	background: linear-gradient(135deg, #008aa8 0%, #007392 100%);
	color: var(--bc-color-white, #fff);
	box-shadow: 0 4px 14px rgb(0 115 146 / 22%);
}

.bc-faq-launcher__bubble p {
	margin: 0;
}

.bc-faq-launcher__typing {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 1.2em;
}

.bc-faq-launcher__typing span {
	width: 6px;
	height: 6px;
	border-radius: 999px;
	background: var(--bc-color-accent, #007392);
	opacity: 0.35;
	animation: bc-faq-typing 1.1s ease-in-out infinite;
}

.bc-faq-launcher__typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.bc-faq-launcher__typing span:nth-child(3) {
	animation-delay: 0.3s;
}

.bc-faq-launcher__answer {
	word-break: break-word;
}

.bc-faq-launcher__cursor {
	display: inline-block;
	width: 2px;
	height: 1em;
	margin-left: 1px;
	vertical-align: text-bottom;
	background: var(--bc-color-accent, #007392);
	animation: bc-faq-cursor-blink 0.85s step-end infinite;
}

.bc-faq-launcher__options-wrap {
	flex-shrink: 0;
	padding: 12px 14px 14px;
	border-top: 1px solid var(--bc-color-border, #d8e4ea);
	background: var(--bc-color-bg-white, #fff);
	transition: opacity 0.2s ease;
}

.bc-faq-launcher__options-wrap.is-busy {
	opacity: 0.72;
}

.bc-faq-launcher__options-label {
	margin: 0 0 8px;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--bc-color-text-muted, #5a7280);
}

.bc-faq-launcher__options {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 168px;
	overflow-y: auto;
}

.bc-faq-launcher__option {
	display: block;
	width: 100%;
	padding: 11px 14px;
	border: 1px solid rgb(0 115 146 / 22%);
	border-radius: 12px;
	background: rgb(245 248 249 / 80%);
	font-family: var(--bc-font-body, "Albert Sans", sans-serif);
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.45;
	text-align: left;
	color: var(--bc-color-primary, #003344);
	cursor: pointer;
	transition:
		background-color 0.2s ease,
		border-color 0.2s ease,
		transform 0.2s ease,
		box-shadow 0.2s ease,
		color 0.2s ease;
}

.bc-faq-launcher__option:hover,
.bc-faq-launcher__option:focus-visible {
	border-color: rgb(0 115 146 / 45%);
	background: rgb(0 115 146 / 8%);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgb(0 115 146 / 10%);
}

.bc-faq-launcher__option.is-selected {
	border-color: transparent;
	background: linear-gradient(135deg, #008aa8 0%, #007392 100%);
	color: var(--bc-color-white, #fff);
	box-shadow: 0 4px 14px rgb(0 115 146 / 22%);
}

.bc-faq-launcher__option:disabled {
	cursor: wait;
	opacity: 0.65;
	transform: none;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__option {
	animation: bc-faq-option-in 0.36s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__option:nth-child(1) {
	animation-delay: 0.1s;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__option:nth-child(2) {
	animation-delay: 0.16s;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__option:nth-child(3) {
	animation-delay: 0.22s;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__option:nth-child(4) {
	animation-delay: 0.28s;
}

.bc-faq-launcher[data-state="open"] .bc-faq-launcher__option:nth-child(5) {
	animation-delay: 0.34s;
}

body.bc-faq-launcher-open {
	overflow: hidden;
}

@keyframes bc-faq-bot-idle {
	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-4px);
	}
}

@keyframes bc-faq-bot-ring {
	0% {
		opacity: 0.65;
		transform: scale(1);
	}

	100% {
		opacity: 0;
		transform: scale(1.35);
	}
}

@keyframes bc-faq-badge-pop {
	0%,
	100% {
		transform: scale(1);
	}

	50% {
		transform: scale(1.08);
	}
}

@keyframes bc-faq-status-pulse {
	0%,
	100% {
		box-shadow: 0 0 0 0 rgb(46 204 113 / 45%);
	}

	50% {
		box-shadow: 0 0 0 5px rgb(46 204 113 / 0%);
	}
}

@keyframes bc-faq-msg-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes bc-faq-option-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes bc-faq-typing {
	0%,
	80%,
	100% {
		opacity: 0.35;
		transform: translateY(0);
	}

	40% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

@keyframes bc-faq-cursor-blink {
	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0;
	}
}

@media (max-width: 480px) {
	.bc-faq-launcher {
		right: max(12px, env(safe-area-inset-right, 0px));
		bottom: max(12px, env(safe-area-inset-bottom, 0px));
	}

	.bc-faq-launcher__panel {
		width: calc(100vw - 24px);
		max-height: min(78vh, 640px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.bc-faq-launcher__fab,
	.bc-faq-launcher__fab::before,
	.bc-faq-launcher__badge,
	.bc-faq-launcher__panel,
	.bc-faq-launcher__head,
	.bc-faq-launcher__msg,
	.bc-faq-launcher__option,
	.bc-faq-launcher__status-dot,
	.bc-faq-launcher__cursor {
		animation: none !important;
		transition: none !important;
	}

	.bc-faq-launcher__head {
		opacity: 1;
		transform: none;
	}
}
