/* "Ask VDG" chat (mu-plugins/vdg-chat.php). Site colours: blue #005196, orange #ef6d24.
   The button sits bottom right; the text-size button is bottom left. */
#vdg-chat {
	--chat-blue: #005196;
	--chat-blue-dark: #003d73;
	--chat-orange: #ef6d24;
	--chat-ink: #1a1a1a;
	--chat-soft: #f2f6fa;
	--chat-line: #d5dbe1;
	font-family: Poppins, Arial, sans-serif;
	line-height: 1.5;
	color: var(--chat-ink);
}
#vdg-chat [hidden] { display: none !important; }
#vdg-chat button { font-family: inherit; }

/* ---- the button ---- */
.vdg-chat-launch {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 9980;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	height: 50px;
	padding: 0 20px 0 16px;
	border: 2px solid #fff;
	border-radius: 25px;
	background: var(--chat-blue);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0, 49, 92, .32);
	transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.vdg-chat-launch svg { width: 22px; height: 22px; color: #ffd9c4; }
.vdg-chat-launch:hover { background: var(--chat-blue-dark); box-shadow: 0 6px 20px rgba(0, 49, 92, .4); transform: translateY(-1px); }
#vdg-chat.is-open .vdg-chat-launch { background: var(--chat-blue-dark); }
#vdg-chat .vdg-chat-launch:focus-visible,
#vdg-chat .vdg-chat-icon:focus-visible,
#vdg-chat .vdg-chat-send:focus-visible,
#vdg-chat .vdg-chat-chip:focus-visible,
#vdg-chat .vdg-chat-cardlink:focus-visible,
#vdg-chat .vdg-chat-rich a:focus-visible {
	outline: 3px solid var(--chat-orange) !important;
	outline-offset: 2px !important;
}

/* ---- the panel ---- */
.vdg-chat-panel {
	position: fixed;
	right: 16px;
	bottom: 78px;
	z-index: 9981;
	display: flex;
	flex-direction: column;
	width: 400px;
	max-width: calc(100vw - 32px);
	height: min(620px, calc(100vh - 110px));
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 12px 40px rgba(0, 30, 60, .28), 0 0 0 1px rgba(0, 49, 92, .08);
	overflow: hidden;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity .18s ease, transform .18s ease;
}
.vdg-chat-panel.is-open { opacity: 1; transform: none; }

.vdg-chat-head {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 14px 10px 14px 18px;
	border-bottom: 4px solid var(--chat-orange);
	background: var(--chat-blue);
	color: #fff;
}
.vdg-chat-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vdg-chat-titles strong { font-size: 17px; font-weight: 600; line-height: 1.25; }
.vdg-chat-titles span { margin-top: 2px; color: #dbe8f4; font-size: 12.5px; line-height: 1.35; }
.vdg-chat-icon {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: none;
	color: #fff;
	cursor: pointer;
}
.vdg-chat-icon:hover { background: rgba(255, 255, 255, .16); }
.vdg-chat-icon svg { width: 20px; height: 20px; }

.vdg-chat-log {
	flex: 1;
	min-height: 0;
	padding: 16px 16px 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
}
.vdg-chat-msg { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 12px; }
.vdg-chat-msg.is-user { align-items: flex-end; }
.vdg-chat-bubble {
	max-width: 88%;
	padding: 10px 14px;
	border-radius: 14px 14px 14px 4px;
	background: var(--chat-soft);
	color: var(--chat-ink);
	font-size: 14.5px;
	line-height: 1.55;
	overflow-wrap: anywhere;
}
.vdg-chat-msg.is-user .vdg-chat-bubble {
	border-radius: 14px 14px 4px 14px;
	background: var(--chat-blue);
	color: #fff;
	white-space: pre-wrap;
}
.vdg-chat-msg.is-error .vdg-chat-bubble { background: #fdf1ea; color: #7a2e06; }

.vdg-chat-rich > :first-child { margin-top: 0; }
.vdg-chat-rich > :last-child { margin-bottom: 0; }
.vdg-chat-rich p { margin: 0 0 9px; font-size: inherit; line-height: inherit; color: inherit; }
.vdg-chat-rich ul, .vdg-chat-rich ol { margin: 0 0 9px; padding-left: 20px; }
.vdg-chat-rich li { margin: 0 0 4px; padding: 0; font-size: inherit; line-height: inherit; color: inherit; list-style: inherit; }
.vdg-chat-rich ul li { list-style: disc; }
.vdg-chat-rich ol li { list-style: decimal; }
.vdg-chat-rich li::before { content: none; }
.vdg-chat-rich strong { font-weight: 600; }
.vdg-chat-rich code { padding: 1px 5px; border-radius: 4px; background: #e3eaf1; font-size: 13px; }
.vdg-chat-rich a { color: var(--chat-blue); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.vdg-chat-rich a:hover { color: #b84a0c; }
.vdg-chat-table { max-width: 100%; margin: 0 0 9px; overflow-x: auto; }
.vdg-chat-table table { width: auto; min-width: 100%; margin: 0; border-collapse: collapse; background: #fff; font-size: 13px; }
.vdg-chat-table th, .vdg-chat-table td { padding: 6px 9px; border: 1px solid var(--chat-line); text-align: left; vertical-align: top; }
.vdg-chat-table th { background: #e8eff6; font-weight: 600; }

.vdg-chat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.vdg-chat-starters { flex-direction: column; align-items: flex-start; margin: 0 0 12px; }
.vdg-chat-chip {
	min-height: 36px;
	padding: 6px 14px;
	border: 1px solid var(--chat-blue);
	border-radius: 18px;
	background: #fff;
	color: var(--chat-blue);
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.3;
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
}
.vdg-chat-chip:hover { background: var(--chat-blue); color: #fff; }

.vdg-chat-card { max-width: 88%; margin-top: 8px; padding: 10px 14px; border-left: 4px solid var(--chat-orange); background: #fdf6f1; font-size: 13.5px; }
.vdg-chat-card p { margin: 0 0 6px; font-size: inherit; color: inherit; line-height: 1.5; }
.vdg-chat-cardlink { display: inline-block; margin-top: 6px; color: var(--chat-blue); font-size: 13.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* "Looking that up" with three dots that take turns */
.vdg-chat-wait { display: inline-flex; align-items: center; gap: 4px; color: #5b6470; }
.vdg-chat-wait span { margin-right: 4px; }
.vdg-chat-wait i { width: 5px; height: 5px; border-radius: 50%; background: #5b6470; animation: vdg-chat-dot 1.2s infinite ease-in-out; }
.vdg-chat-wait i:nth-of-type(2) { animation-delay: .15s; }
.vdg-chat-wait i:nth-of-type(3) { animation-delay: .3s; }
@keyframes vdg-chat-dot { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---- writing a message ---- */
.vdg-chat-hint { margin: 0; padding: 0 16px; color: #b3261e; font-size: 12.5px; font-weight: 500; }
.vdg-chat-hint:empty { display: none; }
.vdg-chat-form { display: flex; align-items: flex-end; gap: 8px; margin: 0; padding: 10px 12px 6px 16px; border-top: 1px solid var(--chat-line); background: #fff; }
.vdg-chat-form textarea {
	flex: 1;
	min-width: 0;
	min-height: 42px;
	max-height: 120px;
	margin: 0;
	padding: 9px 12px;
	border: 1px solid #c9ced3;
	border-radius: 8px;
	background: #fff;
	color: var(--chat-ink);
	font: inherit;
	font-size: 15px;
	line-height: 1.45;
	resize: none;
	box-shadow: none;
}
.vdg-chat-form textarea:focus { border-color: var(--chat-blue); outline: 2px solid var(--chat-blue); outline-offset: 0; }
.vdg-chat-form textarea:disabled { background: #f3f4f6; }
.vdg-chat-send {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px !important;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: var(--chat-blue);
	color: #fff;
	cursor: pointer;
}
.vdg-chat-send:hover:not(:disabled) { background: var(--chat-blue-dark); }
.vdg-chat-send:disabled { background: #e1e5e9; color: #5b6470; cursor: not-allowed; }
.vdg-chat-send svg { width: 20px; height: 20px; }
.vdg-chat-note { margin: 0; padding: 2px 16px 10px; color: #5b6470; font-size: 11.5px; line-height: 1.4; }

/* ---- phones: a full-height sheet ---- */
@media (max-width: 600px) {
	.vdg-chat-launch { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); height: 46px; padding: 0 16px 0 13px; font-size: 14px; }
	.vdg-chat-panel {
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 9996;                 /* above the text-size button */
		width: auto;
		max-width: none;
		height: auto;
		border-radius: 0;
	}
	#vdg-chat.is-open .vdg-chat-launch { display: none; }
	.vdg-chat-form { padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
	.vdg-chat-form textarea { font-size: 16px; }   /* below 16px iOS zooms the page on focus */
}
@media (prefers-reduced-motion: reduce) {
	.vdg-chat-panel, .vdg-chat-launch { transition: none; }
	.vdg-chat-wait i { animation: none; opacity: .6; }
}
@media print {
	#vdg-chat { display: none !important; }
}
