/* AI Front Desk chat widget. Every rule is scoped to .afd-widget. */
.afd-widget {
	--afd-brand: #0b6bcb;
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: #1d2327;
	text-align: left;
}

.afd-widget *,
.afd-widget *::before,
.afd-widget *::after {
	box-sizing: border-box;
}

/* Buttons are fully specified so theme button styles cannot leak in. */
.afd-widget button.afd-launcher,
.afd-widget button.afd-launcher:hover,
.afd-widget button.afd-launcher:focus {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	margin: 0 0 0 auto;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--afd-brand);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.afd-widget .afd-launcher-icon {
	position: relative;
	display: block;
	width: 26px;
	height: 20px;
	border-radius: 6px;
	background: #fff;
}

.afd-widget .afd-launcher-icon::after {
	content: "";
	position: absolute;
	left: 5px;
	bottom: -6px;
	border-width: 7px 7px 0 0;
	border-style: solid;
	border-color: #fff transparent transparent transparent;
}

.afd-widget button:focus-visible,
.afd-widget textarea:focus-visible {
	outline: 3px solid #1d2327;
	outline-offset: 2px;
}

.afd-widget .afd-panel {
	display: flex;
	flex-direction: column;
	width: 360px;
	max-width: calc(100vw - 40px);
	height: 520px;
	max-height: calc(100vh - 120px);
	margin-bottom: 14px;
	overflow: hidden;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.afd-widget .afd-panel[hidden] {
	display: none;
}

.afd-widget .afd-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	background: var(--afd-brand);
	color: #fff;
}

.afd-widget .afd-title {
	font-size: 16px;
	font-weight: 600;
}

.afd-widget .afd-subtitle {
	font-size: 12px;
	opacity: 0.9;
}

.afd-widget button.afd-close,
.afd-widget button.afd-close:hover,
.afd-widget button.afd-close:focus {
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.afd-widget .afd-demo {
	padding: 6px 16px;
	background: #fcf3cf;
	color: #5c4a00;
	font-size: 12px;
}

.afd-widget .afd-log {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 8px;
	padding: 16px;
	overflow-y: auto;
	background: #f6f7f7;
}

.afd-widget .afd-msg {
	max-width: 85%;
	padding: 9px 12px;
	border-radius: 14px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.afd-widget .afd-msg-assistant {
	align-self: flex-start;
	border-bottom-left-radius: 4px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.afd-widget .afd-msg-user {
	align-self: flex-end;
	border-bottom-right-radius: 4px;
	background: var(--afd-brand);
	color: #fff;
}

.afd-widget .afd-typing {
	color: #646970;
	font-style: italic;
}

.afd-widget .afd-msg-error {
	color: #b32d2e;
}

.afd-widget .afd-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
	padding: 10px;
	border-top: 1px solid #dcdcde;
	background: #fff;
}

.afd-widget textarea.afd-input {
	flex: 1;
	min-height: 40px;
	max-height: 96px;
	margin: 0;
	padding: 9px 10px;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	background: #fff;
	color: #1d2327;
	font: inherit;
	resize: none;
}

.afd-widget button.afd-send,
.afd-widget button.afd-send:hover,
.afd-widget button.afd-send:focus {
	height: 40px;
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: 8px;
	background: var(--afd-brand);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.afd-widget button.afd-send:disabled {
	opacity: 0.55;
	cursor: default;
}

/* Phones: the open chat fills the screen. */
@media (max-width: 480px) {
	.afd-widget.afd-open {
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
	}

	.afd-widget.afd-open .afd-panel {
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		margin: 0;
		border-radius: 0;
	}

	.afd-widget.afd-open .afd-launcher {
		display: none;
	}
}

/* "Leave your details" button */
.afd-widget button.afd-cta,
.afd-widget button.afd-cta:hover,
.afd-widget button.afd-cta:focus {
	display: block;
	width: 100%;
	margin: 0;
	padding: 8px 16px;
	border: 0;
	border-top: 1px solid #dcdcde;
	border-radius: 0;
	background: #fff;
	color: var(--afd-brand);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
}

.afd-widget button.afd-cta[hidden] {
	display: none;
}

/* Lead form */
.afd-widget .afd-lead {
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-self: stretch;
	margin: 0;
	padding: 12px;
	border: 1px solid #dcdcde;
	border-radius: 12px;
	background: #fff;
}

.afd-widget .afd-lead-title {
	font-weight: 600;
}

.afd-widget .afd-field {
	display: block;
	margin: 0;
}

.afd-widget .afd-field-label {
	display: block;
	margin-bottom: 2px;
	color: #50575e;
	font-size: 12px;
}

.afd-widget .afd-lead .afd-control {
	display: block;
	width: 100%;
	min-height: 36px;
	margin: 0;
	padding: 7px 9px;
	border: 1px solid #c3c4c7;
	border-radius: 6px;
	background: #fff;
	color: #1d2327;
	font: inherit;
	box-shadow: none;
}

.afd-widget .afd-lead textarea.afd-control {
	resize: vertical;
}

.afd-widget .afd-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.afd-widget .afd-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 2px 0 0;
	color: #50575e;
	font-size: 12px;
}

.afd-widget .afd-consent-box {
	flex: none;
	width: 16px;
	height: 16px;
	margin: 2px 0 0;
}

.afd-widget .afd-privacy {
	color: var(--afd-brand);
	text-decoration: underline;
}

.afd-widget .afd-lead-error {
	color: #b32d2e;
	font-size: 13px;
}

.afd-widget .afd-lead-error:empty {
	display: none;
}

.afd-widget button.afd-lead-submit,
.afd-widget button.afd-lead-submit:hover,
.afd-widget button.afd-lead-submit:focus {
	width: 100%;
	height: 40px;
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: 8px;
	background: var(--afd-brand);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.afd-widget button.afd-lead-submit:disabled {
	opacity: 0.55;
	cursor: default;
}
