/**
 * DTH Contact Chatbot
 * Modern professional UI inside the Contact page gradient panel.
 */

/* Independent AI invitation above the unchanged floating contact button. */
.dth-ai-launcher [hidden],
.dth-ai-launcher[hidden] {
	display: none !important;
}

body.menu-open .dth-ai-launcher,
.dth-ai-launcher--social-open {
	visibility: hidden;
	pointer-events: none;
}

.dth-ai-launcher {
	--dth-launcher-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 40%, rgba(255, 255, 255, 0.02)), rgba(0, 0, 0, 0.35);
	--dth-launcher-ink: #fff;
	--dth-launcher-muted: #f0f3f6;
	position: fixed;
	z-index: 999998;
	right: 24px;
	bottom: max(100px, calc(env(safe-area-inset-bottom) + 84px));
	font-family: inherit;
	font-size: 15px;
	line-height: 1.55;
}

.dth-ai-launcher button {
	font: inherit;
	cursor: pointer;
}

.dth-ai-launcher__toggle {
	display: flex;
	align-items: center;
	gap: 9px;
	height: 54px;
	padding: 5px 18px 5px 5px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.78);
	border-radius: 999px;
	background: var(--dth-launcher-glass);
	box-shadow: 0 10px 28px rgba(0, 28, 68, 0.2);
	color: var(--dth-launcher-ink);
	font-weight: 650 !important;
	opacity: 0;
	transform: translateY(8px) scale(0.96);
	transform-origin: right center;
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease;
}

.dth-ai-launcher__toggle.is-open {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.dth-ai-launcher__toggle:hover {
	box-shadow: 0 12px 34px rgba(0, 28, 68, 0.27);
}

.dth-ai-launcher__toggle img {
	display: block;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	object-fit: cover;
}

.dth-ai-launcher__invite,
.dth-ai-launcher__panel {
	position: absolute;
	right: 0;
	bottom: 0;
	box-sizing: border-box;
	width: min(350px, calc(100vw - 32px));
	border: 1px solid rgba(215, 230, 240, 0.96);
	border-radius: 20px;
	box-shadow: 0 22px 60px rgba(0, 25, 67, 0.28);
	opacity: 0;
	transform: translateY(10px) scale(0.975);
	transform-origin: right bottom;
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.dth-ai-launcher__invite.is-open,
.dth-ai-launcher__panel.is-open {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.dth-ai-launcher__invite {
	padding: 22px 24px;
	background: var(--dth-launcher-glass);
	border-radius: 26px;
	color: var(--dth-launcher-ink);
	text-align: left;
}

.dth-ai-launcher__invite-identity {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-right: 20px;
	margin-bottom: 16px;
	font-size: 13px;
	font-weight: 600;
}

.dth-ai-launcher__invite-avatar {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 48px;
	width: 48px;
	height: 48px;
	border: 1px solid rgba(255, 255, 255, 0.6);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
	box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

.dth-ai-launcher__invite-avatar img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	object-fit: cover;
}

.dth-ai-launcher__invite-avatar::after {
	content: '';
	position: absolute;
	right: 0;
	bottom: 0;
	width: 9px;
	height: 9px;
	border: 2px solid #263a48;
	border-radius: 50%;
	background: #4dde99;
}

.dth-ai-launcher__invite p {
	margin: 0 0 16px;
	color: var(--dth-launcher-muted);
	font-size: 14px;
}

.dth-ai-launcher__invite strong {
	color: var(--dth-launcher-ink);
	font-size: 16px;
	font-weight: 650;
}

.dth-ai-launcher__dismiss,
.dth-ai-launcher__close {
	cursor: pointer !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--dth-launcher-ink);
	font-size: 23px !important;
	line-height: 1;
}

.dth-ai-launcher__dismiss {
	position: absolute;
	top: 8px;
	right: 8px;
}

.dth-ai-launcher__dismiss:hover,
.dth-ai-launcher__close:hover {
	background: rgba(255, 255, 255, 0.16);
}

.dth-ai-launcher__open {
	display: block;
	width: 100%;
	min-height: 46px;
	padding: 10px 16px;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 16px;
	background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(255, 255, 255, 0.12), 0 6px 18px rgba(0, 0, 0, 0.15);
	color: #fff !important;
	font-weight: 600 !important;
	text-align: center;
	transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.dth-ai-launcher__open:hover {
	background: linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.08));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 8px 22px rgba(0, 0, 0, 0.18);
	transform: translateY(-1px);
}

.dth-ai-launcher__panel {
	width: min(430px, calc(100vw - 32px));
	overflow: hidden;
	border-radius: 30px;
	background: var(--dth-launcher-glass);
	color: var(--dth-launcher-ink);
}

/* Shared clear material for every floating AI surface. */
.dth-ai-launcher__toggle,
.dth-ai-launcher__invite,
.dth-ai-launcher__panel {
	border-color: rgba(255, 255, 255, 0.38);
	-webkit-backdrop-filter: blur(4px) var(--dth-glass-refraction, blur(0px)) saturate(120%) brightness(65%);
	backdrop-filter: blur(4px) var(--dth-glass-refraction, blur(0px)) saturate(120%) brightness(65%);
	box-shadow:
		inset 0 1px 1px rgba(255, 255, 255, 0.85),
		inset 1px 0 2px rgba(255, 255, 255, 0.28),
		inset -1px -1px 2px rgba(255, 255, 255, 0.5),
		inset 0 0 8px rgba(255, 255, 255, 0.08),
		0 20px 56px rgba(23, 39, 60, 0.17),
		0 2px 8px rgba(23, 39, 60, 0.08);
}

/* Clear labels remain part of the lens, without separate background plates. */
.dth-ai-launcher__toggle span,
.dth-ai-launcher__invite p,
.dth-ai-launcher__panel .dth-chat__head,
.dth-ai-launcher__panel .dth-chat__foot {
	background: transparent;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
	border-radius: 16px;
}

.dth-ai-launcher__toggle span {
	padding: 3px 8px;
	border-radius: 999px;
}

.dth-ai-launcher__invite p {
	padding: 0;
}

.dth-ai-launcher__panel .dth-chat {
	box-sizing: border-box;
	height: min(580px, calc(100dvh - 112px));
	min-height: 0;
	max-height: none;
	padding: 16px;
	border: 0;
	border-radius: 27px;
	background: transparent;
	box-shadow: none;
	color: var(--dth-launcher-ink);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

.dth-ai-launcher__panel .dth-chat::before {
	content: none;
}

.dth-ai-launcher__panel .dth-chat__head {
	gap: 10px;
	padding: 8px;
	margin-bottom: 0;
}

.dth-ai-launcher__panel .dth-chat__identity {
	flex: 1 1 auto;
}

.dth-chat__popup-actions {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
}

.dth-ai-launcher__panel .dth-chat__popup-actions .dth-chat__toform,
.dth-chat__popup-expand {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 34px;
	padding: 6px 9px;
	margin-left: 0;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.84);
	font-size: 10px;
	font-weight: 550;
	line-height: 1;
	text-decoration: none;
	transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.dth-chat__popup-expand:hover,
.dth-ai-launcher__panel .dth-chat__popup-actions .dth-chat__toform:hover {
	border-color: rgba(255, 255, 255, 0.42);
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	transform: none;
}

.dth-chat__popup-expand,
.dth-chat__popup-expand:link,
.dth-chat__popup-expand:visited {
	width: 34px;
	min-height: 34px;
	padding: 0;
	color: var(--dth-launcher-ink) !important;
}

.dth-chat__popup-expand:hover,
.dth-chat__popup-expand:focus-visible {
	color: #fff !important;
}

.dth-chat__popup-expand i {
	font-size: 13px;
	line-height: 1;
}

.dth-ai-launcher__panel .dth-ai-launcher__close {
	width: 34px;
	height: 34px;
	color: rgba(255, 255, 255, 0.82);
}

.dth-ai-launcher__panel .dth-ai-launcher__close:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

.dth-ai-launcher__panel .dth-chat__avatar {
	width: 42px;
	height: 42px;
	box-shadow: 0 6px 16px rgba(0, 18, 52, 0.26);
}

.dth-ai-launcher__panel .dth-chat__title {
	font-size: 14px;
	white-space: normal;
}

.dth-ai-launcher__panel .dth-chat__status {
	font-size: 11px;
}

.dth-ai-launcher__panel .dth-chat__toform {
	padding: 7px 9px;
	font-size: 10px;
}

.dth-ai-launcher__panel .dth-chat__log {
	padding: 16px 4px 8px;
	border: 0;
	border-radius: 0;
	background: transparent;
}

.dth-ai-launcher__panel .dth-chat__bubble {
	max-width: 88%;
	padding: 11px 14px;
	font-size: 14px;
	line-height: 1.75;
}

.dth-ai-launcher__panel .dth-chat__form {
	margin-top: 10px;
	border-radius: 16px;
}

.dth-ai-launcher__panel .dth-chat__input {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	padding: 8px 0;
	resize: none;
	border: 0;
	background: transparent;
	color: var(--dth-launcher-ink) !important;
	font: inherit;
	font-size: 14px;
	outline: none;
}

.dth-ai-launcher__panel .dth-chat__input::placeholder {
	color: var(--dth-launcher-muted) !important;
	opacity: 1;
}

.dth-ai-launcher__panel .dth-chat__foot {
	margin-top: 8px;
	padding: 6px 8px;
	font-size: 11px;
}

.dth-ai-launcher__panel .dth-chat__hint {
	display: none;
}

/* Glass treatment is scoped to the popup; Contact keeps its existing material. */
.dth-ai-launcher__panel .dth-chat__head {
	border: 0;
	box-shadow: none;
}

.dth-ai-launcher__panel .dth-chat__status,
.dth-ai-launcher__panel .dth-chat__foot {
	color: var(--dth-launcher-muted);
}

.dth-ai-launcher__panel .dth-chat__bubble,
.dth-ai-launcher__panel .dth-chat__form,
.dth-ai-launcher__panel .dth-chat__done {
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}

.dth-ai-launcher__panel .dth-chat__msg--bot .dth-chat__bubble {
	border-color: rgba(255, 255, 255, 0.3);
	background: linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent), rgba(0, 0, 0, 0.14);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(0, 0, 0, 0.08);
	color: var(--dth-launcher-ink);
}

.dth-ai-launcher__panel .dth-chat__msg--user .dth-chat__bubble {
	border-color: rgba(255, 255, 255, 0.68);
	background: linear-gradient(145deg, rgba(0, 124, 197, 0.38), rgba(0, 67, 113, 0.28));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 4px 14px rgba(38, 55, 76, 0.06);
	color: var(--dth-launcher-ink);
}

.dth-ai-launcher__panel .dth-chat__form {
	border-radius: 22px;
	border-color: rgba(255, 255, 255, 0.32);
	background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), transparent), rgba(0, 0, 0, 0.18);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 5px 18px rgba(0, 0, 0, 0.08);
}

.dth-ai-launcher__panel .dth-chat__form:focus-within {
	border-color: #b2eaff;
	box-shadow: inset 0 1px 0 #fff, 0 0 0 3px rgba(97, 208, 255, 0.24), 0 8px 24px rgba(0, 22, 46, 0.14);
}

.dth-ai-launcher__panel .dth-chat__popup-actions .dth-chat__toform,
.dth-ai-launcher__panel .dth-chat__popup-expand,
.dth-ai-launcher__panel .dth-ai-launcher__close {
	box-sizing: border-box;
	border: 1px solid rgba(255, 255, 255, 0.7);
	background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 2px 6px rgba(38, 55, 76, 0.06);
	color: var(--dth-launcher-ink);
}

.dth-ai-launcher__panel .dth-chat__popup-actions .dth-chat__toform:hover,
.dth-ai-launcher__panel .dth-chat__popup-expand:hover,
.dth-ai-launcher__panel .dth-ai-launcher__close:hover {
	border-color: rgba(255, 255, 255, 0.65);
	background: rgba(255, 255, 255, 0.16);
	color: var(--dth-launcher-ink);
}

.dth-ai-launcher__panel .dth-chat__msg--sys .dth-chat__bubble {
	background: rgba(100, 12, 43, 0.32);
	border-color: rgba(163, 36, 78, 0.15);
	color: #fff;
}

.dth-ai-launcher__panel .dth-chat__done {
	background: rgba(0, 0, 0, 0.18);
	border-color: rgba(255, 255, 255, 0.7);
}

.dth-ai-launcher__panel .dth-chat__done span,
.dth-ai-launcher__panel .dth-chat__done-alt,
.dth-ai-launcher__panel .dth-chat__foot a {
	color: var(--dth-launcher-muted);
	text-decoration-color: currentColor;
}

.dth-ai-launcher__panel .dth-chat__send {
	border: 1px solid rgba(163, 228, 255, 0.7);
	border-radius: 16px;
	background: linear-gradient(145deg, rgba(35, 160, 225, 0.92), rgba(0, 107, 185, 0.94));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 4px 12px rgba(0, 99, 150, 0.24);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.dth-ai-launcher__toggle,
	.dth-ai-launcher__invite,
	.dth-ai-launcher__panel {
		background: #38434e;
	}
}

@media (prefers-reduced-transparency: reduce) {
	.dth-ai-launcher__toggle,
	.dth-ai-launcher__invite,
	.dth-ai-launcher__panel {
		background: #38434e;
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}
}

.dth-chat__type-char {
	display: inline;
	opacity: 0;
	animation: dth-chat-type-in 0.16s ease forwards;
}

@keyframes dth-chat-type-in {
	to { opacity: 1; }
}

.dth-ai-launcher :is(a, button):focus-visible {
	outline: 3px solid #d91c5c;
	outline-offset: 3px;
}

@media (max-width: 767px) {
	.dth-ai-launcher {
		right: 12px;
		bottom: max(78px, calc(env(safe-area-inset-bottom) + 66px));
	}

	.dth-ai-launcher__panel {
		width: calc(100vw - 24px);
	}

	.dth-ai-launcher__panel .dth-chat {
		height: min(540px, calc(100dvh - 98px));
		padding: 14px;
	}

	.dth-ai-launcher__panel .dth-chat__head {
		gap: 8px;
	}

	.dth-ai-launcher__panel .dth-chat__avatar {
		width: 38px;
		height: 38px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dth-ai-launcher__toggle,
	.dth-ai-launcher__invite,
	.dth-ai-launcher__panel,
	.dth-ai-launcher__open,
	.dth-chat__type-char {
		transition: none;
		animation: none;
		opacity: 1;
	}
}

/* Keep the Live floating-contact wrapper from covering the AI popup without
 * changing its visual design or disabling its own controls. */
.floating-social-wrapper {
	pointer-events: none;
}

.floating-social-wrapper.active .floating-social-list,
.floating-social-toggle {
	pointer-events: auto;
}

/* Use the whole gradient panel while chat is visible; keep fallback form spacing. */
.dth-contact-panel:has(#dth-chatbot:not([hidden])) {
	display: flex;
	flex-direction: column;
	padding: 0 !important;
}

.dth-contact-panel:has(#dth-chatbot:not([hidden])) > .custom_form_contact {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
}

.dth-contact-panel:has(#dth-chatbot:not([hidden])) > .w_logo_contact {
	display: none;
}

/* The contact columns stack below XL. Show the available chatbot first, but
 * preserve the original form position when chatbot service is unavailable. */
@media (max-width: 1199px) {
	.bg_contact > .container > .row > .col-60:has(.dth-contact-panel #dth-chatbot:not([hidden])) {
		order: -1;
	}
}

.dth-contact-panel #dth-chatbot[hidden] {
	display: none;
}

.dth-contact-panel .dth-chat {
	flex: 1 1 auto;
	width: 100%;
	max-height: none;
	padding: clamp(18px, 2.5vw, 32px);
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

.dth-contact-panel .dth-chat::before {
	content: none;
}

.dth-contact-panel .dth-chat__head {
	gap: 14px;
	padding: 0 0 22px;
	margin-bottom: 0;
}

.dth-contact-panel .dth-chat__title {
	font-size: 1.08em;
	line-height: 1.5;
	white-space: normal;
}

.dth-contact-panel .dth-chat__status {
	color: rgba(255, 255, 255, 0.8);
}

.dth-contact-panel .dth-chat__toform {
	min-height: 44px;
}

.dth-contact-panel .dth-chat__log {
	padding: 24px 4px 12px 0;
	border: 0;
	border-radius: 0;
	background: transparent;
}

.dth-contact-panel .dth-chat__bubble {
	max-width: min(85%, 540px);
	line-height: 1.75;
}

.dth-contact-panel .dth-chat__form {
	margin-top: 16px;
	box-shadow: 0 6px 20px rgba(0, 17, 50, 0.12);
}

.dth-contact-panel .dth-chat__form:focus-within {
	box-shadow: 0 0 0 3px rgba(25, 163, 219, 0.45);
}

.dth-contact-panel .dth-chat__foot {
	color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 575px) {
	.dth-contact-panel .dth-chat__head {
		flex-wrap: wrap;
		gap: 10px;
		padding-bottom: 16px;
	}

	.dth-contact-panel .dth-chat__identity {
		flex: 1 1 120px;
	}

	.dth-contact-panel .dth-chat__title {
		font-size: 1em;
	}

	.dth-contact-panel .dth-chat__log {
		padding-top: 18px;
	}

	.dth-contact-panel .dth-chat__toform {
		font-size: 12px;
	}

	.dth-contact-panel .dth-chat__send {
		width: 44px;
		height: 44px;
	}
}

.dth-chat {
	--dth-chat-blue: #19a3db;
	--dth-chat-blue-deep: #087cb5;
	--dth-chat-pink: #d91c5c;
	--dth-chat-ink: #11233f;
	--dth-chat-muted: #72819a;
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	height: clamp(640px, 78vh, 780px);
	min-height: 640px;
	max-height: 780px;
	padding: 18px;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 24px;
	background:
		linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06)),
		rgba(0, 25, 67, 0.38);
	box-shadow:
		0 24px 70px rgba(0, 14, 44, 0.28),
		inset 0 1px 0 rgba(255, 255, 255, 0.2);
	color: #fff;
	font-size: var(--fs_body_2, 16px);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
}

.dth-chat::before {
	position: absolute;
	z-index: -1;
	top: -100px;
	right: -90px;
	width: 240px;
	height: 240px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(25, 163, 219, 0.38), rgba(25, 163, 219, 0));
	content: "";
	pointer-events: none;
}

/* ---------------------------------------------------------------- header */

.dth-chat__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 2px 2px 16px;
	margin-bottom: 14px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

/* รูปผู้ช่วย: วงแหวนไล่สีหมุนรอบรูป + จุดสถานะออนไลน์มุมล่างขวา */
.dth-chat__avatar {
	position: relative;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	box-shadow: 0 10px 26px rgba(0, 18, 52, 0.32);
	isolation: isolate;
}

/* วงแหวนไล่สี */
.dth-chat__avatar::before {
	position: absolute;
	z-index: 0;
	inset: -3px;
	border-radius: 50%;
	background: conic-gradient(from 0deg, #19a3db, #7cc6ff, #d91c5c, #7b5cff, #19a3db);
	opacity: 0.9;
	content: "";
	animation: dth-chat-ring 9s linear infinite;
}

/* พื้นหลังใต้รูป คั่นวงแหวนไม่ให้ติดขอบรูป */
.dth-chat__avatar::after {
	position: absolute;
	z-index: 1;
	inset: 0;
	border-radius: 50%;
	background: linear-gradient(145deg, #0b3563 0%, #06214a 100%);
	content: "";
}

.dth-chat__avatar-text,
.dth-chat__avatar-img {
	position: relative;
	z-index: 2;
}

.dth-chat__avatar-text {
	color: #fff;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.04em;
}

.dth-chat__avatar-img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
}

/* รูปโหลดขึ้นแล้ว ไม่ต้องแสดงตัวอักษรย่อสำรอง */
.dth-chat__avatar.is-photo .dth-chat__avatar-text {
	display: none;
}

.dth-chat__presence {
	position: absolute;
	z-index: 3;
	right: -1px;
	bottom: -1px;
	width: 12px;
	height: 12px;
	border: 2px solid #06214a;
	border-radius: 50%;
	background: #4ade80;
	box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.22);
	animation: dth-chat-presence 2.6s ease-out infinite;
}

@keyframes dth-chat-ring {
	to {
		transform: rotate(360deg);
	}
}

@keyframes dth-chat-presence {
	0%,
	100% {
		box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.22);
	}

	50% {
		box-shadow: 0 0 0 5px rgba(74, 222, 128, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.dth-chat__avatar::before,
	.dth-chat__presence {
		animation: none;
	}
}

.dth-chat__identity {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 3px;
}

.dth-chat__title {
	overflow: hidden;
	font-size: 0.96em;
	font-weight: 650;
	line-height: 1.35;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dth-chat__status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: rgba(255, 255, 255, 0.68);
	font-size: 0.72em;
	line-height: 1.35;
}

.dth-chat__toform {
	flex: 0 0 auto;
	margin-left: auto;
	padding: 7px 11px;
	border: 1px solid rgba(255, 255, 255, 0.22);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.82);
	font-size: 0.72em;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dth-chat__toform:hover {
	border-color: rgba(255, 255, 255, 0.45);
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	transform: translateY(-1px);
}

.dth-chat__toform:focus-visible,
.dth-chat__done-alt:focus-visible,
.dth-chat__jump:focus-visible,
.dth-chat__send:focus-visible,
.dth-chat__log:focus-visible,
.dth-chat__done a:focus-visible,
.dth-chat__foot a:focus-visible {
	outline: 3px solid rgba(255, 255, 255, 0.55);
	outline-offset: 3px;
}

/* ------------------------------------------------------------------- log */

.dth-chat__logwrap {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	min-height: 0;
}

.dth-chat__log {
	flex: 1 1 auto;
	width: 100%;
	min-height: 0;
	max-height: none;
	padding: 18px 14px 10px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	touch-action: pan-y;
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 18px;
	background: rgba(1, 17, 45, 0.18);
	scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
	scrollbar-width: thin;
}

.dth-chat__log::-webkit-scrollbar {
	width: 5px;
}

.dth-chat__log::-webkit-scrollbar-track {
	background: transparent;
}

.dth-chat__log::-webkit-scrollbar-thumb {
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.28);
}

.dth-chat__jump {
	position: absolute;
	z-index: 2;
	right: 0;
	bottom: 12px;
	left: 0;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	width: fit-content;
	padding: 7px 14px;
	margin: 0 auto;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 999px;
	background: rgba(6, 32, 74, 0.92);
	box-shadow: 0 8px 22px rgba(0, 14, 44, 0.36);
	color: #fff;
	font-family: inherit;
	font-size: 0.74em;
	font-weight: 550;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.dth-chat__jump[hidden] {
	display: none;
}

.dth-chat__jump:hover {
	background: rgba(9, 44, 100, 0.96);
	transform: translateY(-1px);
}

.dth-chat__msg {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin-bottom: 13px;
	animation: dth-chat-message-in 0.26s ease both;
}

/* รูปเล็กหน้าข้อความของบอท ใช้รูปเดียวกับหัวแชต */
.dth-chat__msg--bot::before {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin-bottom: 2px;
	border: 1px solid rgba(255, 255, 255, 0.44);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	color: rgba(255, 255, 255, 0.92);
	font-size: 10px;
	font-weight: 750;
	content: "D";
}

/* JS ตั้ง --dth-chat-avatar ให้หลังรูปโหลดสำเร็จ ถ้ารูปไม่ขึ้นจะคงตัวอักษร "D" ไว้เหมือนเดิม */
.dth-chat.has-avatar .dth-chat__msg--bot::before {
	border-color: rgba(255, 255, 255, 0.28);
	background-image: var(--dth-chat-avatar);
	background-position: center;
	background-size: cover;
	box-shadow: 0 4px 12px rgba(0, 14, 44, 0.24);
	content: "";
}

.dth-chat__msg--user {
	justify-content: flex-end;
}

.dth-chat__msg--sys {
	justify-content: center;
}

.dth-chat__bubble {
	max-width: min(88%, 540px);
	padding: 12px 15px;
	border-radius: 17px;
	font-size: 0.96em;
	line-height: 1.68;
	word-break: break-word;
	white-space: pre-wrap;
}

.dth-chat__msg--bot .dth-chat__bubble {
	border: 1px solid rgba(255, 255, 255, 0.88);
	border-bottom-left-radius: 6px;
	background: linear-gradient(145deg, #fff 0%, #f3f9fc 100%);
	box-shadow: 0 8px 22px rgba(0, 14, 44, 0.16);
	color: var(--dth-chat-ink);
}

.dth-chat__msg--user .dth-chat__bubble {
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-bottom-right-radius: 6px;
	background: linear-gradient(135deg, var(--dth-chat-blue) 0%, var(--dth-chat-blue-deep) 100%);
	box-shadow: 0 9px 24px rgba(4, 102, 157, 0.28);
	color: #fff;
}

.dth-chat__msg--sys .dth-chat__bubble {
	max-width: 96%;
	padding: 9px 14px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 14px;
	background: rgba(217, 28, 92, 0.17);
	color: rgba(255, 255, 255, 0.88);
	font-size: 0.78em;
	line-height: 1.5;
	text-align: center;
}

@keyframes dth-chat-message-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* --------------------------------------------------------------- typing */

.dth-chat__typing .dth-chat__bubble {
	display: flex;
	align-items: center;
	gap: 5px;
	min-height: 40px;
	padding: 14px 16px;
}

.dth-chat__typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #7893aa;
	animation: dth-chat-blink 1.2s infinite ease-in-out;
}

.dth-chat__typing i:nth-child(2) {
	animation-delay: 0.18s;
}

.dth-chat__typing i:nth-child(3) {
	animation-delay: 0.36s;
}

@keyframes dth-chat-blink {
	0%,
	60%,
	100% {
		opacity: 0.28;
		transform: translateY(0);
	}

	30% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

/* ----------------------------------------------------------------- done */

.dth-chat__done {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	padding: 18px 16px;
	margin: 8px 0 12px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 18px;
	background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.07));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
	text-align: center;
}

.dth-chat__done strong {
	font-size: 0.95em;
	font-weight: 650;
}

.dth-chat__done span {
	color: rgba(255, 255, 255, 0.68);
	font-size: 0.82em;
	line-height: 1.5;
}

.dth-chat__done a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 8px 18px;
	margin-top: 8px;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--dth-chat-blue), var(--dth-chat-blue-deep));
	box-shadow: 0 8px 20px rgba(4, 102, 157, 0.24);
	color: #fff;
	font-size: 0.82em;
	font-weight: 550;
	text-decoration: none;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.dth-chat__done a:hover {
	box-shadow: 0 10px 24px rgba(4, 102, 157, 0.34);
	color: #fff;
	transform: translateY(-1px);
}

.dth-chat__closed-contact {
	border-color: rgba(217, 28, 92, 0.28);
}

.dth-chat__done-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 10px;
}

.dth-chat__done-actions a {
	margin-top: 0;
}

.dth-chat__done-alt {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 38px;
	padding: 8px 18px;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.86);
	font-family: inherit;
	font-size: 0.82em;
	font-weight: 550;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dth-chat__done-alt:hover {
	border-color: rgba(255, 255, 255, 0.5);
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	transform: translateY(-1px);
}

/* ----------------------------------------------------------------- form */

.dth-chat__form {
	position: relative;
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 10px;
	padding: 8px 8px 8px 15px;
	margin-top: 14px;
	border: 1px solid rgba(255, 255, 255, 0.72);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.94);
	box-shadow: 0 12px 30px rgba(0, 17, 50, 0.2);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dth-chat__form:focus-within {
	border-color: rgba(25, 163, 219, 0.9);
	box-shadow:
		0 12px 30px rgba(0, 17, 50, 0.22),
		0 0 0 3px rgba(25, 163, 219, 0.18);
}

.custom_form_contact .dth-chat .dth-chat__input {
	flex: 1 1 auto;
	width: 100%;
	height: 42px !important;
	min-height: 42px !important;
	max-height: 150px !important;
	padding: 9px 0 !important;
	overflow-y: hidden;
	border: 0 !important;
	border-radius: 0 !important;
	outline: 0 !important;
	background: transparent !important;
	background-image: none !important;
	box-shadow: none !important;
	color: var(--dth-chat-ink) !important;
	font: inherit !important;
	font-size: 0.95em !important;
	line-height: 1.6 !important;
	resize: none !important;
	scrollbar-color: rgba(17, 35, 63, 0.28) transparent;
	scrollbar-width: thin;
}

.custom_form_contact .dth-chat .dth-chat__input::-webkit-scrollbar {
	width: 4px;
}

.custom_form_contact .dth-chat .dth-chat__input::-webkit-scrollbar-thumb {
	border-radius: 999px;
	background: rgba(17, 35, 63, 0.28);
}

.custom_form_contact .dth-chat .dth-chat__input::placeholder {
	color: #8c9aae !important;
}

.custom_form_contact .dth-chat .dth-chat__input:disabled {
	opacity: 0.48;
}

.dth-chat__send {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 14px;
	background: linear-gradient(135deg, var(--dth-chat-blue) 0%, var(--dth-chat-blue-deep) 100%);
	box-shadow: 0 7px 18px rgba(4, 102, 157, 0.3);
	color: #fff;
	cursor: pointer;
	transition: box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.dth-chat__send:hover:not(:disabled) {
	box-shadow: 0 9px 22px rgba(4, 102, 157, 0.42);
	transform: translateY(-1px);
}

.dth-chat__send:active:not(:disabled) {
	transform: translateY(0) scale(0.97);
}

.dth-chat__send:disabled {
	opacity: 0.42;
	cursor: default;
}

/* Honeypot: hidden visually but kept in the DOM for bot detection. */
.dth-chat__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
	pointer-events: none;
}

.dth-chat__foot {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 10px 4px 0;
	color: rgba(255, 255, 255, 0.56);
	font-size: 0.7em;
	line-height: 1.5;
	text-align: center;
}

.dth-chat__hint {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 3px;
	color: rgba(255, 255, 255, 0.62);
}

.dth-chat__hint kbd {
	display: inline-block;
	padding: 1px 6px;
	border: 1px solid rgba(255, 255, 255, 0.26);
	border-radius: 5px;
	background: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.86);
	font-family: inherit;
	font-size: 0.94em;
	line-height: 1.5;
}

.dth-chat__foot a {
	color: rgba(255, 255, 255, 0.8);
	text-decoration-color: rgba(255, 255, 255, 0.34);
	text-underline-offset: 2px;
}

/* ---------------------------------------------------------- responsive */

@media (max-width: 991px) {
	.dth-chat {
		height: min(720px, calc(100svh - 32px));
		min-height: 560px;
		max-height: 720px;
		padding: 16px;
		border-radius: 21px;
	}

	.dth-chat__bubble {
		max-width: 88%;
	}
}

@media (max-width: 575px) {
	.dth-chat {
		height: min(700px, calc(100svh - 24px));
		min-height: 540px;
		max-height: 700px;
		padding: 13px;
		border-radius: 18px;
	}

	.dth-chat__head {
		gap: 9px;
		padding-bottom: 13px;
	}

	.dth-chat__avatar {
		width: 40px;
		height: 40px;
	}

	.dth-chat__avatar-text {
		font-size: 11px;
	}

	.dth-chat__presence {
		width: 10px;
		height: 10px;
	}

	.dth-chat__title {
		font-size: 0.88em;
	}

	.dth-chat__status {
		font-size: 0.66em;
	}

	.dth-chat__toform {
		padding: 6px 10px;
		font-size: 0.62em;
	}

	.dth-chat__log {
		padding: 14px 10px 6px;
	}

	.dth-chat__hint {
		display: none;
	}

	.custom_form_contact .dth-chat .dth-chat__input {
		font-size: 16px !important;
	}

	.dth-chat__msg--bot::before {
		width: 24px;
		height: 24px;
	}

	.dth-chat__bubble {
		max-width: 90%;
		padding: 10px 12px;
		font-size: 0.88em;
	}

	.dth-chat__form {
		padding: 7px 7px 7px 13px;
		border-radius: 16px;
	}

	.dth-chat__send {
		width: 39px;
		height: 39px;
		border-radius: 12px;
	}
}

@media (max-height: 760px) and (min-width: 992px) {
	.dth-chat {
		height: 600px;
		min-height: 600px;
		max-height: 600px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dth-chat__msg,
	.dth-chat__typing i {
		animation: none;
	}

	.dth-chat__toform,
	.dth-chat__send,
	.dth-chat__jump,
	.dth-chat__done-alt,
	.dth-chat__done a {
		transition: none;
	}
}
