/* NCH GoClaw Chat — tông màu lấy theo hồ sơ chuyên gia: navy đậm + gold + nền kem */

.nch-chat {
	--nch-navy: #0f2a44;
	--nch-navy-soft: #1c3d5e;
	--nch-gold: #c8a45c;
	--nch-cream: #faf7f0;
	--nch-line: rgba(15, 42, 68, 0.12);
	--nch-text: #1f2937;

	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

/* ---------------------------------------------------------- Nút bong bóng */

.nch-chat__launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 13px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--nch-navy);
	color: #fff;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 10px 28px rgba(15, 42, 68, 0.28);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.nch-chat__launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 34px rgba(15, 42, 68, 0.34);
}

.nch-chat__launcher-icon {
	width: 18px;
	height: 18px;
	border-radius: 50% 50% 50% 4px;
	border: 2px solid var(--nch-gold);
	display: inline-block;
}

.nch-chat[data-open="true"] .nch-chat__launcher {
	display: none;
}

/* ------------------------------------------------------------- Khung chat */

.nch-chat__panel {
	display: none;
	flex-direction: column;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 110px);
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(15, 42, 68, 0.26);
}

.nch-chat[data-open="true"] .nch-chat__panel {
	display: flex;
	animation: nch-chat-in 0.2s ease;
}

@keyframes nch-chat-in {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: translateY(0); }
}

.nch-chat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 18px;
	background: var(--nch-navy);
	color: #fff;
}

.nch-chat__head-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.nch-chat__title {
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.01em;
}

.nch-chat__subtitle {
	font-size: 12.5px;
	color: var(--nch-gold);
}

.nch-chat__close {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	padding: 0 4px;
	cursor: pointer;
	opacity: 0.75;
}

.nch-chat__close:hover {
	opacity: 1;
}

/* ------------------------------------------------------------ Nội dung */

.nch-chat__body {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px 8px;
	background: var(--nch-cream);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.nch-chat__row {
	display: flex;
}

.nch-chat__row--user {
	justify-content: flex-end;
}

.nch-chat__bubble {
	max-width: 84%;
	padding: 10px 14px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	font-size: 14.5px;
	color: var(--nch-text);
	background: #fff;
	border: 1px solid var(--nch-line);
	border-bottom-left-radius: 4px;
}

.nch-chat__row--user .nch-chat__bubble {
	background: var(--nch-navy);
	border-color: var(--nch-navy);
	color: #fff;
	border-bottom-left-radius: 14px;
	border-bottom-right-radius: 4px;
}

.nch-chat__bubble--typing {
	display: inline-flex;
	gap: 5px;
	align-items: center;
	padding: 14px;
}

.nch-chat__bubble--typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--nch-navy-soft);
	opacity: 0.35;
	animation: nch-chat-dot 1.1s infinite ease-in-out;
}

.nch-chat__bubble--typing span:nth-child(2) { animation-delay: 0.16s; }
.nch-chat__bubble--typing span:nth-child(3) { animation-delay: 0.32s; }

@keyframes nch-chat-dot {
	0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
	40%           { opacity: 0.9;  transform: translateY(-3px); }
}

/* ------------------------------------------------------- Gợi ý câu hỏi */

.nch-chat__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 4px 16px 12px;
	background: var(--nch-cream);
}

.nch-chat__chips[hidden] {
	display: none;
}

.nch-chat__chip {
	border: 1px solid var(--nch-gold);
	background: #fff;
	color: var(--nch-navy);
	font-family: inherit;
	font-size: 13px;
	padding: 7px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease;
}

.nch-chat__chip:hover {
	background: rgba(200, 164, 92, 0.16);
}

/* ------------------------------------------------------------ Ô nhập */

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

.nch-chat__input {
	flex: 1;
	resize: none;
	border: 1px solid var(--nch-line);
	border-radius: 12px;
	padding: 10px 12px;
	font-family: inherit;
	font-size: 14.5px;
	line-height: 1.45;
	color: var(--nch-text);
	max-height: 120px;
	background: #fff;
}

.nch-chat__input:focus {
	outline: none;
	border-color: var(--nch-gold);
	box-shadow: 0 0 0 3px rgba(200, 164, 92, 0.18);
}

.nch-chat__send {
	border: 0;
	border-radius: 12px;
	padding: 11px 18px;
	background: var(--nch-gold);
	color: var(--nch-navy);
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 700;
	cursor: pointer;
}

.nch-chat__send:disabled {
	opacity: 0.55;
	cursor: default;
}

/* ------------------------------------------------------------ Mobile */

@media (max-width: 480px) {
	.nch-chat {
		right: 12px;
		bottom: 12px;
		left: 12px;
	}

	.nch-chat__panel {
		width: 100%;
		height: calc(100vh - 90px);
	}

	.nch-chat__launcher {
		float: right;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nch-chat__launcher,
	.nch-chat__panel,
	.nch-chat__bubble--typing span {
		transition: none;
		animation: none;
	}
}
