/* AEM AI Agent widget. Brand colours are variables on #aema-root: change them here. */

#aema-root {
	/* From the AEM DATA logo: steel blue to sky blue, grey wordmark */
	--aema-blue: #4e82a8;
	--aema-blue-2: #76bde0;
	--aema-blue-deep: #3f7096;
	--aema-grad: linear-gradient(135deg, #4e82a8 0%, #76bde0 100%);
	--aema-ink: #17212c;
	--aema-text-soft: #5f6872;
	--aema-grey: #8a929c;
	--aema-line: #e2e7ee;
	--aema-line-strong: #c3ccd7;
	--aema-bg: #f4f7fa;
	--aema-card: #ffffff;
	--aema-user: #43739a;

	position: fixed;
	bottom: max(20px, env(safe-area-inset-bottom));
	z-index: 99999;
	font: 400 15px/1.5 Inter, "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--aema-ink);
	letter-spacing: 0;
	text-align: left;
}
#aema-root.aema--right { right: max(20px, env(safe-area-inset-right)); }
#aema-root.aema--left  { left: max(20px, env(safe-area-inset-left)); }

#aema-root *,
#aema-root *::before,
#aema-root *::after { box-sizing: border-box; }

/* Neutralise theme / Elementor button + input styles */
#aema-root button,
#aema-root input,
#aema-root textarea {
	font: inherit;
	letter-spacing: inherit;
	text-transform: none;
	text-shadow: none;
	margin: 0;
	min-height: 0;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}
#aema-root button { cursor: pointer; background: none; border: 0; padding: 0; color: inherit; line-height: 1; }
#aema-root svg { display: block; }
#aema-root button:focus-visible { outline: 2px solid var(--aema-blue-deep); outline-offset: 2px; }
#aema-root input:focus,
#aema-root textarea:focus { outline: none; box-shadow: none; }

/* ---------- Launcher ---------- */
#aema-root .aema-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	color: #fff;
	background: var(--aema-grad);
	box-shadow: 0 12px 28px -8px rgba(78, 130, 168, .65), 0 2px 6px rgba(15, 29, 51, .12);
	transition: transform .18s ease, box-shadow .18s ease;
}
#aema-root .aema-launcher:hover { transform: scale(1.05); }
#aema-root .aema-launcher:active { transform: scale(.97); }
#aema-root .aema-launcher svg { width: 34px; height: 34px; }
#aema-root .aema-launcher .aema-ic-close { display: none; width: 28px; height: 28px; }
#aema-root.is-open .aema-launcher .aema-ic-headset { display: none; }
#aema-root.is-open .aema-launcher .aema-ic-close { display: block; }

#aema-root .aema-launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--aema-blue-2);
	opacity: 0;
	animation: aema-pulse 2.2s ease-out 2.5s 3;
	pointer-events: none;
}
@keyframes aema-pulse {
	0%   { transform: scale(1);   opacity: .7; }
	100% { transform: scale(1.7); opacity: 0; }
}

/* ---------- Panel ---------- */
#aema-root .aema-panel {
	position: absolute;
	bottom: 76px;
	width: 392px;
	height: min(660px, calc(100vh - 120px));
	height: min(660px, calc(100dvh - 120px));
	display: flex;
	flex-direction: column;
	background: var(--aema-card);
	border: 1px solid var(--aema-line);
	border-radius: 20px;
	overflow: hidden;
	box-shadow: 0 30px 70px -18px rgba(15, 29, 51, .32), 0 2px 8px rgba(15, 29, 51, .06);

	opacity: 0;
	transform: translateY(14px) scale(.98);
	visibility: hidden;
	transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
	transform-origin: bottom right;
}
#aema-root.aema--right .aema-panel { right: 0; }
#aema-root.aema--left  .aema-panel { left: 0; transform-origin: bottom left; }
#aema-root.is-open .aema-panel {
	opacity: 1;
	transform: none;
	visibility: visible;
	transition-delay: 0s;
}

/* Header */
#aema-root .aema-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 10px 12px 14px;
	background: var(--aema-card);
	border-bottom: 1px solid var(--aema-line);
}
#aema-root .aema-avatar {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 12px;
	background: #fff;
	border: 1px solid var(--aema-line);
}
#aema-root .aema-avatar img { width: 28px; height: 28px; object-fit: contain; display: block; }
#aema-root .aema-who { flex: 1; min-width: 0; }
#aema-root .aema-who strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
#aema-root .aema-who span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--aema-text-soft); }
#aema-root .aema-who i { width: 7px; height: 7px; border-radius: 50%; background: #2fb36d; }
#aema-root .aema-ibtn {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 10px;
	color: var(--aema-text-soft);
	transition: background .15s ease, color .15s ease;
}
#aema-root .aema-ibtn:hover { background: var(--aema-bg); color: var(--aema-ink); }
#aema-root .aema-ibtn svg { width: 18px; height: 18px; }

/* Body */
#aema-root .aema-body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 4px 16px 16px;
	background: var(--aema-bg);
	scroll-behavior: smooth;
}

/* Hero: the site's two-tone, tightly tracked headline */
#aema-root .aema-hero { padding: 20px 2px 4px; }
#aema-root .aema-hero h2 {
	margin: 0 0 10px;
	padding: 0;
	font-size: 30px;
	line-height: 1.04;
	font-weight: 600;
	letter-spacing: -.04em;
	color: var(--aema-ink);
	text-transform: none;
}
#aema-root .aema-hero h2 span { display: block; color: var(--aema-grey); }
#aema-root .aema-hero p { margin: 0 0 16px; font-size: 14px; line-height: 1.55; color: var(--aema-text-soft); }

/* Menu rows (hero) */
#aema-root .aema-menu { display: flex; flex-direction: column; gap: 8px; }
#aema-root .aema-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	padding: 10px 14px;
	font-size: 14px;
	font-weight: 500;
	text-align: left;
	line-height: 1.3;
	color: var(--aema-ink);
	background: var(--aema-card);
	border: 1px solid var(--aema-line);
	border-radius: 12px;
	transition: border-color .15s ease, transform .15s ease;
}
#aema-root .aema-row:hover { border-color: var(--aema-blue-2); transform: translateX(2px); }
#aema-root .aema-row svg { flex: none; width: 16px; height: 16px; color: var(--aema-blue); }

/* Suggestion chips after an answer */
#aema-root .aema-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 2px; }
#aema-root .aema-menu-title { margin: 14px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--aema-text-soft); }
#aema-root .aema-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	font-size: 13.5px;
	font-weight: 500;
	line-height: 1.25;
	text-align: left;
	color: var(--aema-ink);
	background: var(--aema-card);
	border: 1px solid var(--aema-line);
	border-radius: 999px;
	transition: border-color .15s ease, background .15s ease;
}
#aema-root .aema-chip:hover { border-color: var(--aema-blue-2); }
#aema-root .aema-chip svg { flex: none; width: 14px; height: 14px; }
#aema-root .aema-chip--primary { color: #fff; background: var(--aema-blue-deep); border-color: var(--aema-blue-deep); }
#aema-root .aema-chip--primary:hover { background: var(--aema-blue); border-color: var(--aema-blue); }
#aema-root .aema-chip--ghost { color: var(--aema-text-soft); background: transparent; border-color: var(--aema-line-strong); }

/* Messages */
#aema-root .aema-msg {
	max-width: 88%;
	margin: 10px 0 0;
	padding: 10px 14px;
	font-size: 14.5px;
	line-height: 1.5;
	border-radius: 16px;
	overflow-wrap: anywhere;
}
#aema-root .aema-msg--bot {
	background: var(--aema-card);
	border: 1px solid var(--aema-line);
	border-bottom-left-radius: 6px;
}
#aema-root .aema-msg--user {
	margin-left: auto;
	color: #fff;
	background: var(--aema-user);
	border-bottom-right-radius: 6px;
}
#aema-root .aema-msg--err { color: #8a2c2c; background: #fdf3f3; border-color: #f3d3d3; }
#aema-root .aema-msg a { color: var(--aema-blue-deep); text-decoration: underline; text-underline-offset: 2px; }
#aema-root .aema-msg--done { border-color: #bfe3cf; background: #f3fbf6; }
#aema-root .aema-done-tag {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 4px;
	font-size: 12.5px;
	font-weight: 600;
	color: #1c7a4a;
}
#aema-root .aema-done-tag svg { width: 15px; height: 15px; }

/* Typing */
#aema-root .aema-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
#aema-root .aema-typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--aema-grey);
	animation: aema-dot 1s ease-in-out infinite;
}
#aema-root .aema-typing i:nth-child(2) { animation-delay: .15s; }
#aema-root .aema-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aema-dot {
	0%, 80%, 100% { transform: translateY(0); opacity: .45; }
	40% { transform: translateY(-3px); opacity: 1; }
}

/* ---------- Contact form card ---------- */
#aema-root .aema-card {
	margin: 12px 0 0;
	padding: 16px;
	background: var(--aema-card);
	border: 1px solid var(--aema-line);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(15, 29, 51, .04);
}
#aema-root .aema-card h3 {
	margin: 0 0 2px;
	padding: 0;
	font-size: 17px;
	font-weight: 600;
	letter-spacing: -.02em;
	color: var(--aema-ink);
	text-transform: none;
}
#aema-root .aema-card-sub { margin: 0 0 14px; font-size: 13px; color: var(--aema-text-soft); }
#aema-root .aema-lbl { display: block; margin: 0 0 8px; }
#aema-root .aema-lbl > span { display: block; margin: 0 0 4px; font-size: 12.5px; font-weight: 500; color: var(--aema-text-soft); }
#aema-root .aema-f {
	display: block;
	width: 100%;
	height: 40px;
	padding: 0 12px;
	font-size: 14.5px;
	color: var(--aema-ink);
	background: #fff;
	border: 1px solid var(--aema-line-strong);
	border-radius: 10px;
	transition: border-color .15s ease, background .15s ease;
}
#aema-root textarea.aema-f { height: auto; min-height: 64px; padding: 10px 12px; line-height: 1.45; resize: none; }
#aema-root .aema-f:hover { border-color: #aab5c2; }
#aema-root .aema-f:focus { border-color: #7d8996; }
#aema-root .aema-f.is-bad { border-color: #c4554d; background: #fffafa; }
#aema-root .aema-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 4px 0 12px;
	font-size: 12.5px;
	line-height: 1.45;
	color: var(--aema-text-soft);
	cursor: pointer;
}
#aema-root .aema-check input {
	flex: none;
	-webkit-appearance: auto;
	appearance: auto;
	width: 17px;
	height: 17px;
	margin: 1px 0 0;
	accent-color: var(--aema-blue-deep);
	cursor: pointer;
}
#aema-root .aema-ferr { min-height: 0; margin: 0 0 10px; font-size: 12.5px; line-height: 1.4; color: #b3261e; }
#aema-root .aema-ferr:empty { display: none; }
#aema-root .aema-actions { display: flex; gap: 8px; }
#aema-root .aema-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 42px;
	padding: 0 16px;
	font-size: 14.5px;
	font-weight: 600;
	border-radius: 11px;
	transition: opacity .15s ease, transform .15s ease, background .15s ease;
}
#aema-root .aema-btn--primary { flex: 1; color: #fff; background: var(--aema-grad); }
#aema-root .aema-btn--primary:hover:not(:disabled) { transform: translateY(-1px); }
#aema-root .aema-btn--primary:disabled { opacity: .55; cursor: default; }
#aema-root .aema-btn--ghost { color: var(--aema-text-soft); background: #fff; border: 1px solid var(--aema-line-strong); }
#aema-root .aema-btn--ghost:hover { background: var(--aema-bg); }
#aema-root .aema-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

/* ---------- Composer ---------- */
#aema-root .aema-form { padding: 12px 14px 6px; background: var(--aema-card); border-top: 1px solid var(--aema-line); }
#aema-root .aema-field {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	padding: 5px 5px 5px 14px;
	background: var(--aema-bg);
	border: 1px solid var(--aema-line);
	border-radius: 14px;
	transition: border-color .15s ease, background .15s ease;
}
#aema-root .aema-field:focus-within { background: #fff; border-color: var(--aema-line-strong); }
#aema-root .aema-input {
	flex: 1;
	display: block;
	width: 100%;
	height: 36px;
	max-height: 110px;
	padding: 7px 0;
	font-size: 15px;
	line-height: 22px;
	color: var(--aema-ink);
	background: transparent;
	border: 0;
	border-radius: 0;
	resize: none;
	overflow: hidden;
	scrollbar-width: none;
}
#aema-root .aema-input::-webkit-scrollbar { display: none; }
#aema-root .aema-input::placeholder { color: #98a1ab; }
#aema-root .aema-send {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 10px;
	color: #fff;
	background: var(--aema-grad);
	transition: opacity .15s ease, transform .15s ease;
}
#aema-root .aema-send:hover:not(:disabled) { transform: translateY(-1px); }
#aema-root .aema-send:disabled { opacity: .45; cursor: default; }
#aema-root .aema-send svg { width: 18px; height: 18px; }

#aema-root .aema-note {
	margin: 0;
	padding: 0 18px 12px;
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--aema-grey);
	background: var(--aema-card);
}

/* ---------- Mobile: full-screen sheet ---------- */
@media (max-width: 520px) {
	#aema-root .aema-panel {
		position: fixed;
		inset: 0;
		width: auto;
		height: auto;
		border: 0;
		border-radius: 0;
		padding-top: env(safe-area-inset-top);
		padding-bottom: env(safe-area-inset-bottom);
	}
	#aema-root.is-open .aema-launcher { display: none; }
	#aema-root .aema-input,
	#aema-root .aema-f { font-size: 16px; } /* stops iOS zoom on focus */
}

@media (prefers-reduced-motion: reduce) {
	#aema-root .aema-launcher::after { animation: none; }
	#aema-root .aema-panel { transition: opacity .01s, visibility 0s; transform: none; }
	#aema-root .aema-body { scroll-behavior: auto; }
	#aema-root .aema-typing i { animation: none; opacity: .7; }
	#aema-root .aema-row:hover { transform: none; }
}

/* While the contact form is open the free-text composer is hidden to give the form room */
#aema-root.has-form .aema-form,
#aema-root.has-form .aema-note { display: none; }

/* ---------- Contact form: field layout ---------- */
#aema-root .aema-fld { margin: 0 0 12px; }
#aema-root .aema-lab { display: block; margin: 0 0 4px; font-size: 12.5px; font-weight: 500; color: var(--aema-text-soft); }
#aema-root .aema-fld.is-invalid .aema-lab { color: #b3261e; }
#aema-root .aema-fld.is-invalid .aema-f { border-color: #c4554d; background: #fffafa; }
#aema-root .aema-ferr { margin: 4px 0 0; }
#aema-root .aema-phone { display: flex; gap: 8px; }
#aema-root select.aema-f { padding: 0 8px; cursor: pointer; }
#aema-root .aema-f--cc { flex: none; width: 92px; }
#aema-root .aema-phone .aema-f:not(.aema-f--cc) { flex: 1; min-width: 0; }
#aema-root .aema-check { font-size: 11px; line-height: 1.5; margin: 6px 0 4px; }
#aema-root .aema-check a { color: var(--aema-blue-deep); text-decoration: underline; text-underline-offset: 2px; }
#aema-root button.aema-sugg {
	display: inline; padding: 0; margin: 0; border: 0; background: transparent;
	color: var(--aema-blue-deep); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer;
}

#aema-root .aema-actions { margin-top: 10px; }
