/* Site assistant widget. Uses the theme's colour variables when present, with the brand values as fallbacks. */
.cfdg-chat {
	--cc-night: var(--cfdg-night, #062115);
	--cc-green: var(--cfdg-green, #355e3b);
	--cc-gold: var(--cfdg-gold, #c9a227);
	--cc-ink: #1a1d1a;
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 70;
	font-family: var(--wp--preset--font-family--sans, system-ui, sans-serif);
	font-size: 0.95rem;
	line-height: 1.5;
}

.cfdg-chat__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.85rem 1.15rem;
	border: 0;
	border-radius: 999px;
	background: var(--cc-night);
	color: #fff;
	font: inherit;
	font-weight: 600;
	letter-spacing: 0.04em;
	cursor: pointer;
	box-shadow: 0 8px 28px rgba(6, 33, 21, 0.35);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cfdg-chat__toggle svg {
	color: var(--cc-gold);
}
.cfdg-chat__toggle:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 32px rgba(6, 33, 21, 0.45);
}
.cfdg-chat__toggle:focus-visible,
.cfdg-chat button:focus-visible,
.cfdg-chat input:focus-visible {
	outline: 3px solid var(--cc-gold);
	outline-offset: 2px;
}
.cfdg-chat.is-open .cfdg-chat__toggle {
	display: none;
}

.cfdg-chat__panel {
	display: flex;
	flex-direction: column;
	width: 380px;
	max-width: calc(100vw - 2.5rem);
	height: 560px;
	max-height: calc(100dvh - 2.5rem);
	overflow: hidden;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 18px 60px rgba(6, 33, 21, 0.4);
}
.cfdg-chat__panel[hidden] {
	display: none;
}

.cfdg-chat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.95rem 1.1rem;
	background: var(--cc-night);
	color: #fff;
	border-bottom: 3px solid var(--cc-gold);
}
.cfdg-chat__name {
	display: block;
	font-size: 1rem;
}
.cfdg-chat__sub {
	display: block;
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	color: rgba(255, 255, 255, 0.7);
}
.cfdg-chat__close {
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}
.cfdg-chat__close:hover {
	background: rgba(255, 255, 255, 0.12);
}

.cfdg-chat__log {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: 1rem;
	overflow-y: auto;
	background: #f7f8f6;
}
.cfdg-chat__msg {
	max-width: 88%;
	padding: 0.65rem 0.9rem;
	border-radius: 14px;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
}
.cfdg-chat__msg--bot {
	align-self: flex-start;
	border-bottom-left-radius: 4px;
	background: #fff;
	color: var(--cc-ink);
	border: 1px solid rgba(26, 29, 26, 0.1);
}
.cfdg-chat__msg--user {
	align-self: flex-end;
	border-bottom-right-radius: 4px;
	background: var(--cc-green);
	color: #fff;
}
.cfdg-chat__msg a {
	color: inherit;
	font-weight: 600;
	text-decoration: underline;
}

.cfdg-chat__typing {
	display: inline-flex;
	gap: 0.25rem;
	align-items: center;
}
.cfdg-chat__typing span {
	width: 0.45rem;
	height: 0.45rem;
	border-radius: 50%;
	background: var(--cc-green);
	opacity: 0.4;
}
@media (prefers-reduced-motion: no-preference) {
	.cfdg-chat__typing span {
		animation: cfdg-chat-dot 1.2s ease-in-out infinite;
	}
	.cfdg-chat__typing span:nth-child(2) {
		animation-delay: 0.15s;
	}
	.cfdg-chat__typing span:nth-child(3) {
		animation-delay: 0.3s;
	}
	@keyframes cfdg-chat-dot {
		0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
		40% { opacity: 1; transform: translateY(-3px); }
	}
	.cfdg-chat__panel:not([hidden]) {
		animation: cfdg-chat-in 0.25s ease-out;
	}
	@keyframes cfdg-chat-in {
		from { opacity: 0; transform: translateY(12px); }
		to { opacity: 1; transform: none; }
	}
}

.cfdg-chat__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0 1rem;
	background: #f7f8f6;
}
.cfdg-chat__chips:empty {
	display: none;
}
.cfdg-chat__chip {
	padding: 0.4rem 0.75rem;
	border: 1px solid var(--cc-green);
	border-radius: 999px;
	background: #fff;
	color: var(--cc-green);
	font: inherit;
	font-size: 0.82rem;
	cursor: pointer;
}
.cfdg-chat__chip:hover {
	background: var(--cc-green);
	color: #fff;
}

.cfdg-chat__form {
	display: flex;
	gap: 0.5rem;
	padding: 0.75rem 1rem 0.5rem;
	background: #f7f8f6;
}
.cfdg-chat__input {
	flex: 1;
	min-width: 0;
	padding: 0.7rem 0.85rem;
	border: 1px solid rgba(26, 29, 26, 0.28);
	border-radius: 8px;
	background: #fff;
	color: var(--cc-ink);
	font: inherit;
	font-size: 1rem; /* 16px stops iOS zooming on focus */
}
.cfdg-chat__send {
	display: grid;
	place-items: center;
	width: 2.9rem;
	border: 0;
	border-radius: 8px;
	background: var(--cc-gold);
	color: var(--cc-night);
	cursor: pointer;
}
.cfdg-chat__send:disabled,
.cfdg-chat__input:disabled {
	opacity: 0.55;
	cursor: wait;
}
.cfdg-chat__notice {
	margin: 0;
	padding: 0 1rem 0.75rem;
	background: #f7f8f6;
	font-size: 0.68rem;
	line-height: 1.4;
	color: #5b635c;
}

/* Phones: a bottom sheet, clear of the sticky Call / Get a Quote bar */
@media (max-width: 781px) {
	.cfdg-chat {
		right: 0.9rem;
		bottom: 4.6rem;
	}
	.cfdg-chat.is-open {
		inset: auto 0 0 0;
	}
	.cfdg-chat__panel {
		width: 100%;
		max-width: none;
		height: min(82dvh, 640px);
		border-radius: 16px 16px 0 0;
	}
	.cfdg-chat__toggle-label {
		display: none;
	}
	.cfdg-chat__toggle {
		padding: 0.95rem;
	}
}
