/**
 * Trang AI Chat.
 *
 * Bám brand guideline "Navy nền tảng — Cam Trí Tín điểm nhấn — Cam đặc cho
 * hành động". Nền chủ đạo của trang là kem + trắng (khung chat), nên nấc cam
 * mặc định là **cam nung** `#A85B0E` — cam nhạt trên nền kem chỉ đạt 1.9:1,
 * không đọc được. Dải hero nền navy bật ngược lại sang cam nhạt.
 *
 * Đúng một mảng cam đặc mỗi màn hình: nút gửi trong khung chat. Nút "Bắt đầu
 * trò chuyện" ở cổng cũng là cam đặc, nhưng hai màn không bao giờ hiện cùng
 * lúc nên không phạm luật.
 *
 * Không bo góc, không đổ bóng đậm, không gradient — theo mục "Không nên".
 *
 * @package flatsome-child
 */

.tta-page {
	--tta-navy: #0F1E33;
	--tta-navy-900: #0A1626;
	--tta-navy-700: #16283F;
	--tta-navy-400: #8FA3BD;
	--tta-ink: #1C2B3F;
	--tta-cream: #F7F5F0;
	--tta-white: #FFFFFF;

	/* Hai nấc cam. `--tta-gold` là nấc đang hiệu lực; đổi nó ở khối cha chứ
	   không sửa từng thuộc tính. `--tta-gold-fg` là màu chữ đặt trên mảng cam
	   đặc, lật theo nấc. */
	--tta-gold-lit: #F0A45E;
	--tta-gold-dark: #A85B0E;
	--tta-gold: var(--tta-gold-dark);
	--tta-gold-fg: var(--tta-white);

	--tta-orange: #F98E30;
	--tta-orange-dark: #D9720F;
	--tta-mist: #D7DEE8;
	--tta-line: #E4DFD4;
	--tta-muted: #6B7686;

	/* Đỏ báo lỗi là màu chức năng, không nằm trong bảng màu thương hiệu. */
	--tta-error: #B3382C;

	background: var(--tta-cream);
	color: var(--tta-ink);
}

.tta-wrap {
	width: 100%;
	max-width: 900px;
	margin: 0 auto;
	padding: 0 20px;
}

/* -------------------------------------------------------------------------
 * Dải mở đầu
 * ---------------------------------------------------------------------- */

.tta-hero {
	--tta-gold: var(--tta-gold-lit);
	background: var(--tta-navy);
	padding: 64px 0 56px;
}

.tta-hero__inner {
	text-align: center;
}

.tta-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0 0 14px;
	color: var(--tta-gold);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 2.5px;
	text-transform: uppercase;
}

.tta-hero__title {
	margin: 0;
	color: var(--tta-white);
	font-size: clamp(23px, 3.4vw, 32px);
	font-weight: 500;
	line-height: 1.25;
}

.tta-hero__desc {
	margin: 16px auto 0;
	max-width: 62ch;
	color: var(--tta-mist);
	font-size: 15px;
	font-weight: 300;
	line-height: 1.7;
}

/* -------------------------------------------------------------------------
 * Khung chung
 * ---------------------------------------------------------------------- */

.tta-main {
	padding: 40px 0 56px;
}

.tta-panel {
	background: var(--tta-white);
	border: 1px solid var(--tta-line);
	border-top: 3px solid var(--tta-gold-lit);
}

.tta-panel--off {
	padding: 44px 32px;
	text-align: center;
}

/* -------------------------------------------------------------------------
 * Cổng nhập họ tên / số điện thoại
 * ---------------------------------------------------------------------- */

.tta-gate {
	padding: 40px 32px 36px;
}

.tta-gate__head {
	max-width: 52ch;
	margin: 0 auto 26px;
	text-align: center;
}

.tta-gate__mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	margin-bottom: 14px;
	color: var(--tta-gold);
	border: 1px solid var(--tta-line);
}

.tta-gate__title {
	margin: 0;
	color: var(--tta-ink);
	font-size: clamp(20px, 2.6vw, 25px);
	font-weight: 500;
	line-height: 1.25;
}

.tta-gate__desc {
	margin: 12px 0 0;
	color: var(--tta-muted);
	font-size: 14px;
	font-weight: 300;
	line-height: 1.7;
}

.tta-gate__form {
	max-width: 560px;
	margin: 0 auto;
}

.tta-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

@media (max-width: 560px) {
	.tta-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.tta-field {
	min-width: 0;
}

.tta-label {
	display: block;
	margin-bottom: 6px;
	color: var(--tta-ink);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.6px;
	text-transform: uppercase;
}

.tta-req {
	color: var(--tta-gold);
}

.tta-page .tta-input {
	width: 100%;
	height: 46px;
	margin: 0 0 14px;
	padding: 0 14px;
	background: var(--tta-cream);
	border: 1px solid var(--tta-line);
	border-radius: 0;
	box-shadow: none;
	color: var(--tta-ink);
	font-size: 15px;
	font-weight: 300;
	transition: border-color 0.16s ease;
}

.tta-page .tta-input:focus {
	border-color: var(--tta-gold);
	box-shadow: none;
	outline: none;
}

.tta-field.is-invalid .tta-input {
	border-color: var(--tta-error);
}

.tta-error {
	margin: 6px 0 0;
	color: var(--tta-error);
	font-size: 12.5px;
	line-height: 1.5;
}

.tta-trap {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.tta-gate__submit {
	width: 100%;
	margin-top: 20px;
}

.tta-gate__note {
	margin: 16px 0 0;
	color: var(--tta-muted);
	font-size: 12.5px;
	font-weight: 300;
	line-height: 1.65;
	text-align: center;
}

/* -------------------------------------------------------------------------
 * Nút
 * ---------------------------------------------------------------------- */

.tta-page .tta-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 46px;
	margin: 0;
	padding: 13px 26px;
	border: 1px solid transparent;
	border-radius: 0;
	box-shadow: none;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 1px;
	line-height: 1.2;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.tta-page .tta-btn--primary {
	background: var(--tta-orange);
	border-color: var(--tta-orange);
	color: var(--tta-white);
}

.tta-page .tta-btn--primary:hover,
.tta-page .tta-btn--primary:focus-visible {
	background: var(--tta-orange-dark);
	border-color: var(--tta-orange-dark);
	color: var(--tta-white);
}

.tta-page .tta-btn--ghost {
	background: transparent;
	border-color: var(--tta-gold);
	color: var(--tta-gold);
}

.tta-page .tta-btn--ghost:hover,
.tta-page .tta-btn--ghost:focus-visible {
	background: var(--tta-gold);
	color: var(--tta-gold-fg);
}

.tta-btn[disabled],
.tta-btn.is-busy {
	opacity: 0.62;
	pointer-events: none;
}

.tta-btn__spinner,
.tta-composer__spinner {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: tta-spin 0.7s linear infinite;
}

.tta-btn.is-busy .tta-btn__spinner {
	display: block;
}

@keyframes tta-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.tta-btn__spinner,
	.tta-composer__spinner {
		animation-duration: 2s;
	}
}

/* -------------------------------------------------------------------------
 * Thanh trên khung chat
 * ---------------------------------------------------------------------- */

.tta-chat__bar {
	--tta-gold: var(--tta-gold-lit);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 14px 20px;
	background: var(--tta-navy);
}

.tta-chat__who {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--tta-gold);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 2px;
	text-transform: uppercase;
}

.tta-chat__left {
	color: var(--tta-navy-400);
	font-size: 12px;
	font-weight: 300;
}

/* -------------------------------------------------------------------------
 * Dòng hội thoại
 * ---------------------------------------------------------------------- */

.tta-chat__log {
	display: flex;
	flex-direction: column;
	gap: 16px;
	height: min(56vh, 520px);
	padding: 24px 20px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--tta-white);
}

.tta-msg {
	display: flex;
	max-width: 100%;
}

.tta-msg--user {
	justify-content: flex-end;
}

.tta-msg__body {
	max-width: 86%;
	padding: 13px 17px;
	font-size: 15px;
	font-weight: 300;
	line-height: 1.7;
	overflow-wrap: anywhere;
}

.tta-msg--bot .tta-msg__body {
	background: var(--tta-cream);
	border-left: 2px solid var(--tta-gold);
	color: var(--tta-ink);
}

.tta-msg--user .tta-msg__body {
	background: var(--tta-navy);
	color: var(--tta-mist);
}

.tta-msg__body > :first-child { margin-top: 0; }
.tta-msg__body > :last-child { margin-bottom: 0; }

.tta-msg__body p {
	margin: 0 0 10px;
}

.tta-msg__body ul,
.tta-msg__body ol {
	margin: 0 0 10px;
	padding-left: 20px;
}

.tta-msg__body li {
	margin-bottom: 5px;
	list-style: inherit;
}

.tta-msg__body strong {
	font-weight: 600;
}

.tta-msg--bot .tta-msg__body a {
	color: var(--tta-gold);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.tta-msg--user .tta-msg__body a {
	color: var(--tta-gold-lit);
	text-decoration: underline;
}

/* Câu trả lời hỏng — hiện ngay trong dòng hội thoại kèm nút gửi lại. */
.tta-msg--error .tta-msg__body {
	background: #FBEFEE;
	border-left: 2px solid var(--tta-error);
	color: var(--tta-error);
}

.tta-retry {
	margin: 8px 0 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--tta-error);
	font-size: 13px;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

/* -------------------------------------------------------------------------
 * Đang soạn câu trả lời
 * ---------------------------------------------------------------------- */

.tta-typing {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 20px 16px;
	color: var(--tta-muted);
	font-size: 13px;
	font-weight: 300;
}

.tta-typing__dots {
	display: inline-flex;
	gap: 4px;
}

.tta-typing__dots i {
	width: 6px;
	height: 6px;
	background: var(--tta-gold);
	border-radius: 50%;
	animation: tta-blink 1.2s ease-in-out infinite;
}

.tta-typing__dots i:nth-child(2) { animation-delay: 0.18s; }
.tta-typing__dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes tta-blink {
	0%, 60%, 100% { opacity: 0.25; }
	30% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.tta-typing__dots i {
		animation: none;
		opacity: 0.6;
	}
}

/* -------------------------------------------------------------------------
 * Ô soạn tin
 * ---------------------------------------------------------------------- */

.tta-composer {
	padding: 16px 20px 18px;
	border-top: 1px solid var(--tta-line);
	background: var(--tta-cream);
}

.tta-composer__row {
	display: flex;
	align-items: flex-end;
	gap: 10px;
}

.tta-page .tta-composer__input {
	flex: 1;
	min-height: 46px;
	max-height: 168px;
	margin: 0;
	padding: 12px 14px;
	background: var(--tta-white);
	border: 1px solid var(--tta-line);
	border-radius: 0;
	box-shadow: none;
	color: var(--tta-ink);
	font-size: 15px;
	font-weight: 300;
	line-height: 1.55;
	resize: none;
	transition: border-color 0.16s ease;
}

.tta-page .tta-composer__input:focus {
	border-color: var(--tta-gold);
	box-shadow: none;
	outline: none;
}

.tta-page .tta-composer__send {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 0;
	background: var(--tta-orange);
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: var(--tta-white);
	cursor: pointer;
	transition: background-color 0.16s ease;
}

.tta-page .tta-composer__send:hover:not([disabled]),
.tta-page .tta-composer__send:focus-visible {
	background: var(--tta-orange-dark);
}

.tta-composer__send[disabled] {
	opacity: 0.5;
	cursor: default;
}

.tta-composer.is-busy .tta-composer__send .tta-icon {
	display: none;
}

.tta-composer.is-busy .tta-composer__spinner {
	display: block;
}

.tta-composer__foot {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin-top: 9px;
}

.tta-composer__count {
	flex: none;
	color: var(--tta-muted);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.tta-composer__count.is-near {
	color: var(--tta-gold);
	font-weight: 600;
}

.tta-composer__note {
	color: var(--tta-muted);
	font-size: 11.5px;
	font-weight: 300;
	line-height: 1.55;
	text-align: right;
}

@media (max-width: 620px) {
	.tta-composer__foot {
		flex-direction: column-reverse;
		align-items: flex-start;
	}

	.tta-composer__note {
		text-align: left;
	}
}

/* -------------------------------------------------------------------------
 * Hết hạn mức tin nhắn
 * ---------------------------------------------------------------------- */

.tta-exhausted {
	padding: 30px 24px 32px;
	border-top: 1px solid var(--tta-line);
	background: var(--tta-cream);
	text-align: center;
}

.tta-exhausted__title {
	margin: 0;
	color: var(--tta-ink);
	font-size: 19px;
	font-weight: 500;
}

.tta-exhausted__desc {
	margin: 10px auto 20px;
	max-width: 52ch;
	color: var(--tta-muted);
	font-size: 14px;
	font-weight: 300;
	line-height: 1.7;
}

.tta-restart {
	display: block;
	margin: 16px auto 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--tta-gold);
	font-size: 13px;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* -------------------------------------------------------------------------
 * Báo lỗi chung
 * ---------------------------------------------------------------------- */

.tta-alert {
	margin-bottom: 14px;
	padding: 11px 14px;
	background: #FBEFEE;
	border-left: 2px solid var(--tta-error);
	color: var(--tta-error);
	font-size: 13.5px;
	font-weight: 400;
	line-height: 1.6;
}

/* -------------------------------------------------------------------------
 * Nội dung gõ thêm trong editor
 * ---------------------------------------------------------------------- */

.tta-extra {
	padding: 0 0 60px;
}

.tta-extra .tta-wrap > :first-child {
	margin-top: 0;
}

.tta-extra p,
.tta-extra li {
	color: var(--tta-ink);
	font-size: 15px;
	font-weight: 300;
	line-height: 1.75;
}

.tta-extra h2,
.tta-extra h3 {
	color: var(--tta-ink);
	font-weight: 500;
	line-height: 1.25;
}

.tta-extra a {
	color: var(--tta-gold);
}
