/* Own widget, own theme - white body, blue gradient header, per the
   2026-09-30 reference (mascot header, greeting card, quick-reply
   menu, TH/EN toggle). */

.mgw-chatbot-toggle {
	position: fixed;
	right: 24px;
	bottom: 24px;
	width: 60px;
	height: 54px;
	background: none;
	border: none;
	filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	padding: 0;
}
/* The SVG already draws its own full circular badge (and the yellow
   speech-bubble notch sticking out past that circle) - cropping it
   into another circle here just mangles that, so it's shown whole
   instead of forced to cover a fixed box. */
.mgw-chatbot-toggle img { display: block; width: 100%; height: 100%; object-fit: contain; }

.mgw-chatbot-panel {
	position: fixed;
	right: 24px;
	bottom: 92px;
	width: 360px;
	max-height: min(600px, calc(100vh - 120px));
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 9999;
}
.mgw-chatbot-panel[hidden] { display: none; }

/* ---------------- Header ---------------- */

/* Chatbot-banner.png already draws the mascot, title, status and the
   TH/EN pills as pixels (confirmed 2026-10-01) - this is the whole
   header, not a backdrop behind a DOM-built one. Its own aspect ratio
   (2159x728) keeps the pills' positions proportional at any panel
   width, which is what the percentage-based hit-areas below rely on. */
.mgw-chatbot-header {
	position: relative;
	aspect-ratio: 2159 / 728;
	background-size: cover;
	background-position: left center;
	background-repeat: no-repeat;
}

.mgw-chatbot-lang-hit {
	position: absolute;
	top: 35%;
	height: 13%;
	/* transparent - the image already renders the TH/EN pill under it.
	   A <button> (needed since 2026-10-02 for setChatLang(), not a plain
	   navigating <a> anymore) needs these reset explicitly, unlike a link. */
	background: transparent;
	border: 0;
	padding: 0;
	cursor: pointer;
}
.mgw-chatbot-lang-hit-th { left: 80.5%; width: 7.5%; }
.mgw-chatbot-lang-hit-en { left: 89.5%; width: 8.8%; }

.mgw-chatbot-close {
	position: absolute;
	top: 10px;
	right: 10px;
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.85);
	font-size: 18px;
	cursor: pointer;
	line-height: 1;
	padding: 2px;
}

/* ---------------- Body ---------------- */

.mgw-chatbot-body {
	background: #fff;
	padding: 14px;
	overflow-y: auto;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.mgw-chatbot-menu-area {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.mgw-chatbot-menu-area[hidden] {
	display: none;
}

.mgw-chatbot-greeting {
	background: #f7fafd;
	border: 1px solid #d6e9fc;
	border-radius: 12px;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.mgw-chatbot-greeting[hidden] {
	display: none;
}
.mgw-chatbot-greeting-hi {
	font-size: 14px;
	font-weight: 700;
	color: #1f4a8a;
}
.mgw-chatbot-greeting-brand {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.3px;
	color: #1f4a8a;
	margin-bottom: 4px;
}
.mgw-chatbot-greeting-body {
	font-size: 15px;
	font-weight: 400;
	line-height: 1.7;
	color: #1f4a8a;
	margin: 0;
}

.mgw-chatbot-quick-replies {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.mgw-chatbot-qr {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #f7fafd;
	border: 1px solid #d6e9fc;
	border-radius: 12px;
	padding: 11px 14px;
	text-decoration: none;
	transition: background-color 0.15s ease, transform 0.15s ease;
}
.mgw-chatbot-qr:hover {
	background: #eef6ff;
	transform: translateY(-1px);
}
.mgw-chatbot-qr-icon {
	flex-shrink: 0;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mgw-chatbot-qr-icon img { display: block; max-width: 100%; max-height: 100%; }
.mgw-chatbot-qr-label {
	font-size: 15px;
	font-weight: 400;
	color: #1f4a8a;
}

.mgw-chat-msg {
	font-size: 12.5px;
	line-height: 1.6;
	padding: 10px 12px;
	border-radius: 10px;
	max-width: 88%;
	box-sizing: border-box;
}
/* Confirmed 2026-10-01: bot bubbles are a bordered pale-blue card, not
   a solid-fill bubble - sit inside .mgw-chat-row next to the mascot
   avatar rather than being a direct .mgw-chatbot-body child. */
.mgw-chat-row {
	display: flex;
	align-items: flex-start;
	gap: 4px;
}
/* Mirrors the bot's row (icon outermost, box innermost) - confirmed
   2026-10-01 the visitor's own messages get the same icon+box
   treatment as the bot's, just on the right. */
.mgw-chat-row.is-visitor {
	/* flex-end here would mean the END of the (reversed) main axis,
	   which row-reverse puts on the LEFT - flex-start is what actually
	   packs content to the right. Confirmed 2026-10-01 after it visibly
	   packed left instead. */
	justify-content: flex-start;
	flex-direction: row-reverse;
}
.mgw-chat-avatar {
	flex-shrink: 0;
	width: 35px;
	height: 35px;
}
.mgw-chat-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }

.mgw-chat-msg.is-bot {
	position: relative;
	background: #f7fafd;
	border: 1px solid #d6e9fc;
	color: #1f4a8a;
	font-size: 15px;
	max-width: 260px;
	margin-left: 8px;
}
/* The bubble's pointer/tail, pointing back at the mascot avatar -
   confirmed 2026-10-01. Two stacked triangles (border color behind,
   fill color in front, offset by the border width) since a flat
   border-radius bubble has no edge to carry a real border otherwise. */
.mgw-chat-msg.is-bot::after {
	content: "";
	position: absolute;
	left: -8px;
	top: 14px;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 6px 8px 6px 0;
	border-color: transparent #d6e9fc transparent transparent;
}
.mgw-chat-msg.is-bot::before {
	content: "";
	position: absolute;
	z-index: 1;
	left: -6.5px;
	top: 14px;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 6px 6.5px 6px 0;
	border-color: transparent #f7fafd transparent transparent;
}
.mgw-chat-msg.is-staff::after,
.mgw-chat-msg.is-staff::before {
	border-right-color: #b45309;
}
/* Confirmed 2026-10-02: solid blue, no border - the visitor's own
   bubble is a distinct color/weight from the bot's pale one now,
   rather than matching it. */
.mgw-chat-msg.is-visitor {
	position: relative;
	background: #57b3fd;
	color: #fff;
	font-size: 13px;
	max-width: 260px;
	margin-right: 8px;
}
/* A single tail triangle, same fill as the bubble - no border to fake
   with a second layer now that the bubble itself has none. */
.mgw-chat-msg.is-visitor::after {
	content: "";
	position: absolute;
	right: -7px;
	top: 14px;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 6px 0 6px 7px;
	border-color: transparent transparent transparent #57b3fd;
}
.mgw-chat-col.is-visitor {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
}
.mgw-chat-time {
	font-size: 11px;
	color: #8a9bb0;
	margin-right: 8px;
}
/* A real staff reply - same side as the bot (both are "the site"
   answering, from the visitor's seat) but a distinct color so it's
   obvious a human, not the AI, wrote this one - confirmed 2026-09-21. */
.mgw-chat-msg.is-staff {
	background: #b45309;
	border: none;
	color: #fff;
}
.mgw-chat-sender {
	display: block;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	opacity: 0.75;
	margin-bottom: 3px;
}

/* Sign-in prompt shown inline in the chat for the gated quick-replies
   (Fast Track / Immigration Process / VAT Refund / Event Information)
   - confirmed 2026-10-01. */
.mgw-chatbot-gate-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f7fafd;
	border: 1px solid #d6e9fc;
	border-radius: 14px;
	padding: 16px;
}
.mgw-chatbot-gate-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 11px 14px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	box-sizing: border-box;
}
.mgw-chatbot-gate-btn-primary {
	background: linear-gradient(135deg, #2f4cdd 0%, #1f3bc7 100%);
	color: #fff;
}

/* The 4 "benefits" quick-replies' sign-in card (Fast Track /
   Immigration Process / VAT Refund / Event Information) - distinct
   from .mgw-chatbot-gate-card (Self Evaluation's login card) so this
   spec doesn't leak into that one. Exact colors confirmed 2026-10-01. */
.mgw-chatbot-benefits-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f7fafd;
	border-radius: 14px;
	padding: 16px;
}
.mgw-chatbot-benefits-title {
	font-size: 20px;
	font-weight: 700;
	color: #1f4a8a;
}
.mgw-chatbot-benefits-check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	color: #1f4a8a;
}
.mgw-chatbot-benefits-check-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.mgw-chatbot-benefits-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 11px 14px;
	border-radius: 100px;
	font-weight: 700;
	text-decoration: none;
	box-sizing: border-box;
}
.mgw-chatbot-benefits-btn-primary {
	background: #0451d8;
	color: #fff;
	font-size: 14px;
}
.mgw-chatbot-benefits-btn-secondary {
	background: #fff;
	border: 1px solid #d6e9fc;
	color: #1f4a8a;
	font-size: 12px;
	font-weight: 600;
}

/* Self Evaluation's fuller login card (Login/Register + Google/TCEB
   SSO + a register link) - confirmed 2026-10-01, reuses
   .mgw-chatbot-gate-card for the outer frame. */
.mgw-chatbot-divider {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 2px 0;
	font-size: 11.5px;
	font-weight: 600;
	color: #64748b;
	text-transform: uppercase;
}
.mgw-chatbot-divider::before,
.mgw-chatbot-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: #e2e8f0;
}
.mgw-chatbot-oauth-buttons {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.mgw-chatbot-oauth-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border: 1px solid #d7dee8;
	border-radius: 999px;
	padding: 11px 16px;
	font-size: 13px;
	font-weight: 600;
	color: #1f2937;
	background: #fff;
	text-decoration: none;
}
.mgw-chatbot-oauth-btn:hover { background: #f8fafc; }
.mgw-chatbot-login-footer {
	text-align: center;
	font-size: 13px;
	color: #64748b;
	margin: 0;
}
.mgw-chatbot-login-footer a { color: #0064a9; font-weight: 600; text-decoration: none; }

/* Self Evaluation's post-login success card - exact colors/sizes
   confirmed 2026-10-01. */
.mgw-chatbot-se-card {
	background: #fef9e8;
	border-radius: 14px;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.mgw-chatbot-se-head {
	display: flex;
	align-items: center;
	gap: 8px;
}
.mgw-chatbot-se-title {
	font-size: 20px;
	font-weight: 700;
	color: #1f4a8a;
}
.mgw-chatbot-se-desc {
	font-size: 15px;
	font-weight: 400;
	color: #1f4a8a;
	margin: 0;
	line-height: 1.6;
}
.mgw-chatbot-se-cta {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fdcf45;
	border-radius: 100px;
	padding: 12px 16px;
	font-size: 12px;
	font-weight: 700;
	color: #1f4a8a;
	text-decoration: none;
	margin-top: 4px;
}

/* Confirmed 2026-10-02: the "forward to staff" pill on a "no answer"
   bot reply - sits inside the same bubble, below the text. */
.mgw-chatbot-escalate-row {
	margin-top: 10px;
}
.mgw-chatbot-escalate-btn {
	display: flex;
	width: 100%;
	align-items: center;
	justify-content: center;
	gap: 8px;
	background: #fff;
	border: 1px solid #d6e9fc;
	border-radius: 100px;
	padding: 8px 14px;
	font-size: 12px;
	font-weight: 600;
	color: #0451d8;
	cursor: pointer;
}
.mgw-chatbot-escalate-btn:disabled {
	cursor: default;
	opacity: 0.7;
}
.mgw-chatbot-escalate-icon {
	display: inline-flex;
	flex-shrink: 0;
}

/* FAQ's inline "popular questions" list - confirmed 2026-10-01,
   replaces navigating to /faq/ outright. */
.mgw-chatbot-faq-card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #f7fafd;
	border: 1px solid #d6e9fc;
	border-radius: 14px;
	padding: 16px;
}
.mgw-chatbot-faq-head {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 700;
	color: #1f4a8a;
	margin-bottom: 2px;
}
.mgw-chatbot-faq-head-icon { display: flex; flex-shrink: 0; }
.mgw-chatbot-faq-row {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	border: 1px solid #d6e9fc;
	border-radius: 12px;
	padding: 10px 12px;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
}
.mgw-chatbot-faq-row:hover { background: #eef6ff; }
.mgw-chatbot-faq-row-icon { flex-shrink: 0; display: flex; }
.mgw-chatbot-faq-row-icon img { display: block; }
.mgw-chatbot-faq-row-label {
	font-size: 13px;
	font-weight: 600;
	color: #1e293b;
	line-height: 1.5;
}

/* ---------------- Footer ---------------- */

.mgw-chatbot-footer {
	display: flex;
	align-items: center;
	height: 45px;
	margin: 0 14px 14px;
	padding: 4px 4px 4px 16px;
	gap: 10px;
	background: #fff;
	border: 1px solid #d2defb;
	border-radius: 12px;
}
.mgw-chatbot-menu {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mgw-chatbot-menu img { display: block; }

.mgw-chatbot-input-row {
	display: flex;
	align-items: stretch;
	flex: 1;
}
.mgw-chatbot-input-row input {
	flex: 1;
	border: none;
	background: none;
	padding: 0;
	font-size: 12.5px;
	outline: none;
	color: #1f2937;
}
.mgw-chatbot-input-row input:disabled { opacity: 0.6; cursor: not-allowed; }
.mgw-chatbot-input-row button {
	background: linear-gradient(135deg, #0451d8 0%, #06c1f7 100%);
	border: none;
	width: 37px;
	height: 37px;
	flex-shrink: 0;
	border-radius: 9px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mgw-chatbot-input-row button img { display: block; }
.mgw-chatbot-input-row button:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 520px) {
	.mgw-chatbot-panel { width: calc(100vw - 32px); right: 16px; }
	.mgw-chatbot-toggle { right: 16px; }
}
