/**
 * VisaBreeze Chat widget.
 *
 * Colour is anchored on the site logo's blue (#2563EB) with a cool neutral
 * scale. Every pair was
 * measured rather than eyeballed: the previous accent failed WCAG AA at 3.72:1
 * both as a link and as white-on-blue, and the bot bubble sat at 1.07:1 against
 * its surface, which is why messages read as flat text. Now: links 6.53:1,
 * white on the user bubble 13.8:1, ink 17:1, and bot bubbles carry a hairline
 * because a light surface on a light surface is defined by its edge, not by
 * pushing fill contrast until it looks like a box.
 *
 * Depth ramps stay within one hue. The old header went navy to purple at
 * near-equal value, which reads as mud; value alone reads as depth.
 *
 * Motion runs on three tokens rather than thirteen loose `ease` declarations,
 * so everything decelerates on the same curve and the widget feels like one
 * object.
 *
 * EVERY rule is scoped under the #vb-chat-root ID on purpose. Astra and
 * Elementor style bare `button` elements site-wide, and single-class selectors
 * lose to them: the chips rendered as dark rectangles and the round launcher
 * came out square. The ID prefix wins that fight, and the `#vb-chat-root button`
 * reset re-states the properties the theme sets rather than trusting inheritance.
 *
 * Thai has no word spaces, so long strings must be allowed to wrap on any
 * character (overflow-wrap) but never word-break, which splits Latin brand
 * names like "VisaBreeze" mid-word. Line height is generous because Thai
 * stacks vowel and tone marks above and below the baseline.
 */

#vb-chat-root {
	/* brand — anchored on the site logo's #2563EB */
	--vb-deep: #152a5e;
	--vb-deep-2: #0f1f47;
	--vb-deep-3: #1d3a76;
	--vb-live: #22c55e;

	/* cool neutrals, tuned to the blue */
	--vb-surface: #fbfcfe;
	--vb-bubble: #e9eef7;
	--vb-ink: #141a24;
	--vb-muted: #5b6572;
	--vb-line: #e3e8f0;
	--vb-hairline: rgba(21, 42, 94, .1);
	--vb-tint: rgba(29, 78, 216, .08);

	/* two-part shadow: a wide ambient wash plus a tighter key, so the panel
	   sits on the page instead of floating on one flat blur */
	--vb-shadow:
		0 2px 6px rgba(15, 31, 71, .06),
		0 24px 56px -16px rgba(15, 31, 71, .3);
	--vb-shadow-lift:
		0 4px 10px rgba(15, 31, 71, .08),
		0 30px 64px -16px rgba(15, 31, 71, .38);

	/* motion */
	--vb-fast: 150ms;
	--vb-base: 240ms;
	--vb-ease: cubic-bezier(.22, .9, .3, 1);
	--vb-spring: cubic-bezier(.34, 1.28, .44, 1);

	position: fixed;
	z-index: 99999;
	bottom: calc(22px + env(safe-area-inset-bottom, 0px));
	font-family: inherit;
	line-height: 1.75;
	-webkit-font-smoothing: antialiased;
}

#vb-chat-root.vb-chat--bottom-right {
	right: calc(22px + env(safe-area-inset-right, 0px));
	--vb-origin: bottom right;
}

#vb-chat-root.vb-chat--bottom-left {
	left: calc(22px + env(safe-area-inset-left, 0px));
	--vb-origin: bottom left;
}

#vb-chat-root *,
#vb-chat-root *::before,
#vb-chat-root *::after {
	box-sizing: border-box;
}

/* Neutralise theme button styling before anything else is applied.
   Elementor's global kit puts `text-shadow: rgba(0,0,0,.3) 0 0 10px` on every
   button site-wide, which smeared the quick-reply labels and the close glyph. */
#vb-chat-root button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	border: 0;
	box-shadow: none;
	text-shadow: none;
	background-image: none;
	text-transform: none;
	letter-spacing: normal;
	font: inherit;
	cursor: pointer;
}

/* Text shadow inherits, so block it at the root too in case a theme sets one
   on an ancestor of the widget. */
#vb-chat-root,
#vb-chat-root .vb-chat__panel,
#vb-chat-root .vb-chat__msg,
#vb-chat-root .vb-chat__input {
	text-shadow: none;
}

/* ---------- launcher ---------- */

#vb-chat-root .vb-chat__launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	border-radius: 100px;
	/* one hue, light to dark, so the blend reads as a rounded form */
	background: linear-gradient(150deg, var(--vb-deep-3) 0%, var(--vb-deep) 55%, var(--vb-deep-2) 100%);
	box-shadow: var(--vb-shadow);
	transition:
		transform var(--vb-base) var(--vb-spring),
		box-shadow var(--vb-base) var(--vb-ease);
}

#vb-chat-root .vb-chat__launcher:hover {
	transform: translateY(-3px) scale(1.04);
	box-shadow: var(--vb-shadow-lift);
}

#vb-chat-root .vb-chat__launcher:active {
	transform: translateY(-1px) scale(.97);
	transition-duration: var(--vb-fast);
}

#vb-chat-root .vb-chat__launcher:focus-visible {
	outline: 3px solid var(--vb-accent);
	outline-offset: 4px;
}

/* One-time nudge: a single ring, not a loop, so it reads as an invitation
   rather than an alarm. Cleared by script once the panel has been opened. */
#vb-chat-root .vb-chat__launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	border: 2px solid var(--vb-deep-3);
	opacity: 0;
	pointer-events: none;
}

#vb-chat-root[data-nudge="true"] .vb-chat__launcher::after {
	animation: vb-ring 2.2s var(--vb-ease) 2;
}

@keyframes vb-ring {
	0% { opacity: .6; transform: scale(1); }
	70%, 100% { opacity: 0; transform: scale(1.45); }
}

#vb-chat-root .vb-chat__icon {
	position: absolute;
	width: 26px;
	height: 26px;
	fill: none;
	stroke: #fff;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition:
		opacity var(--vb-fast) var(--vb-ease),
		transform var(--vb-base) var(--vb-spring);
}

#vb-chat-root .vb-chat__icon--chat {
	fill: #fff;
	stroke: none;
}

#vb-chat-root[data-open="false"] .vb-chat__icon--close,
#vb-chat-root[data-open="true"] .vb-chat__icon--chat {
	opacity: 0;
	transform: rotate(-90deg) scale(.5);
}

#vb-chat-root[data-open="true"] .vb-chat__icon--close,
#vb-chat-root[data-open="false"] .vb-chat__icon--chat {
	opacity: 1;
	transform: rotate(0) scale(1);
}

/* ---------- panel ---------- */

#vb-chat-root .vb-chat__panel {
	position: absolute;
	bottom: 78px;
	width: min(392px, calc(100vw - 44px));
	height: min(580px, calc(100vh - 150px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--vb-surface);
	border: 1px solid var(--vb-line);
	border-radius: 22px;
	box-shadow: var(--vb-shadow);
	transform-origin: var(--vb-origin);
	/* The panel grows out of the launcher rather than sliding in from nowhere. */
	animation: vb-panel-in 380ms var(--vb-ease);
}

/* The ID-scoped display:flex above outranks the browser's [hidden]{display:none},
   so hiding the panel must be re-stated at matching specificity. Without this the
   panel is permanently open for every visitor. */
#vb-chat-root .vb-chat__panel[hidden] { display: none; }

#vb-chat-root.vb-chat--bottom-right .vb-chat__panel { right: 0; }
#vb-chat-root.vb-chat--bottom-left .vb-chat__panel { left: 0; }

@keyframes vb-panel-in {
	from { opacity: 0; transform: scale(.86) translateY(16px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

#vb-chat-root .vb-chat__header {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 14px 15px;
	/* single hue, value only — the old navy-to-purple ramp read as mud */
	background: linear-gradient(135deg, var(--vb-deep-2) 0%, var(--vb-deep) 60%, var(--vb-deep-3) 100%);
	color: #fff;
}

#vb-chat-root .vb-chat__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 100px;
	background: rgba(255, 255, 255, .13);
	border: 1px solid rgba(255, 255, 255, .2);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .6px;
	color: #fff;
}

#vb-chat-root .vb-chat__heading {
	flex: 1 1 auto;
	min-width: 0;
}

#vb-chat-root .vb-chat__title {
	display: block;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	color: #fff;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#vb-chat-root .vb-chat__status {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 11.5px;
	line-height: 1.5;
	color: rgba(255, 255, 255, .74);
}

#vb-chat-root .vb-chat__dot {
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	border-radius: 100px;
	background: var(--vb-live);
	animation: vb-pulse 2.4s var(--vb-ease) infinite;
}

@keyframes vb-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); }
	70%, 100% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

#vb-chat-root .vb-chat__close {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	padding: 0;
	border-radius: 100px;
	background: transparent;
	color: #fff;
	font-size: 19px;
	line-height: 1;
	transition:
		background var(--vb-fast) var(--vb-ease),
		transform var(--vb-base) var(--vb-ease);
}

#vb-chat-root .vb-chat__close:hover {
	background: rgba(255, 255, 255, .15);
	transform: rotate(90deg);
}

#vb-chat-root .vb-chat__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

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

#vb-chat-root .vb-chat__log {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 14px 8px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
	background: var(--vb-surface);
}

#vb-chat-root .vb-chat__log::-webkit-scrollbar { width: 8px; }
#vb-chat-root .vb-chat__log::-webkit-scrollbar-thumb {
	background: #cfd8e6;
	border-radius: 100px;
	border: 2px solid var(--vb-surface);
}

#vb-chat-root .vb-chat__msg {
	max-width: 88%;
	padding: 10px 14px;
	font-size: 14.5px;
	color: var(--vb-ink);
	overflow-wrap: break-word;
	animation: vb-msg-in 320ms var(--vb-ease) both;
}

@keyframes vb-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* A light bubble on a light surface is defined by its edge. Pushing the fill
   darker until it separated on its own would make every message a grey box. */
#vb-chat-root .vb-chat__msg--bot {
	align-self: flex-start;
	background: var(--vb-bubble);
	border: 1px solid var(--vb-hairline);
	border-radius: 16px 16px 16px 5px;
}

#vb-chat-root .vb-chat__msg--user {
	align-self: flex-end;
	background: var(--vb-deep);
	color: #fff;
	border-radius: 16px 16px 5px 16px;
}

#vb-chat-root .vb-chat__msg--error {
	align-self: flex-start;
	background: #fdecec;
	border: 1px solid rgba(150, 40, 40, .16);
	color: #8a2020;
	border-radius: 16px 16px 16px 5px;
}

#vb-chat-root .vb-chat__msg p { margin: 0 0 8px; }
#vb-chat-root .vb-chat__msg p:last-child { margin-bottom: 0; }

#vb-chat-root .vb-chat__msg a {
	color: var(--vb-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
	overflow-wrap: break-word;
	transition: opacity var(--vb-fast) var(--vb-ease);
}

#vb-chat-root .vb-chat__msg a:hover { opacity: .72; }
#vb-chat-root .vb-chat__msg--user a { color: #fff; }

#vb-chat-root .vb-chat__msg ul {
	margin: 6px 0;
	padding-inline-start: 18px;
	list-style: disc;
}

#vb-chat-root .vb-chat__msg li { margin: 3px 0; }

/* Word-by-word reveal: the agent cannot stream, so the reply is paced out
   client-side. An 8s wait then reads as someone typing, not a frozen panel. */
#vb-chat-root .vb-chat__w {
	opacity: 0;
	animation: vb-word 260ms var(--vb-ease) forwards;
}

@keyframes vb-word {
	to { opacity: 1; }
}

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

#vb-chat-root .vb-chat__typing {
	align-self: flex-start;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 13px 15px;
	background: var(--vb-bubble);
	border: 1px solid var(--vb-hairline);
	border-radius: 16px 16px 16px 5px;
	animation: vb-msg-in 300ms var(--vb-ease) both;
}

#vb-chat-root .vb-chat__typing span {
	width: 7px;
	height: 7px;
	border-radius: 100px;
	background: var(--vb-muted);
	animation: vb-blink 1.3s var(--vb-ease) infinite;
}

#vb-chat-root .vb-chat__typing span:nth-child(2) { animation-delay: .18s; }
#vb-chat-root .vb-chat__typing span:nth-child(3) { animation-delay: .36s; }

@keyframes vb-blink {
	0%, 60%, 100% { opacity: .28; transform: translateY(0); }
	30% { opacity: .9; transform: translateY(-3px); }
}

/* ---------- quick replies ---------- */

#vb-chat-root .vb-chat__chips {
	display: flex;
	flex-wrap: wrap;
	align-self: flex-start;
	gap: 7px;
	max-width: 100%;
	margin-top: -2px;
}

#vb-chat-root .vb-chat__chips:empty { display: none; }

#vb-chat-root .vb-chat__chip {
	padding: 7px 14px;
	border: 1px solid var(--vb-hairline);
	border-radius: 100px;
	background: var(--vb-tint);
	color: var(--vb-accent);
	font-size: 13px;
	font-weight: 500;
	line-height: 1.6;
	white-space: nowrap;
	animation: vb-msg-in 300ms var(--vb-ease) both;
	transition:
		background var(--vb-fast) var(--vb-ease),
		border-color var(--vb-fast) var(--vb-ease),
		color var(--vb-fast) var(--vb-ease),
		transform var(--vb-base) var(--vb-spring);
}

#vb-chat-root .vb-chat__chip:hover {
	background: var(--vb-accent);
	border-color: var(--vb-accent);
	color: #fff;
	transform: translateY(-1px);
}

#vb-chat-root .vb-chat__chip:active {
	transform: translateY(0) scale(.98);
	transition-duration: var(--vb-fast);
}

#vb-chat-root .vb-chat__chip:focus-visible {
	outline: 2px solid var(--vb-accent);
	outline-offset: 2px;
}

/* ---------- jump to latest ---------- */

#vb-chat-root .vb-chat__jump {
	position: absolute;
	right: 15px;
	bottom: 96px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid var(--vb-line);
	border-radius: 100px;
	background: var(--vb-surface);
	box-shadow: 0 4px 14px rgba(15, 31, 71, .14);
	opacity: 0;
	transform: translateY(6px);
	pointer-events: none;
	transition:
		opacity var(--vb-base) var(--vb-ease),
		transform var(--vb-base) var(--vb-ease);
}

#vb-chat-root .vb-chat__jump[data-show="true"] {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

#vb-chat-root .vb-chat__jump:hover { background: var(--vb-bubble); }

#vb-chat-root .vb-chat__jump svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: var(--vb-deep);
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---------- composer ---------- */

#vb-chat-root .vb-chat__form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	margin: 0;
	border-top: 1px solid var(--vb-line);
	background: var(--vb-surface);
}

#vb-chat-root .vb-chat__input {
	flex: 1 1 auto;
	max-height: 112px;
	min-height: 42px;
	padding: 9px 16px;
	border: 1px solid var(--vb-line);
	border-radius: 100px;
	background: #fff;
	color: var(--vb-ink);
	font: inherit;
	font-size: 14.5px;
	line-height: 1.6;
	resize: none;
	overflow-y: auto;
	box-shadow: none;
	transition:
		border-color var(--vb-fast) var(--vb-ease),
		box-shadow var(--vb-fast) var(--vb-ease);
}

#vb-chat-root .vb-chat__input::placeholder { color: #97a0ae; }

#vb-chat-root .vb-chat__input:focus {
	outline: none;
	border-color: var(--vb-accent);
	box-shadow: 0 0 0 3px var(--vb-tint);
}

#vb-chat-root .vb-chat__send {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	padding: 0;
	border-radius: 100px;
	background: var(--vb-accent);
	transition:
		transform var(--vb-base) var(--vb-spring),
		background var(--vb-fast) var(--vb-ease),
		opacity var(--vb-fast) var(--vb-ease);
}

#vb-chat-root .vb-chat__send:hover:not(:disabled) {
	transform: scale(1.07);
	background: var(--vb-deep);
}

#vb-chat-root .vb-chat__send:active:not(:disabled) {
	transform: scale(.93);
	transition-duration: var(--vb-fast);
}

#vb-chat-root .vb-chat__send:focus-visible { outline: 3px solid var(--vb-accent); outline-offset: 2px; }

#vb-chat-root .vb-chat__send:disabled {
	opacity: .38;
	cursor: not-allowed;
}

#vb-chat-root .vb-chat__send svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: #fff;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

#vb-chat-root .vb-chat__disclaimer {
	margin: 0;
	padding: 0 14px 11px;
	background: var(--vb-surface);
	color: var(--vb-muted);
	font-size: 10.5px;
	line-height: 1.5;
	text-align: center;
}

/* ---------- mobile ---------- */

@media (max-width: 480px) {
	#vb-chat-root { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
	#vb-chat-root.vb-chat--bottom-right { right: calc(14px + env(safe-area-inset-right, 0px)); }
	#vb-chat-root.vb-chat--bottom-left { left: calc(14px + env(safe-area-inset-left, 0px)); }

	#vb-chat-root .vb-chat__launcher { width: 56px; height: 56px; }

	#vb-chat-root .vb-chat__panel {
		position: fixed;
		inset: auto 10px calc(74px + env(safe-area-inset-bottom, 0px)) 10px;
		width: auto;
		height: min(74vh, calc(100vh - 150px));
		border-radius: 20px;
	}

	#vb-chat-root .vb-chat__msg { max-width: 92%; }
	#vb-chat-root .vb-chat__chip { font-size: 12.5px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	#vb-chat-root *,
	#vb-chat-root *::before,
	#vb-chat-root *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}

	#vb-chat-root .vb-chat__log { scroll-behavior: auto; }
	#vb-chat-root .vb-chat__w { opacity: 1; }
}


/* ============================================================
   v12 redesign skin (2026-08) — token overrides only. The layout, guards
   (#vb-chat-root scoping, [hidden] re-statements, button reset) and motion
   above stay untouched; this block re-points the palette at the
   visabreeze-design system: violet #5A4FC4 · teal #35BDA4 · ink #16143A.
   Also defines --vb-accent, which the rules above use but never defined.
   ============================================================ */
#vb-chat-root {
	--vb-deep: #1E1B4B;
	--vb-deep-2: #16143A;
	--vb-deep-3: #312E81;
	--vb-accent: #5A4FC4;
	--vb-live: #35BDA4;
	--vb-surface: #FAFAFE;
	--vb-bubble: #EEEDFB;
	--vb-ink: #16143A;
	--vb-muted: #5D5A85;
	--vb-line: #E5E4F4;
	--vb-hairline: rgba(30, 27, 75, .12);
	--vb-tint: rgba(90, 79, 196, .1);
	--vb-shadow:
		0 2px 6px rgba(22, 20, 58, .06),
		0 24px 56px -16px rgba(22, 20, 58, .3);
	--vb-shadow-lift:
		0 4px 10px rgba(22, 20, 58, .08),
		0 30px 64px -16px rgba(22, 20, 58, .38);
}

/* launcher matches the demo: solid violet, darker on hover */
#vb-chat-root .vb-chat__launcher { background: var(--vb-accent) !important; }
#vb-chat-root .vb-chat__launcher:hover { background: #443AB8 !important; }
