/* Digitise SA Assistant widget. Brand: Navy #191C4A, Gold #D7B428, Teal-blue #21759B. */

#dsa-ai.dsa-ai {
	--dsa-ai-navy: #191C4A;
	--dsa-ai-navy-2: #23275F;
	--dsa-ai-gold: #D7B428;
	--dsa-ai-gold-soft: #FBF3D3;
	--dsa-ai-teal: #21759B;
	--dsa-ai-teal-soft: #E9F2F7;
	--dsa-ai-ink: #141631;
	--dsa-ai-muted: #6E6C7E;
	--dsa-ai-line: #E4E0D4;
	--dsa-ai-bg: #FFFFFF;
	--dsa-ai-bg-2: #F8F7F3;
	/* Distance from the bottom of the screen. Raised on mobile to clear the app's bottom navigation bar. */
	--dsa-ai-bottom: 20px;
	--dsa-ai-right: 20px;
	--dsa-ai-head-font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--dsa-ai-body-font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

	position: fixed;
	right: var(--dsa-ai-right);
	bottom: var(--dsa-ai-bottom);
	/* Closed: above the app bar (1000), below its "More" sheet (1101). Open: on top. */
	z-index: 1050;
	font-family: var(--dsa-ai-body-font);
	font-size: 15px;
	line-height: 1.55;
	color: var(--dsa-ai-ink);
}
#dsa-ai.dsa-ai.is-open {
	z-index: 99990;
}

#dsa-ai.dsa-ai *,
#dsa-ai.dsa-ai *::before,
#dsa-ai.dsa-ai *::after {
	box-sizing: border-box;
}

#dsa-ai.dsa-ai [hidden] {
	display: none !important;
}

/* Launcher */
#dsa-ai .dsa-ai-launch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	height: 54px;
	padding: 0 20px 0 16px;
	border: 0;
	border-radius: 999px;
	background: var(--dsa-ai-navy);
	color: #fff;
	font-family: var(--dsa-ai-head-font);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(25, 28, 74, 0.28);
	transition: transform 0.15s ease, background 0.15s ease;
}
#dsa-ai .dsa-ai-launch svg {
	color: var(--dsa-ai-gold);
	flex: none;
}
#dsa-ai .dsa-ai-launch:hover {
	background: var(--dsa-ai-navy-2);
	transform: translateY(-1px);
}
#dsa-ai .dsa-ai-launch:focus-visible,
#dsa-ai.dsa-ai button:focus-visible,
#dsa-ai.dsa-ai a:focus-visible,
#dsa-ai.dsa-ai input:focus-visible,
#dsa-ai.dsa-ai select:focus-visible,
#dsa-ai.dsa-ai textarea:focus-visible {
	outline: 3px solid var(--dsa-ai-gold);
	outline-offset: 2px;
}
#dsa-ai.dsa-ai.is-open .dsa-ai-launch {
	display: none;
}

/* Panel */
#dsa-ai .dsa-ai-panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 392px;
	height: min(640px, calc(100vh - var(--dsa-ai-bottom) - 24px));
	display: flex;
	flex-direction: column;
	background: var(--dsa-ai-bg);
	border: 1px solid var(--dsa-ai-line);
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 18px 48px rgba(20, 22, 49, 0.22);
}

#dsa-ai .dsa-ai-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 12px 14px 18px;
	background: var(--dsa-ai-navy);
	color: #fff;
	border-bottom: 3px solid var(--dsa-ai-gold);
}
#dsa-ai .dsa-ai-title {
	margin: 0;
	font-family: var(--dsa-ai-head-font);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.25;
	color: #fff;
}
#dsa-ai .dsa-ai-sub {
	margin: 2px 0 0;
	font-size: 12.5px;
	color: rgba(255, 255, 255, 0.75);
}
#dsa-ai .dsa-ai-head-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	flex: none;
}
#dsa-ai .dsa-ai-head-btn {
	border: 0;
	background: transparent;
	color: #fff;
	cursor: pointer;
	border-radius: 8px;
	font-family: var(--dsa-ai-body-font);
}
#dsa-ai .dsa-ai-head-btn:hover {
	background: rgba(255, 255, 255, 0.12);
}
#dsa-ai .dsa-ai-team-btn {
	padding: 6px 10px;
	font-size: 12.5px;
	font-weight: 600;
	border: 1px solid rgba(255, 255, 255, 0.35);
}
#dsa-ai .dsa-ai-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
}

/* Consent */
#dsa-ai .dsa-ai-consent {
	flex: 1;
	overflow-y: auto;
	padding: 22px 20px;
	background: var(--dsa-ai-bg-2);
}
#dsa-ai .dsa-ai-consent h3 {
	margin: 0 0 10px;
	font-family: var(--dsa-ai-head-font);
	font-size: 17px;
	color: var(--dsa-ai-navy);
}
#dsa-ai .dsa-ai-consent p {
	margin: 0 0 12px;
	font-size: 14px;
}
#dsa-ai .dsa-ai-consent a {
	color: var(--dsa-ai-teal);
}
#dsa-ai .dsa-ai-consent .dsa-ai-btn {
	width: 100%;
	margin-top: 6px;
}

/* Chat */
#dsa-ai .dsa-ai-chat {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
}
#dsa-ai .dsa-ai-log {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 16px 14px 8px;
	background: var(--dsa-ai-bg-2);
	scroll-behavior: smooth;
	overscroll-behavior: contain;
}
#dsa-ai .dsa-ai-msg {
	max-width: 88%;
	margin: 0 0 10px;
	padding: 10px 14px;
	border-radius: 14px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
#dsa-ai .dsa-ai-msg p {
	margin: 0 0 8px;
}
#dsa-ai .dsa-ai-msg p:last-child,
#dsa-ai .dsa-ai-msg ul:last-child,
#dsa-ai .dsa-ai-msg ol:last-child {
	margin-bottom: 0;
}
#dsa-ai .dsa-ai-msg ul,
#dsa-ai .dsa-ai-msg ol {
	margin: 0 0 8px;
	padding-left: 20px;
}
#dsa-ai .dsa-ai-msg li {
	margin: 0 0 4px;
}
#dsa-ai .dsa-ai-msg-bot {
	background: var(--dsa-ai-bg);
	border: 1px solid var(--dsa-ai-line);
	border-top-left-radius: 4px;
}
#dsa-ai .dsa-ai-msg-bot a {
	color: var(--dsa-ai-teal);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}
#dsa-ai .dsa-ai-msg-user {
	margin-left: auto;
	background: var(--dsa-ai-teal);
	color: #fff;
	border-top-right-radius: 4px;
	white-space: pre-wrap;
}

#dsa-ai .dsa-ai-typing {
	display: inline-flex;
	gap: 5px;
	padding: 14px 16px;
}
#dsa-ai .dsa-ai-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--dsa-ai-muted);
	animation: dsa-ai-dot 1.2s infinite ease-in-out;
}
.dsa-ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.dsa-ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dsa-ai-dot {
	0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

#dsa-ai .dsa-ai-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 4px 0 12px;
}
#dsa-ai .dsa-ai-chip {
	white-space: normal;
	padding: 7px 12px;
	border: 1px solid var(--dsa-ai-teal);
	border-radius: 999px;
	background: var(--dsa-ai-bg);
	color: var(--dsa-ai-teal);
	font-family: var(--dsa-ai-body-font);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-align: left;
}
#dsa-ai .dsa-ai-chip:hover {
	background: var(--dsa-ai-teal-soft);
}

#dsa-ai .dsa-ai-note {
	margin: 0 0 10px;
	padding: 10px 12px;
	border-left: 4px solid var(--dsa-ai-gold);
	border-radius: 0 10px 10px 0;
	background: var(--dsa-ai-gold-soft);
	font-size: 13.5px;
}
#dsa-ai .dsa-ai-note p {
	margin: 0;
}
#dsa-ai .dsa-ai-note a {
	color: var(--dsa-ai-navy);
	font-weight: 700;
}

#dsa-ai .dsa-ai-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 12px;
}

/* Buttons */
#dsa-ai .dsa-ai-btn {
	white-space: normal;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 8px 16px;
	border-radius: 10px;
	font-family: var(--dsa-ai-head-font);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
}
#dsa-ai .dsa-ai-btn-primary {
	background: var(--dsa-ai-gold);
	color: var(--dsa-ai-navy);
}
#dsa-ai .dsa-ai-btn-primary:hover {
	background: #C9A71F;
	color: var(--dsa-ai-navy);
}
#dsa-ai .dsa-ai-btn-primary:disabled {
	opacity: 0.6;
	cursor: wait;
}
#dsa-ai .dsa-ai-btn-ghost {
	background: var(--dsa-ai-bg);
	color: var(--dsa-ai-navy);
	border-color: var(--dsa-ai-navy);
}
#dsa-ai .dsa-ai-btn-ghost:hover {
	background: var(--dsa-ai-teal-soft);
}
#dsa-ai .dsa-ai-btn-link {
	background: transparent;
	color: var(--dsa-ai-muted);
	text-decoration: underline;
	padding: 8px 6px;
}

/* Composer */
#dsa-ai .dsa-ai-composer-wrap {
	border-top: 1px solid var(--dsa-ai-line);
	background: var(--dsa-ai-bg);
	padding: 10px 12px 4px;
}
#dsa-ai .dsa-ai-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
}
#dsa-ai .dsa-ai-input {
	flex: 1;
	min-height: 44px;
	max-height: 140px;
	padding: 11px 14px;
	border: 1px solid var(--dsa-ai-line);
	border-radius: 12px;
	background: var(--dsa-ai-bg-2);
	color: var(--dsa-ai-ink);
	font-family: var(--dsa-ai-body-font);
	font-size: 16px; /* 16px stops iOS zooming into the field */
	line-height: 1.4;
	resize: none;
}
#dsa-ai .dsa-ai-input:focus {
	border-color: var(--dsa-ai-teal);
	background: var(--dsa-ai-bg);
}
#dsa-ai .dsa-ai-send {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 12px;
	background: var(--dsa-ai-navy);
	color: var(--dsa-ai-gold);
	cursor: pointer;
}
#dsa-ai .dsa-ai-send:disabled {
	opacity: 0.5;
	cursor: wait;
}
#dsa-ai .dsa-ai-count {
	display: block;
	min-height: 16px;
	font-size: 11.5px;
	color: var(--dsa-ai-muted);
	text-align: right;
}
#dsa-ai .dsa-ai-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	opacity: 0 !important;
}
#dsa-ai .dsa-ai-foot {
	margin: 0;
	padding: 6px 14px 10px;
	background: var(--dsa-ai-bg);
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--dsa-ai-muted);
}
#dsa-ai .dsa-ai-foot a {
	color: var(--dsa-ai-muted);
}

/* Handoff form */
#dsa-ai .dsa-ai-handoff {
	margin: 0 0 12px;
	padding: 14px;
	background: var(--dsa-ai-bg);
	border: 1px solid var(--dsa-ai-line);
	border-top: 4px solid var(--dsa-ai-teal);
	border-radius: 12px;
}
#dsa-ai .dsa-ai-handoff.is-done {
	border-top-color: var(--dsa-ai-gold);
}
#dsa-ai .dsa-ai-handoff p {
	margin: 0 0 10px;
	font-size: 14px;
}
#dsa-ai .dsa-ai-handoff-title {
	font-family: var(--dsa-ai-head-font);
	font-weight: 700;
	color: var(--dsa-ai-navy);
	font-size: 15px !important;
}
#dsa-ai .dsa-ai-handoff-intro {
	color: var(--dsa-ai-muted);
}
#dsa-ai .dsa-ai-handoff label {
	display: block;
	margin: 0 0 10px;
	font-size: 13px;
	font-weight: 600;
	color: var(--dsa-ai-ink);
}
#dsa-ai .dsa-ai-handoff label > span {
	display: block;
	margin-bottom: 4px;
}
#dsa-ai .dsa-ai-handoff input[type="text"],
#dsa-ai .dsa-ai-handoff input[type="email"],
#dsa-ai .dsa-ai-handoff input[type="tel"],
#dsa-ai .dsa-ai-handoff select,
#dsa-ai .dsa-ai-handoff textarea {
	width: 100%;
	min-height: 42px;
	padding: 9px 12px;
	border: 1px solid var(--dsa-ai-line);
	border-radius: 10px;
	background: var(--dsa-ai-bg-2);
	font-family: var(--dsa-ai-body-font);
	font-size: 16px;
	font-weight: 400;
	color: var(--dsa-ai-ink);
}
#dsa-ai .dsa-ai-handoff textarea {
	resize: vertical;
}
#dsa-ai .dsa-ai-handoff .dsa-ai-check {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	font-weight: 400;
	font-size: 13px;
}
#dsa-ai .dsa-ai-handoff .dsa-ai-check input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	accent-color: var(--dsa-ai-teal);
}
#dsa-ai .dsa-ai-handoff .dsa-ai-check span {
	margin: 0;
}
#dsa-ai .dsa-ai-handoff a {
	color: var(--dsa-ai-teal);
}
#dsa-ai .dsa-ai-form-status {
	min-height: 1em;
	color: #A3361F;
	font-size: 13px !important;
}
#dsa-ai .dsa-ai-handoff-alt {
	margin: 4px 0 0 !important;
	font-size: 13px !important;
	color: var(--dsa-ai-muted);
}

/* Phones and small tablets: the app's bottom navigation bar shows at 768px and
   narrower and is 64px tall plus the safe area (mu-plugins/dsa-mobile-app.php).
   Sit 12px above it. */
@media (max-width: 768px) {
	#dsa-ai.dsa-ai {
		--dsa-ai-bottom: calc(76px + env(safe-area-inset-bottom));
		--dsa-ai-right: 14px;
	}
}

/* Phones: icon-only launcher, full-screen panel */
@media (max-width: 640px) {
	#dsa-ai .dsa-ai-launch {
		width: 56px;
		height: 56px;
		padding: 0;
		justify-content: center;
	}
	#dsa-ai .dsa-ai-launch-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
	#dsa-ai.dsa-ai.is-open {
		inset: 0;
		right: 0;
		bottom: 0;
		z-index: 100000;
	}
	#dsa-ai .dsa-ai-panel {
		position: fixed;
		inset: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		border: 0;
		border-radius: 0;
	}
	#dsa-ai .dsa-ai-head {
		padding-top: calc(12px + env(safe-area-inset-top));
	}
	#dsa-ai .dsa-ai-foot {
		padding-bottom: calc(10px + env(safe-area-inset-bottom));
	}
	#dsa-ai .dsa-ai-team-btn {
		padding: 6px 8px;
	}
	#dsa-ai .dsa-ai-msg {
		max-width: 92%;
	}
}

@media (prefers-reduced-motion: reduce) {
	#dsa-ai .dsa-ai-launch,
	#dsa-ai .dsa-ai-log {
		transition: none;
		scroll-behavior: auto;
	}
	#dsa-ai .dsa-ai-typing span {
		animation: none;
	}
}

@media print {
	#dsa-ai.dsa-ai {
		display: none !important;
	}
}
