/* DoctorX AI Assistant - website chat. Colours can be changed by a theme through these variables. */
.dxa-chat {
	--dxa-accent: #1d2327;
	--dxa-accent-text: #ffffff;
	--dxa-bg: #ffffff;
	--dxa-soft: #f6f7f7;
	--dxa-border: #dcdcde;
	--dxa-text: #1d2327;
	--dxa-muted: #646970;
	--dxa-link: #135e96;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--dxa-text);
}
.dxa-chat *,
.dxa-chat *::before,
.dxa-chat *::after { box-sizing: border-box; }

.dxa-chat--floating {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
}
@supports (padding: env(safe-area-inset-bottom)) {
	.dxa-chat--floating { right: calc(20px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); }
}

.dxa-fab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 0;
	border-radius: 999px;
	padding: 13px 18px;
	background: var(--dxa-accent);
	color: var(--dxa-accent-text);
	font: 600 15px/1 inherit;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
.dxa-fab:hover { filter: brightness(1.15); }
.dxa-fab:focus-visible,
.dxa-chat button:focus-visible,
.dxa-chat textarea:focus-visible,
.dxa-chat a:focus-visible { outline: 3px solid #2271b1; outline-offset: 2px; }

.dxa-panel {
	display: flex;
	flex-direction: column;
	background: var(--dxa-bg);
	border: 1px solid var(--dxa-border);
	border-radius: 12px;
	overflow: hidden;
}
.dxa-panel[hidden] { display: none; }
.dxa-chat--floating .dxa-panel {
	position: absolute;
	right: 0;
	bottom: 60px;
	width: min(380px, calc(100vw - 32px));
	height: min(540px, 75vh);
	box-shadow: 0 16px 48px rgba(0, 0, 0, .2);
}
.dxa-chat--inline .dxa-panel { height: var(--dxa-height, 480px); max-width: 100%; }

.dxa-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	padding: 12px 14px;
	background: var(--dxa-soft);
	border-bottom: 1px solid var(--dxa-border);
}
.dxa-close {
	border: 0;
	background: transparent;
	color: var(--dxa-muted);
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	padding: 6px 8px;
}
.dxa-log { flex: 1; overflow-y: auto; padding: 12px; background: var(--dxa-soft); }
.dxa-b { display: flex; margin: 0 0 10px; }
.dxa-b > div { max-width: 85%; padding: 9px 12px; border-radius: 12px; word-wrap: break-word; overflow-wrap: anywhere; }
.dxa-b--user { justify-content: flex-end; }
.dxa-b--user > div { background: var(--dxa-accent); color: var(--dxa-accent-text); border-bottom-right-radius: 3px; }
.dxa-b--assistant > div { background: var(--dxa-bg); border: 1px solid var(--dxa-border); border-bottom-left-radius: 3px; }
.dxa-b a { color: var(--dxa-link); text-decoration: underline; }

.dxa-starters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.dxa-starter {
	border: 1px solid var(--dxa-border);
	background: var(--dxa-bg);
	color: var(--dxa-text);
	border-radius: 999px;
	padding: 8px 12px;
	min-height: 36px;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
	text-align: left;
}
.dxa-starter:hover { border-color: var(--dxa-accent); }

.dxa-card { background: var(--dxa-bg); border: 1px solid var(--dxa-border); border-left: 4px solid var(--dxa-accent); border-radius: 8px; padding: 10px 12px; margin: 0 0 10px; }
.dxa-card p { margin: 0 0 8px; }
.dxa-card button { border-radius: 6px; padding: 8px 12px; margin-right: 6px; font: inherit; font-size: 14px; cursor: pointer; min-height: 36px; }
.dxa-yes { background: var(--dxa-accent); color: var(--dxa-accent-text); border: 0; }
.dxa-no { background: transparent; color: var(--dxa-text); border: 1px solid var(--dxa-border); }
.dxa-card.is-done { opacity: .65; }
.dxa-card button:disabled { cursor: default; }

.dxa-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--dxa-border); background: var(--dxa-bg); }
.dxa-form textarea {
	flex: 1;
	min-width: 0;
	resize: none;
	border: 1px solid var(--dxa-border);
	border-radius: 8px;
	padding: 9px 11px;
	font: inherit;
	font-size: 16px;
	color: var(--dxa-text);
	background: var(--dxa-bg);
	max-height: 120px;
}
.dxa-form button {
	border: 0;
	border-radius: 8px;
	padding: 0 16px;
	min-height: 44px;
	background: var(--dxa-accent);
	color: var(--dxa-accent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.dxa-foot { margin: 0; padding: 0 12px 10px; font-size: 12px; color: var(--dxa-muted); background: var(--dxa-bg); }

.dxa-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.dxa-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.dxa-wait > div { display: inline-flex; gap: 4px; align-items: center; }
.dxa-wait span:not(.dxa-sr) { width: 6px; height: 6px; border-radius: 50%; background: var(--dxa-muted); animation: dxa-dot 1s infinite ease-in-out; }
.dxa-wait span:nth-child(2) { animation-delay: .15s; }
.dxa-wait span:nth-child(3) { animation-delay: .3s; }
@keyframes dxa-dot { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

@media (max-width: 600px) {
	.dxa-fab { width: 54px; height: 54px; padding: 0; justify-content: center; border-radius: 50%; }
	.dxa-fab-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
	.dxa-chat--floating .dxa-panel { height: min(75vh, 560px); }
}
@media (prefers-reduced-motion: reduce) {
	.dxa-wait span:not(.dxa-sr) { animation: none; opacity: .7; }
}
@media (prefers-color-scheme: dark) {
	.dxa-chat--floating {
		--dxa-bg: #1d2327;
		--dxa-soft: #101517;
		--dxa-border: #3c434a;
		--dxa-text: #f0f0f1;
		--dxa-muted: #a7aaad;
		--dxa-link: #72aee6;
		--dxa-accent: #f0f0f1;
		--dxa-accent-text: #1d2327;
	}
}
