/* Floating webchat — full-height panel + LINE Flex cards */
#wtg-cf {
	position: fixed;
	right: 16px;
	bottom: 80px;
	z-index: 99989;
	font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 14px;
	line-height: 1.6;
}
#wtg-cf.wtg-cf-solo {
	bottom: 16px;
}
#wtg-cf-btn {
	width: 56px;
	height: 56px;
	border: 0;
	border-radius: 50%;
	background: #2563eb;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s;
}
#wtg-cf.open #wtg-cf-btn {
	display: none;
}
/* แนวทาง A: เปิด LINE → ซ่อนปุ่มแชท */
body:has(#wtg-lf.open) #wtg-cf-btn {
	display: none !important;
}
#wtg-cf-btn:hover {
	transform: scale(1.06);
}
#wtg-cf-btn svg {
	width: 26px;
	height: 26px;
	display: block;
}
#wtg-cf-panel {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: auto;
	width: min(400px, 100vw);
	height: 100vh;
	height: 100dvh;
	max-height: none;
	background: #fff;
	border-radius: 0;
	box-shadow: -8px 0 28px rgba(0, 0, 0, 0.18);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	z-index: 99991;
}
#wtg-cf-panel[hidden] {
	display: none !important;
}
.wtg-cf-hd {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	background: #2563eb;
	color: #fff;
	font-weight: 700;
	font-size: 15px;
}
.wtg-cf-x {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}
.wtg-cf-msgs {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 14px;
	background: #f1f5f9;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.wtg-cf-empty {
	margin: auto;
	color: #94a3b8;
	font-size: 13px;
	text-align: center;
	padding: 16px;
}
.wtg-cf-b {
	max-width: 88%;
	padding: 8px 11px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.45;
	word-break: break-word;
	white-space: pre-wrap;
}
.wtg-cf-b.user {
	align-self: flex-end;
	background: #2563eb;
	color: #fff;
	border-bottom-right-radius: 3px;
}
.wtg-cf-b.admin {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-bottom-left-radius: 3px;
	color: #0f172a;
}
.wtg-cf-b.wtg-cf-rich {
	max-width: 100%;
	width: 100%;
	padding: 0;
	background: transparent;
	border: 0;
	white-space: normal;
}
.wtg-cf-b.wtg-cf-rich .tm {
	padding: 4px 6px 0;
	color: #64748b;
	opacity: 1;
}
.wtg-cf-b .tm {
	font-size: 10.5px;
	opacity: 0.65;
	margin-top: 3px;
}
.wtg-cf-media {
	display: block;
	max-width: 100%;
	border-radius: 10px;
}
.wtg-cf-reply {
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	align-items: flex-end;
	padding: 12px;
	border-top: 1px solid #e2e8f0;
	background: #fff;
}
.wtg-cf-menu {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background: #f8fafc;
	color: #0f172a;
	font-size: 18px;
	cursor: pointer;
	line-height: 1;
}
.wtg-cf-menu.on {
	background: #2563eb;
	border-color: #2563eb;
	color: #fff;
}
.wtg-cf-menu[hidden] {
	display: none !important;
}
.wtg-cf-rich-wrap {
	flex: 0 0 auto;
	border-top: 1px solid #e2e8f0;
	background: #0f172a;
	padding: 0;
}
.wtg-cf-rich-wrap[hidden] {
	display: none !important;
}
.wtg-cf-rich-grid {
	width: 100%;
}
.wtg-rm-stack {
	position: relative;
	width: 100%;
	line-height: 0;
}
.wtg-rm-hero {
	width: 100%;
	display: block;
	height: auto;
	user-select: none;
	-webkit-user-drag: none;
}
.wtg-rm-hit {
	position: absolute;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-template-rows: repeat(2, 1fr);
	gap: 4px;
	padding: 4px;
	box-sizing: border-box;
	margin: 0;
}
.wtg-rm-hit-btn {
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	margin: 0;
	padding: 0;
	border: none;
	border-radius: 9px;
	background: transparent;
	position: relative;
	z-index: 0;
	box-sizing: border-box;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.wtg-rm-hit-btn:disabled {
	cursor: default;
	opacity: 0.01;
}
.wtg-rm-hit-btn:not(:disabled):hover {
	z-index: 3;
	transform: scale(1.04);
	background: linear-gradient(165deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.06) 55%, rgba(255, 255, 255, 0.12) 100%);
	box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9), 0 0 0 1px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.16), 0 0 0 2px #2563eb40;
}
.wtg-rm-hit-btn:not(:disabled):active {
	transform: scale(0.97);
}
#wtg-cf-input {
	flex: 1;
	resize: none;
	min-height: 44px;
	max-height: 120px;
	padding: 10px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 14px;
	outline: none;
	font-family: inherit;
	line-height: 1.35;
}
.wtg-cf-send {
	border: 0;
	background: #2563eb;
	color: #fff;
	font-weight: 700;
	font-size: 14px;
	padding: 12px 16px;
	border-radius: 8px;
	cursor: pointer;
}
.wtg-cf-send:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.wtg-cf-status {
	flex: 0 0 auto;
	padding: 6px 12px;
	font-size: 12.5px;
	background: #fef3c7;
	color: #92400e;
}

/* LINE Flex cards */
.wtg-fx-bubble {
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid #e2e8f0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 320px;
}
.wtg-fx-bubble.nano,
.wtg-fx-bubble.micro {
	max-width: 220px;
}
.wtg-fx-bubble.mega,
.wtg-fx-bubble.giga {
	max-width: 100%;
}
.wtg-fx-hero img,
.wtg-fx-hero video {
	width: 100%;
	display: block;
}
.wtg-fx-body {
	padding: 12px;
}
.wtg-fx-footer {
	padding: 10px;
	border-top: 1px solid #f1f5f9;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.wtg-fx-box {
	width: 100%;
}
.wtg-fx-text {
	line-height: 1.35;
}
.wtg-fx-img {
	max-width: 100%;
	border-radius: 6px;
}
.wtg-fx-btn {
	width: 100%;
	padding: 9px 10px;
	border-radius: 8px;
	border: none;
	font-weight: 700;
	font-size: 13px;
	cursor: pointer;
	background: #f1f5f9;
	color: #334155;
}
.wtg-fx-btn.primary {
	background: #06c755;
	color: #fff;
}
.wtg-fx-btn.link {
	background: transparent;
	color: #2563eb;
}
.wtg-fx-sep {
	border-top: 1px solid #e2e8f0;
	height: 0;
	width: 100%;
	margin: 4px 0;
}
.wtg-fx-carousel {
	display: flex;
	overflow-x: auto;
	gap: 10px;
	padding: 4px 2px 8px;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.wtg-fx-carousel::-webkit-scrollbar {
	display: none;
}
.wtg-fx-slide {
	flex: 0 0 280px;
	scroll-snap-align: start;
	max-width: 280px;
}
.wtg-fx-scroll-wrap {
	position: relative;
	width: 100%;
}
.wtg-fx-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 1px solid #cbd5e1;
	background: rgba(255, 255, 255, 0.92);
	color: #0f172a;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
	padding: 0;
}
.wtg-fx-nav.left {
	left: -4px;
}
.wtg-fx-nav.right {
	right: -4px;
}

@media (max-width: 480px) {
	#wtg-cf {
		right: 12px;
		bottom: 76px;
	}
	#wtg-cf.wtg-cf-solo {
		bottom: 12px;
	}
	#wtg-cf-panel {
		width: 100vw;
	}
}
