/* =====================================================
   TAJ chat widget — global lead launcher
   THESIS: Bottom-right interest form that hands off to
   WhatsApp or Zalo — not a support chatbot.
   OWN-WORLD: Charcoal panel, cyan selected chips, white
   channel pills, Be Vietnam Pro, TAJ logo colors on the
   launcher mark.
   STORY: Pick a service → leave name & phone → choose a
   channel with a prefilled message.
   FIRST VIEWPORT: Collapsed “Chat with TAJ” pill; panel
   opens upward from the trigger.
===================================================== */

body.taj-cookie-banner-on .taj-chat {
	bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 720px) {
	body.taj-cookie-banner-on .taj-chat {
		bottom: calc(220px + env(safe-area-inset-bottom, 0px));
	}
}

.taj-chat {
	--tc-font: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
	--tc-cyan: #2abeec;
	--tc-cyan-soft: #7dcee9;
	--tc-panel: #1F1E23;
	--tc-panel-border: rgba(255, 255, 255, 0.12);
	--tc-ink: #f8f8f9;
	--tc-muted: #c8c6cd;
	--tc-field: #1c1c1f;
	--tc-field-border: rgba(255, 255, 255, 0.16);
	--tc-danger: #f07178;
	--tc-ease: cubic-bezier(0.16, 1, 0.3, 1);
	--tc-z: 1800;
	position: fixed;
	z-index: var(--tc-z);
	right: calc(20px + env(safe-area-inset-right, 0px));
	bottom: calc(40px + env(safe-area-inset-bottom, 0px));
	transition: bottom 0.35s var(--tc-ease);
	font-family: var(--tc-font);
	color: var(--tc-ink);
	-webkit-font-smoothing: antialiased;
}

.taj-chat *,
.taj-chat *::before,
.taj-chat *::after {
	box-sizing: border-box;
}

.taj-chat .visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* —— Trigger —— */
.taj-chat .taj-chat-launch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 10px 18px 10px 12px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 999px;
	background: rgba(31, 30, 35, 0.88);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 0.01em;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
	transition: transform 0.25s var(--tc-ease), background 0.2s, border-color 0.2s;
}

.taj-chat .taj-chat-launch:hover {
	background: rgba(31, 30, 35, 0.94);
	border-color: rgba(255, 255, 255, 0.18);
	transform: translateY(-1px);
}

.taj-chat .taj-chat-launch:focus-visible {
	outline: 2px solid var(--tc-cyan);
	outline-offset: 3px;
}

.taj-chat.is-open .taj-chat-launch {
	background: rgba(31, 30, 35, 0.96);
	border-color: rgba(255, 255, 255, 0.2);
}

.taj-chat-mark {
	width: 14px;
	height: 10px;
	flex-shrink: 0;
	display: block;
}

/* —— Panel —— */
.taj-chat .taj-chat-panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 12px);
	width: min(392px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
	max-height: calc(100dvh - 72px - env(safe-area-inset-bottom, 0px));
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	padding: 22px 22px 20px;
	border: 1px solid var(--tc-panel-border);
	border-radius: 22px;
	background: var(--tc-panel);
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
	transform-origin: bottom right;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(10px) scale(0.97);
	filter: blur(6px);
	transition:
		opacity 0.32s var(--tc-ease),
		transform 0.32s var(--tc-ease),
		filter 0.32s var(--tc-ease),
		visibility 0.32s;
}

.taj-chat.is-open .taj-chat-panel {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: none;
	filter: blur(0);
}

.taj-chat-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.taj-chat-kicker {
	margin: 0;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--tc-cyan);
	line-height: 1.3;
}

.taj-chat .taj-chat-close {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	margin: -2px -2px 0 0;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 50%;
	background: transparent;
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s;
}

.taj-chat .taj-chat-close:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.4);
}

.taj-chat .taj-chat-close:focus-visible {
	outline: 2px solid var(--tc-cyan);
	outline-offset: 2px;
}

.taj-chat .taj-chat-close svg {
	width: 10px;
	height: 10px;
	display: block;
}

.taj-chat-title {
	margin: 0 0 16px;
	font-size: 22px;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1.25;
	color: #fff;
	overflow-wrap: break-word;
}

/* —— Interest chips —— */
.taj-chat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 16px;
}

.taj-chat .taj-chat-chip {
	margin: 0;
	padding: 8px 14px;
	border: 1px solid var(--tc-field-border);
	border-radius: 999px;
	background: transparent;
	color: #fff;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.taj-chat .taj-chat-chip:hover {
	border-color: rgba(255, 255, 255, 0.36);
}

.taj-chat .taj-chat-chip.is-on {
	background: var(--tc-cyan-soft);
	border-color: var(--tc-cyan-soft);
	color: #1F1E23;
}

.taj-chat .taj-chat-chip:focus-visible {
	outline: 2px solid var(--tc-cyan);
	outline-offset: 2px;
}

/* —— Fields —— */
.taj-chat-fields {
	display: grid;
	gap: 10px;
	margin: 0 0 18px;
}

.taj-chat-field {
	position: relative;
}

.taj-chat-field svg {
	position: absolute;
	top: 23px;
	left: 14px;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	color: #b4b2ba;
	pointer-events: none;
}

.taj-chat .taj-chat-field input {
	width: 100%;
	height: 46px;
	padding: 0 14px 0 40px;
	border: 1px solid var(--tc-field-border);
	border-radius: 12px;
	background: var(--tc-field);
	color: #fff;
	font-family: inherit;
	font-size: 16px;
	outline: none;
	transition: border-color 0.18s, box-shadow 0.18s;
}

.taj-chat .taj-chat-field input::placeholder {
	color: #b4b2ba;
}

.taj-chat .taj-chat-field input:hover {
	border-color: rgba(255, 255, 255, 0.28);
}

.taj-chat .taj-chat-field input:focus {
	border-color: var(--tc-cyan);
	box-shadow: 0 0 0 3px rgba(42, 190, 236, 0.22);
}

.taj-chat .taj-chat-field.is-invalid input {
	border-color: var(--tc-danger);
	box-shadow: 0 0 0 3px rgba(240, 113, 120, 0.18);
}

.taj-chat-error {
	display: none;
	margin: 6px 0 0 4px;
	font-size: 12px;
	color: var(--tc-danger);
}

.taj-chat-field.is-invalid .taj-chat-error {
	display: block;
}

/* —— Channels —— */
.taj-chat-channels-label {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 500;
	color: #fff;
}

.taj-chat-channels {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.taj-chat-channels.is-single {
	grid-template-columns: 1fr;
}

.taj-chat-status {
	margin: 10px 0 0;
	font-size: 12px;
	line-height: 1.4;
	color: var(--tc-cyan-soft);
}

.taj-chat-status[hidden] {
	display: none;
}

.taj-chat .taj-chat-channel {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	width: 100%;
	min-height: 42px;
	padding: 8px 12px;
	border: 0;
	border-radius: 999px;
	background: #f4f4f4;
	color: #1F1E23;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	transition: transform 0.2s var(--tc-ease), background 0.18s;
}

.taj-chat .taj-chat-channel:hover {
	background: #fff;
	transform: translateY(-1px);
}

.taj-chat .taj-chat-channel:focus-visible {
	outline: 2px solid var(--tc-cyan);
	outline-offset: 2px;
}

.taj-chat .taj-chat-channel-icon {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	display: block;
	object-fit: contain;
}

@media (min-width: 480px) {
	.taj-chat .taj-chat-field input {
		font-size: 14px;
	}
}

@media (max-width: 420px) {
	.taj-chat {
		right: calc(12px + env(safe-area-inset-right, 0px));
		bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	}

	.taj-chat .taj-chat-panel {
		padding: 18px 16px 16px;
		border-radius: 18px;
	}

	.taj-chat-title {
		font-size: 20px;
	}

	.taj-chat-channels {
		grid-template-columns: 1fr;
	}

	.taj-chat .taj-chat-channel {
		min-height: 44px;
		font-size: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.taj-chat .taj-chat-launch,
	.taj-chat .taj-chat-panel,
	.taj-chat .taj-chat-chip,
	.taj-chat .taj-chat-channel,
	.taj-chat .taj-chat-close {
		transition: none;
	}

	.taj-chat .taj-chat-panel {
		filter: none;
	}
}
