/* FDTC Chatbot widget. Colors follow the fdtc theme; --fdtc-chat-color is set from Settings. */
.fdtc-chat {
	--fdtc-chat-color: #283090;
	--fdtc-chat-ink: #1b1d3a;
	--fdtc-chat-muted: #4a4e6b;
	--fdtc-chat-line: #d9dcea;
	--fdtc-chat-panel: #eef0f8;
	--fdtc-chat-bg: #fff;
	--fdtc-chat-surface: #fffdfa;
	--fdtc-chat-error-bg: #fdecec;
	--fdtc-chat-link: var(--fdtc-chat-color); /* text/border use; the dark scheme swaps in a light tint */
	font-family: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--fdtc-chat-ink);
}

.fdtc-chat *,
.fdtc-chat *::before,
.fdtc-chat *::after {
	box-sizing: border-box;
}

.fdtc-chat-bubble {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 100001; /* Above the cookie notice, so the chat can be opened before it's answered. */
	width: 64px;
	height: 64px;
	padding: 0;
	border: 3px solid #fff;
	border-radius: 50%;
	background: var(--fdtc-chat-color);
	box-shadow: 0 6px 20px rgba(27, 29, 58, 0.3);
	cursor: pointer;
	overflow: hidden;
	transition: transform 0.15s ease;
}

.fdtc-chat-bubble:hover {
	transform: scale(1.06);
}

.fdtc-chat-bubble:focus-visible,
.fdtc-chat button:focus-visible,
.fdtc-chat a:focus-visible,
.fdtc-chat input:focus-visible,
.fdtc-chat textarea:focus-visible {
	outline: 3px solid #e81820;
	outline-offset: 2px;
}

.fdtc-chat-bubble .fdtc-chat-avatar {
	width: 100%;
	height: 100%;
}

.fdtc-chat-avatar {
	display: block;
	width: 40px;
	height: 40px;
	flex: none;
	border-radius: 50%;
	object-fit: cover;
	background: #fff;
}

.fdtc-chat-avatar-blank {
	display: grid;
	place-items: center;
	font-size: 22px;
	background: transparent;
}

.fdtc-chat-panel {
	position: fixed;
	right: 20px;
	bottom: 96px;
	z-index: 100001; /* Above the cookie notice and the admin bar. */
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 40px);
	height: 600px;
	max-height: calc(100vh - 120px);
	border-radius: 16px;
	background: var(--fdtc-chat-bg);
	box-shadow: 0 12px 40px rgba(27, 29, 58, 0.28);
	overflow: hidden;
}

.fdtc-chat-panel[hidden] {
	display: none;
}

.fdtc-chat-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 8px 10px 14px;
	background: var(--fdtc-chat-color);
	color: #fff;
}

.fdtc-chat-title {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	line-height: 1.2;
}

.fdtc-chat-title strong {
	font-size: 16px;
}

.fdtc-chat-title span {
	font-size: 12px;
	opacity: 0.85;
}

.fdtc-chat-icon {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
}

.fdtc-chat-icon:hover {
	background: rgba(255, 255, 255, 0.18);
}

.fdtc-chat-log {
	flex: 1;
	padding: 14px;
	overflow-y: auto;
	background: var(--fdtc-chat-surface);
}

.fdtc-chat-msg {
	max-width: 88%;
	margin: 0 0 10px;
}

.fdtc-chat-text {
	padding: 9px 12px;
	border-radius: 14px;
	overflow-wrap: anywhere;
}

.fdtc-chat-text p,
.fdtc-chat-text ul,
.fdtc-chat-text ol {
	margin: 0 0 0.5em;
}

.fdtc-chat-text > :last-child {
	margin-bottom: 0;
}

.fdtc-chat-text ul,
.fdtc-chat-text ol {
	padding-left: 1.3em;
}

.fdtc-chat-text a {
	color: var(--fdtc-chat-link);
	font-weight: 600;
	text-decoration: underline;
}

.fdtc-chat-bot .fdtc-chat-text {
	border-bottom-left-radius: 4px;
	background: var(--fdtc-chat-panel);
}

.fdtc-chat-bot.is-error .fdtc-chat-text {
	background: var(--fdtc-chat-error-bg);
}

.fdtc-chat-user {
	margin-left: auto;
}

.fdtc-chat-user .fdtc-chat-text {
	border-bottom-right-radius: 4px;
	background: var(--fdtc-chat-color);
	color: #fff;
	white-space: pre-wrap;
}

.fdtc-chat-rate {
	display: flex;
	gap: 2px;
	margin-top: 2px;
}

.fdtc-chat-rate button {
	display: grid;
	place-items: center;
	width: 28px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: #8a8ea8;
	cursor: pointer;
}

.fdtc-chat-rate .fdtc-chat-down svg {
	transform: scaleY(-1);
}

.fdtc-chat-rate button:hover {
	color: var(--fdtc-chat-ink);
}

.fdtc-chat-rate button[aria-pressed="true"] {
	background: var(--fdtc-chat-panel);
	color: var(--fdtc-chat-link);
}

.fdtc-chat-typing {
	display: flex;
	gap: 5px;
	width: 62px;
	padding: 13px 14px;
	border-radius: 14px;
	background: var(--fdtc-chat-panel);
}

.fdtc-chat-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--fdtc-chat-muted);
	animation: fdtc-chat-dot 1.2s infinite ease-in-out;
}

.fdtc-chat-typing span:nth-child(2) {
	animation-delay: 0.2s;
}

.fdtc-chat-typing span:nth-child(3) {
	animation-delay: 0.4s;
}

@keyframes fdtc-chat-dot {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
	.fdtc-chat-typing span { animation: none; }
	.fdtc-chat-bubble { transition: none; }
}

.fdtc-chat-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px 14px 0;
	background: var(--fdtc-chat-surface);
}

.fdtc-chat-presets[hidden] {
	display: none;
}

.fdtc-chat-chip {
	padding: 6px 12px;
	border: 1.5px solid var(--fdtc-chat-link);
	border-radius: 999px;
	background: var(--fdtc-chat-bg);
	color: var(--fdtc-chat-link);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.fdtc-chat-chip:hover {
	background: var(--fdtc-chat-color);
	color: #fff;
}

.fdtc-chat-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--fdtc-chat-line);
	background: var(--fdtc-chat-bg);
}

.fdtc-chat-input {
	flex: 1;
	min-height: 40px;
	max-height: 120px;
	padding: 9px 12px;
	border: 1.5px solid var(--fdtc-chat-line);
	border-radius: 12px;
	font: inherit;
	resize: none;
	color: inherit;
	background: var(--fdtc-chat-bg);
}

.fdtc-chat-send {
	width: 40px;
	height: 40px;
	flex: none;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--fdtc-chat-color);
	color: #fff;
	font-size: 16px;
	cursor: pointer;
}

.fdtc-chat-send:disabled {
	opacity: 0.5;
	cursor: default;
}

.fdtc-chat-note {
	margin: 0;
	padding: 0 12px 8px;
	background: var(--fdtc-chat-bg);
	color: var(--fdtc-chat-muted);
	font-size: 11px;
	line-height: 1.3;
}

.fdtc-chat-contact {
	max-width: 100%;
	padding: 12px;
	border: 1.5px solid var(--fdtc-chat-line);
	border-radius: 14px;
	background: var(--fdtc-chat-bg);
}

.fdtc-chat-contact p {
	margin: 0 0 8px;
}

.fdtc-chat-contact.is-sent {
	padding: 0;
	border: 0;
}

.fdtc-chat-contact-title {
	font-weight: 700;
}

.fdtc-chat-contact label {
	display: block;
	font-size: 13px;
	font-weight: 600;
}

.fdtc-chat-contact input,
.fdtc-chat-contact textarea {
	width: 100%;
	padding: 7px 9px;
	border: 1.5px solid var(--fdtc-chat-line);
	border-radius: 8px;
	font: inherit;
	color: inherit;
	background: var(--fdtc-chat-bg);
}

.fdtc-chat-hp {
	position: absolute !important;
	left: -9999px;
}

.fdtc-chat-status {
	color: var(--fdtc-chat-muted);
	font-size: 13px;
}

.fdtc-chat-status:empty {
	display: none;
}

.fdtc-chat-contact-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

.fdtc-chat-primary {
	padding: 8px 14px;
	border: 0;
	border-radius: 8px;
	background: var(--fdtc-chat-color);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.fdtc-chat-primary:disabled {
	opacity: 0.6;
}

.fdtc-chat-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--fdtc-chat-muted);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

@media (max-width: 640px) {
	/* Fills the visible screen (assets/chat.js keeps it above the keyboard); the page behind stays put. */
	.fdtc-chat-panel {
		inset: 0 0 auto;
		width: 100%;
		max-width: none;
		height: 100%;
		height: var(--fdtc-chat-vh, 100dvh);
		max-height: none;
		border-radius: 0;
	}

	html.fdtc-chat-lock,
	html.fdtc-chat-lock body {
		overflow: hidden;
	}

	.fdtc-chat-bubble.is-open {
		display: none;
	}

	.fdtc-chat-input {
		font-size: 16px; /* Stops iOS zooming in on focus. */
	}
}

/* One-tap questions under a page greeting. */
.fdtc-chat-topic {
	padding: 8px 0 0;
	background: transparent;
}

/* Halo & Kona barking: each dog's half of the bubble picture bobs in turn. */
.fdtc-chat-dog {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	pointer-events: none;
}

.fdtc-chat-dog-l {
	--fdtc-tilt: -6deg;
	clip-path: inset(0 50% 0 0);
	transform-origin: 28% 85%;
}

.fdtc-chat-dog-r {
	--fdtc-tilt: 6deg;
	clip-path: inset(0 0 0 50%);
	transform-origin: 72% 85%;
}

.fdtc-chat-bubble.is-barking .fdtc-chat-dog-l {
	animation: fdtc-chat-bark 0.28s ease-in-out 0s 2;
}

.fdtc-chat-bubble.is-barking .fdtc-chat-dog-r {
	animation: fdtc-chat-bark 0.28s ease-in-out 0.7s 2;
}

.fdtc-chat-bubble.is-barking {
	animation: fdtc-chat-hop 0.7s ease-in-out 2;
}

@keyframes fdtc-chat-bark {
	0%, 100% { transform: none; }
	45% { transform: translateY(-3px) rotate(var(--fdtc-tilt)) scale(1.06); }
}

@keyframes fdtc-chat-hop {
	0%, 100% { transform: none; }
	30% { transform: translateY(-4px); }
	60% { transform: translateY(0) scale(1.02, 0.98); }
}

.fdtc-chat-woof {
	position: fixed;
	bottom: 86px;
	z-index: 100002;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--fdtc-chat-bg);
	color: var(--fdtc-chat-link);
	box-shadow: 0 3px 10px rgba(27, 29, 58, 0.25);
	font-size: 14px;
	font-weight: 800;
	pointer-events: none;
	opacity: 0;
	animation: fdtc-chat-woof 1.1s ease-out both;
}

.fdtc-chat-woof-l {
	right: 54px;
	rotate: -12deg;
}

.fdtc-chat-woof-r {
	right: 6px;
	rotate: 10deg;
	animation-delay: 0.7s;
}

@keyframes fdtc-chat-woof {
	0% { opacity: 0; transform: translateY(8px) scale(0.4); }
	20% { opacity: 1; transform: translateY(0) scale(1.12); }
	35% { transform: scale(1); }
	75% { opacity: 1; transform: translateY(-8px); }
	100% { opacity: 0; transform: translateY(-14px); }
}

/* The "Can we help?" card that follows the barks. */
.fdtc-chat-nudge {
	position: fixed;
	right: 20px;
	bottom: 96px;
	z-index: 100001;
	width: 280px;
	max-width: calc(100vw - 40px);
	padding: 14px 14px 12px;
	border-radius: 16px 16px 4px 16px;
	background: var(--fdtc-chat-bg);
	color: var(--fdtc-chat-ink);
	box-shadow: 0 10px 30px rgba(27, 29, 58, 0.28);
	opacity: 0;
	transform: translateY(10px) scale(0.96);
	transform-origin: bottom right;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.fdtc-chat-nudge.is-in {
	opacity: 1;
	transform: none;
}

.fdtc-chat-nudge-text {
	display: block;
	width: 100%;
	padding: 0 26px 0 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	text-align: left;
	cursor: pointer;
}

.fdtc-chat-nudge-close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--fdtc-chat-muted);
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
}

.fdtc-chat-nudge-close:hover {
	background: var(--fdtc-chat-panel);
}

.fdtc-chat-nudge-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
}

.fdtc-chat-nudge .fdtc-chat-chip {
	padding: 5px 10px;
	font-size: 13px;
	text-align: left;
}

@media (prefers-reduced-motion: reduce) {
	.fdtc-chat-nudge { transition: none; transform: none; }
}

@media (prefers-color-scheme: dark) {
	.fdtc-chat-nudge,
	.fdtc-chat-woof { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
}

/* Dark mode: follows the device setting, matching the fdtc theme's dark palette. */
@media (prefers-color-scheme: dark) {
	.fdtc-chat {
		--fdtc-chat-ink: #EEF0FA;
		--fdtc-chat-muted: #B3B7D3;
		--fdtc-chat-line: #353A66;
		--fdtc-chat-panel: #1E2145;
		--fdtc-chat-bg: #14162E;
		--fdtc-chat-surface: #1A1C3A;
		--fdtc-chat-error-bg: #3A1B28;
		--fdtc-chat-link: #9FA9FF;
	}
	.fdtc-chat-panel { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
}

/*
 * WP Admin on computers: the bubble sits under the left-hand menu (assets/chat.js moves it
 * there), the chat opens beside the menu, and the barks and help card come from the bubble.
 * The menu is 160px wide, or 36px when folded.
 */
.fdtc-chat-menuslot {
	position: relative;
	padding: 14px 0 18px;
}

.fdtc-chat--menu .fdtc-chat-bubble {
	position: relative;
	right: auto;
	bottom: auto;
	display: block;
	margin: 0 auto;
}

.fdtc-chat--menu .fdtc-chat-panel {
	left: 176px;
	right: auto;
	bottom: 20px;
}

.fdtc-chat--menu .fdtc-chat-nudge {
	position: absolute;
	top: 8px;
	left: calc(100% + 12px);
	right: auto;
	bottom: auto;
	border-radius: 4px 16px 16px 16px;
	transform-origin: top left;
}

.fdtc-chat--menu .fdtc-chat-woof {
	position: absolute;
	top: -2px;
	bottom: auto;
	right: auto;
}

.fdtc-chat--menu .fdtc-chat-woof-l { left: 18px; }
.fdtc-chat--menu .fdtc-chat-woof-r { left: 92px; }

/* Folded menu: a smaller bubble, the chat opens closer. */
body.folded .fdtc-chat--menu .fdtc-chat-bubble {
	width: 32px;
	height: 32px;
	border-width: 2px;
}

body.folded .fdtc-chat--menu .fdtc-chat-panel { left: 52px; }
body.folded .fdtc-chat--menu .fdtc-chat-woof-l { left: 40px; }
body.folded .fdtc-chat--menu .fdtc-chat-woof-r { left: 90px; }

@media (max-width: 960px) {
	body.auto-fold .fdtc-chat--menu .fdtc-chat-bubble {
		width: 32px;
		height: 32px;
		border-width: 2px;
	}

	body.auto-fold .fdtc-chat--menu .fdtc-chat-panel { left: 52px; }
	body.auto-fold .fdtc-chat--menu .fdtc-chat-woof-l { left: 40px; }
	body.auto-fold .fdtc-chat--menu .fdtc-chat-woof-r { left: 90px; }
}

/*
 * Public site: the bubble sits under the header menu on the right (assets/chat.js sets
 * --fdtc-chat-top to just below the header, or near the top once it has scrolled away), and
 * the chat, barks and help card open below it.
 */
.fdtc-chat--header .fdtc-chat-bubble {
	top: var(--fdtc-chat-top, 12px);
	bottom: auto;
}

.fdtc-chat--header .fdtc-chat-woof {
	top: calc(var(--fdtc-chat-top, 12px) + 60px);
	bottom: auto;
}

.fdtc-chat--header .fdtc-chat-nudge {
	top: calc(var(--fdtc-chat-top, 12px) + 78px);
	bottom: auto;
	border-radius: 16px 4px 16px 16px;
	transform-origin: top right;
}

/* The phone menu's full-screen overlay covers the bubble rather than the other way round. */
html.has-modal-open .fdtc-chat--header .fdtc-chat-bubble,
html.has-modal-open .fdtc-chat--header .fdtc-chat-nudge {
	display: none;
}

@media (min-width: 641px) {
	.fdtc-chat--header .fdtc-chat-panel {
		top: calc(var(--fdtc-chat-top, 12px) + 76px);
		bottom: auto;
		max-height: calc(100vh - var(--fdtc-chat-top, 12px) - 96px);
	}
}

@media (max-width: 640px) {
	.fdtc-chat--header .fdtc-chat-bubble {
		right: 12px;
		width: 52px;
		height: 52px;
	}

	.fdtc-chat--header .fdtc-chat-woof { top: calc(var(--fdtc-chat-top, 12px) + 50px); }
	.fdtc-chat--header .fdtc-chat-woof-l { right: 40px; }
	.fdtc-chat--header .fdtc-chat-woof-r { right: 0; }
	.fdtc-chat--header .fdtc-chat-nudge { top: calc(var(--fdtc-chat-top, 12px) + 64px); right: 12px; }
}
