/*
 * Khung chat trợ lý du lịch (js/chatbot.js). Nút mở nằm trong cụm nút liên hệ nổi (topbar.html).
 * Mọi class có tiền tố "blc-" để không đụng style cũ.
 */
.blc {
	--blc-forest: #1c3528;
	--blc-moss: #2e6b4a;
	--blc-moss-soft: #e6efe8;
	--blc-paper: #f7f4ec;
	--blc-ink: #1f2a23;
	--blc-muted: #59635a;
	--blc-line: #e6e0d2;
	--blc-gold: #c08526;
	--blc-gold-soft: #f6ead3;
	position: fixed;
	right: 84px;
	bottom: 22px;
	z-index: 9995;
	width: 370px;
	height: min(600px, calc(100vh - 120px));
	display: none;
	flex-direction: column;
	background: var(--blc-paper);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(28, 53, 40, .25);
	overflow: hidden;
	font-family: 'Open Sans', sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: var(--blc-ink);
}

.blc.open {
	display: flex;
}

.blc-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: var(--blc-forest);
	color: #fff;
}

.blc-head-text {
	flex: 1;
	min-width: 0;
}

.blc-title {
	font-weight: 700;
	font-size: 15px;
}

.blc-sub {
	font-size: 11.5px;
	opacity: .75;
}

.blc-icon-btn {
	border: 0;
	background: transparent;
	color: inherit;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
}

.blc-icon-btn:hover,
.blc-icon-btn:focus-visible {
	background: rgba(255, 255, 255, .14);
	outline: none;
}

.blc-body {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.blc-msg {
	max-width: 88%;
	padding: 9px 12px;
	border-radius: 14px;
	word-wrap: break-word;
	white-space: normal;
}

.blc-msg.bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--blc-line);
	border-bottom-left-radius: 4px;
}

.blc-msg.user {
	align-self: flex-end;
	background: var(--blc-moss);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.blc-msg a {
	color: var(--blc-moss);
	font-weight: 600;
	text-decoration: underline;
}

.blc-msg ul {
	margin: 4px 0;
	padding-left: 18px;
}

.blc-msg li {
	margin: 2px 0;
	list-style: disc;
}

.blc-links {
	margin-top: 6px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.blc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.blc-chip {
	border: 1px solid var(--blc-gold);
	background: var(--blc-gold-soft);
	color: var(--blc-ink);
	border-radius: 999px;
	padding: 5px 11px;
	font-size: 13px;
	cursor: pointer;
	text-align: left;
}

.blc-chip:hover,
.blc-chip:focus-visible {
	background: #efdcb8;
	outline: none;
}

/* đang trả lời: ba chấm nhảy kèm bước đang làm, rồi chữ hiện dần với con trỏ nhấp nháy (chatbot.js paintLive) */
.blc-typing {
	align-self: flex-start;
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--blc-muted);
	font-size: 13px;
	font-style: italic;
}

.blc-dots {
	display: inline-flex;
	gap: 4px;
	padding: 9px 12px;
	background: #fff;
	border: 1px solid var(--blc-line);
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}

.blc-dots i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--blc-moss);
	opacity: .35;
	animation: blc-dot 1.1s infinite ease-in-out;
}

.blc-dots i:nth-child(2) { animation-delay: .15s; }
.blc-dots i:nth-child(3) { animation-delay: .3s; }

@keyframes blc-dot {
	0%, 60%, 100% { opacity: .35; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-3px); }
}

.blc-caret {
	display: inline-block;
	width: 7px;
	height: 1em;
	margin-left: 2px;
	vertical-align: -2px;
	background: var(--blc-moss);
	border-radius: 1px;
	animation: blc-caret 1s steps(1) infinite;
}

/* con trỏ nằm sau danh sách thì kéo lên cuối dòng gạch đầu dòng cuối cho gọn */
.blc-live ul + .blc-caret {
	margin-top: -4px;
}

@keyframes blc-caret {
	50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.blc-dots i,
	.blc-caret {
		animation: none;
		opacity: 1;
	}
}

/* thanh nhập kiểu Messenger: ô bo tròn tự giãn theo nội dung (chatbot.js fit()), nút gửi tròn bám đáy */
.blc-foot {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 10px 8px 12px;
	border-top: 1px solid var(--blc-line);
	background: #fff;
}

.blc-input {
	flex: 1;
	box-sizing: border-box;
	min-height: 38px;
	max-height: 140px;
	resize: none;
	overflow-y: hidden;
	border: 1px solid transparent;
	border-radius: 19px;
	padding: 8px 14px;
	background: #eef2ee;
	font: inherit;
	line-height: 20px;
	color: var(--blc-ink);
	transition: background-color 150ms ease, border-color 150ms ease;
	scrollbar-width: thin;
}

/* chỉ hiện thanh cuộn khi đã giãn tối đa */
.blc-input.blc-input-scroll {
	overflow-y: auto;
}

.blc-input::placeholder {
	color: #7d877f;
}

.blc-input:focus {
	outline: none;
	background: #fff;
	border-color: var(--blc-moss);
}

.blc-send {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--blc-moss);
	color: #fff;
	cursor: pointer;
	transition: background-color 150ms ease, transform 150ms ease;
}

.blc-send svg {
	margin-left: 2px; /* mũi máy bay giấy nhìn cân giữa hơn */
}

.blc-send:hover:not(:disabled),
.blc-send:focus-visible {
	background: var(--blc-forest);
	outline: none;
}

.blc-send:active:not(:disabled) {
	transform: scale(.92);
}

.blc-send:disabled {
	background: #c9d3cc;
	cursor: default;
}

/* số ký tự còn lại, chỉ hiện khi gần giới hạn */
.blc-count {
	padding: 0 14px 4px;
	background: #fff;
	font-size: 12px;
	color: var(--blc-muted);
	text-align: right;
}

.blc-count.full {
	color: #b3412e;
	text-align: left;
}

.blc-note {
	font-size: 11px;
	color: var(--blc-muted);
	text-align: center;
	padding: 0 10px 8px;
	background: #fff;
}

/* nút mở trong cụm nút liên hệ */
.contact_dock_ai {
	background: radial-gradient(circle at 30% 25%, #24584c, #0b1f1a 72%);
	box-shadow: 0 0 0 2px rgba(95, 245, 210, .45), 0 6px 18px rgba(0, 0, 0, .25);
}

/* robot vừa bay vào: nút nảy lên, toả vòng sáng */
.contact_dock_ai.blc-landed {
	animation: blc-pop 600ms cubic-bezier(.3, 1.6, .5, 1), blc-ring 1.2s ease-out;
}

@keyframes blc-pop {
	0% { transform: scale(.7); }
	60% { transform: scale(1.18); }
	100% { transform: scale(1); }
}

@keyframes blc-ring {
	0% { box-shadow: 0 0 0 2px rgba(95, 245, 210, .9), 0 6px 18px rgba(0, 0, 0, .25); }
	100% { box-shadow: 0 0 0 24px rgba(95, 245, 210, 0), 0 6px 18px rgba(0, 0, 0, .25); }
}

/*********************************
 Lời chào lần đầu: robot BL-AI vẫy tay cạnh hộp thoại
 *********************************/
.blc-welcome {
	position: fixed;
	inset: 0;
	z-index: 9996;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: 'Open Sans', sans-serif;
	color: #1f2a23;
}

.blc-w-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(28, 53, 40, .45);
	opacity: 0;
	transition: opacity 300ms ease;
}

.blc-w-stage {
	position: relative;
	display: flex;
	align-items: flex-end;
	gap: 6px;
	max-width: 600px;
	width: 100%;
	justify-content: center;
}

.blc-mascot {
	flex: none;
	width: 170px;
	height: 212px;
	opacity: 0;
	transform: translateY(40px) scale(.6);
	transition: opacity 350ms ease, transform 550ms cubic-bezier(.3, 1.5, .5, 1);
}

.blc-mascot svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.blc-mascot-bob {
	width: 100%;
	height: 100%;
	animation: blc-bob 2.6s ease-in-out infinite alternate;
}

/* vẫy tay, chớp mắt, đèn ăng-ten / lõi ngực / luồng đẩy / sóng tín hiệu nhấp nháy */
.blc-m-arm {
	transform-box: view-box;
	transform-origin: 124px 112px;
	animation: blc-wave .9s ease-in-out infinite alternate;
}

.blc-m-eyes {
	transform-box: fill-box;
	transform-origin: center;
	animation: blc-blink 4s infinite;
}

.blc-m-bulb,
.blc-m-core {
	transform-box: fill-box;
	transform-origin: center;
	animation: blc-glow 1.4s ease-in-out infinite alternate;
}

.blc-m-jet {
	transform-box: fill-box;
	transform-origin: 50% 0;
	animation: blc-jet .35s ease-in-out infinite alternate;
}

.blc-m-shadow {
	transform-box: fill-box;
	transform-origin: center;
	animation: blc-shadow 2.6s ease-in-out infinite alternate;
}

.blc-m-waves {
	animation: blc-waves 1.8s ease-in-out infinite;
}

@keyframes blc-bob {
	from { transform: translateY(0); }
	to { transform: translateY(-8px); }
}

@keyframes blc-wave {
	from { transform: rotate(-14deg); }
	to { transform: rotate(22deg); }
}

@keyframes blc-blink {
	0%, 90%, 100% { transform: scaleY(1); }
	94% { transform: scaleY(.1); }
}

@keyframes blc-glow {
	from { opacity: .55; transform: scale(.85); }
	to { opacity: 1; transform: scale(1.15); }
}

@keyframes blc-jet {
	from { opacity: .6; transform: scaleY(.8); }
	to { opacity: 1; transform: scaleY(1.15); }
}

/* bóng co lại khi robot nhún lên (cùng nhịp blc-bob) */
@keyframes blc-shadow {
	from { transform: scale(1); opacity: 1; }
	to { transform: scale(.82); opacity: .7; }
}

@keyframes blc-waves {
	0%, 100% { opacity: 0; }
	40%, 60% { opacity: 1; }
}

/* hộp thoại dạng bong bóng lời thoại, đuôi chỉ về phía robot */
.blc-w-card {
	position: relative;
	flex: 1;
	max-width: 430px;
	margin-bottom: 70px;
	padding: 22px 22px 16px;
	background: #f7f4ec;
	border-radius: 18px;
	box-shadow: 0 16px 48px rgba(28, 53, 40, .3);
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 300ms ease 180ms, transform 400ms ease 180ms;
}

.blc-w-card::before {
	content: '';
	position: absolute;
	left: -11px;
	bottom: 46px;
	border-width: 11px 12px 11px 0;
	border-style: solid;
	border-color: transparent #f7f4ec transparent transparent;
}

.blc-w-x {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #59635a;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.blc-w-x:hover,
.blc-w-x:focus-visible {
	background: #e6e0d2;
	outline: none;
}

.blc-w-title {
	margin: 0 28px 8px 0;
	font-family: 'Lora', Georgia, serif;
	font-size: 21px;
	font-weight: 700;
	line-height: 1.3;
	color: #1c3528;
}

.blc-w-card p {
	margin: 0 0 16px;
	font-size: 14.5px;
	line-height: 1.6;
	color: #3c463f;
}

.blc-w-card strong {
	color: #2e6b4a;
}

/* cam kết của trang: phi lợi nhuận, liên hệ chính chủ */
.blc-w-promise {
	margin: -4px 0 16px;
	padding: 10px 12px;
	list-style: none;
	background: #fff;
	border: 1px solid #e6e0d2;
	border-radius: 12px;
}

.blc-w-promise li {
	position: relative;
	padding-left: 24px;
	font-size: 14px;
	line-height: 1.55;
	color: #3c463f;
}

.blc-w-promise li + li {
	margin-top: 6px;
}

.blc-w-promise li::before {
	content: '✓';
	position: absolute;
	left: 2px;
	top: 0;
	font-weight: 700;
	color: #2e6b4a;
}

.blc-w-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.blc-w-actions button {
	border-radius: 10px;
	padding: 9px 16px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.blc-w-ask {
	border: 0;
	background: #2e6b4a;
	color: #fff;
}

.blc-w-ask:hover,
.blc-w-ask:focus-visible {
	background: #1c3528;
	outline: none;
}

.blc-w-ok {
	border: 1px solid #c08526;
	background: #f6ead3;
	color: #1f2a23;
}

.blc-w-ok:hover,
.blc-w-ok:focus-visible {
	background: #efdcb8;
	outline: none;
}

.blc-w-hint {
	margin-top: 12px;
	font-size: 12px;
	color: #59635a;
}

.blc-welcome.shown .blc-w-backdrop {
	opacity: 1;
}

.blc-welcome.shown .blc-mascot,
.blc-welcome.shown .blc-w-card {
	opacity: 1;
	transform: none;
}

.blc-welcome.leaving .blc-w-backdrop,
.blc-welcome.leaving .blc-w-card {
	opacity: 0;
	transition: opacity 250ms ease;
}

/* robot đang bay về nút: thôi nhún, giữ vẫy tay */
.blc-mascot.flying {
	z-index: 9997;
	opacity: 1;
	transform: none;
	transition: none;
	pointer-events: none;
}

.blc-mascot.flying .blc-mascot-bob {
	animation: none;
}

@media (prefers-reduced-motion: reduce) {
	.blc-mascot-bob,
	.blc-m-arm,
	.blc-m-eyes,
	.blc-m-bulb,
	.blc-m-core,
	.blc-m-jet,
	.blc-m-shadow,
	.blc-m-waves,
	.contact_dock_ai.blc-landed {
		animation: none;
	}
}

@media only screen and (max-width: 575px) {
	.blc {
		left: 8px;
		right: 8px;
		bottom: 8px;
		width: auto;
		height: calc(100% - 16px);
		max-height: none;
	}

	/* iOS phóng to trang khi chạm vào ô nhập có chữ nhỏ hơn 16px */
	.blc-input {
		font-size: 16px;
		line-height: 22px;
		min-height: 40px;
	}

	/* điện thoại: robot đứng trên, hộp thoại bên dưới, đuôi chỉ lên */
	.blc-w-stage {
		flex-direction: column;
		align-items: center;
		gap: 4px;
	}

	.blc-mascot {
		width: 120px;
		height: 150px;
	}

	.blc-w-card {
		margin-bottom: 0;
		width: 100%;
	}

	.blc-w-card::before {
		left: 50%;
		top: -11px;
		bottom: auto;
		margin-left: -11px;
		border-width: 0 11px 12px 11px;
		border-color: transparent transparent #f7f4ec transparent;
	}

	.blc-w-title {
		font-size: 19px;
	}
}
