/* AI Front Desk Concierge — widget. Every selector is prefixed .aifd- to avoid
   clashing with themes and Elementor. Colors and sizes come from CSS variables
   set in the admin. */

.aifd-root {
	--aifd-primary: #111;
	--aifd-bg: #fff;
	--aifd-text: #111;
	--aifd-radius: 14px;
	--aifd-x: 24px;
	--aifd-y: 24px;
	--aifd-launcher: 56px;
	--aifd-w: 380px;
	--aifd-h: 600px;
	--aifd-font: inherit;
	--aifd-line: color-mix(in srgb, var(--aifd-text) 12%, transparent);
	--aifd-soft: color-mix(in srgb, var(--aifd-text) 5%, var(--aifd-bg));
	--aifd-muted: color-mix(in srgb, var(--aifd-text) 58%, var(--aifd-bg));
	position: fixed;
	bottom: calc(var(--aifd-y) + env(safe-area-inset-bottom, 0px));
	z-index: 2147483000;
	font-family: var(--aifd-font);
	font-size: 15px;
	line-height: 1.45;
	color: var(--aifd-text);
	-webkit-font-smoothing: antialiased;
	text-align: left;
	letter-spacing: normal;
	text-transform: none;
}
.aifd-root.aifd-pos-right { right: var(--aifd-x); }
.aifd-root.aifd-pos-left { left: var(--aifd-x); }
.aifd-root *,
.aifd-root *::before,
.aifd-root *::after { box-sizing: border-box; }
.aifd-root button,
.aifd-root textarea,
.aifd-root input { font: inherit; color: inherit; letter-spacing: inherit; text-transform: none; margin: 0; }
.aifd-root p, .aifd-root ul { margin: 0; padding: 0; }
.aifd-root svg { display: block; flex: none; }

.aifd-root .aifd-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;
}
.aifd-root .aifd-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }


/* Neutralise theme styles on our controls (e.g. Hello Elementor colours every button on hover). */
.aifd-root button,
.aifd-root button:hover,
.aifd-root button:focus,
.aifd-root button:active {
	white-space: normal; text-align: left; text-decoration: none; text-shadow: none;
	user-select: none; min-height: 0; min-width: 0; line-height: inherit; font-weight: inherit;
	box-shadow: none; letter-spacing: inherit;
}
.aifd-root button:focus:not(:focus-visible) { outline: none; }
.aifd-root textarea, .aifd-root textarea:focus { box-shadow: none; transition: none; }
.aifd-root img { max-width: none; border: 0; }

/* Launcher ----------------------------------------------------------- */
.aifd-root .aifd-launcher {
	width: var(--aifd-launcher);
	height: var(--aifd-launcher);
	border-radius: 50%;
	border: 1px solid var(--aifd-line);
	background: var(--aifd-primary);
	color: var(--aifd-bg);
	display: grid;
	place-items: center;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .14), 0 1px 3px rgba(0, 0, 0, .08);
	transition: transform .2s ease, box-shadow .2s ease;
	overflow: hidden;
}
.aifd-root .aifd-launcher:hover, .aifd-root .aifd-launcher:focus, .aifd-root .aifd-launcher:active { background: var(--aifd-primary); color: var(--aifd-bg); border-color: var(--aifd-line); }
.aifd-root .aifd-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, .18); }
.aifd-root .aifd-launcher:focus-visible,
.aifd-root button:focus-visible,
.aifd-root a:focus-visible,
.aifd-root textarea:focus-visible,
.aifd-root .aifd-log:focus-visible { outline: 2px solid var(--aifd-primary); outline-offset: 2px; }
.aifd-root .aifd-launcher:focus-visible { outline-color: var(--aifd-text); }
.aifd-root .aifd-launcher-img { width: 100%; height: 100%; object-fit: cover; }
.aifd-root.aifd-pos-right .aifd-launcher { margin-left: auto; }

/* Tooltip ------------------------------------------------------------ */
.aifd-root .aifd-tip {
	position: absolute;
	bottom: calc(var(--aifd-launcher) + 12px);
	display: flex;
	align-items: center;
	gap: 4px;
	background: var(--aifd-bg);
	border: 1px solid var(--aifd-line);
	border-radius: var(--aifd-radius);
	box-shadow: 0 8px 28px rgba(0, 0, 0, .12);
	padding: 4px 4px 4px 14px;
	white-space: nowrap;
	animation: aifd-rise .35s ease both;
}
.aifd-root.aifd-pos-right .aifd-tip { right: 0; }
.aifd-root.aifd-pos-left .aifd-tip { left: 0; }
.aifd-root .aifd-tip-text, .aifd-root .aifd-tip-text:hover, .aifd-root .aifd-tip-text:focus { background: none; border: 0; padding: 6px 2px; cursor: pointer; font-size: 14px; }
.aifd-root .aifd-tip-x, .aifd-root .aifd-tip-x:hover, .aifd-root .aifd-tip-x:focus { background: none; border: 0; padding: 6px; cursor: pointer; color: var(--aifd-muted); border-radius: 50%; }

/* Panel -------------------------------------------------------------- */
.aifd-root .aifd-panel {
	position: absolute;
	bottom: calc(var(--aifd-launcher) + 14px);
	width: min(var(--aifd-w), calc(100vw - 2 * var(--aifd-x)));
	height: min(var(--aifd-h), calc(100vh - var(--aifd-launcher) - var(--aifd-y) - 40px));
	height: min(var(--aifd-h), calc(100dvh - var(--aifd-launcher) - var(--aifd-y) - 40px));
	background: var(--aifd-bg);
	color: var(--aifd-text);
	border: 1px solid var(--aifd-line);
	border-radius: var(--aifd-radius);
	box-shadow: 0 18px 50px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .06);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform-origin: bottom right;
	animation: aifd-open .24s cubic-bezier(.2, .8, .2, 1) both;
}
.aifd-root .aifd-panel[hidden] { display: none; }
.aifd-root.aifd-pos-right .aifd-panel { right: 0; }
.aifd-root.aifd-pos-left .aifd-panel { left: 0; transform-origin: bottom left; }

.aifd-root .aifd-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 10px 14px 18px;
	border-bottom: 1px solid var(--aifd-line);
}
.aifd-root .aifd-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.aifd-root .aifd-titles { flex: 1; min-width: 0; }
.aifd-root .aifd-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aifd-root .aifd-intro { font-size: 12.5px; color: var(--aifd-muted); }
.aifd-root .aifd-hbtn {
	background: none; border: 0; padding: 7px; cursor: pointer; border-radius: 8px; color: var(--aifd-muted);
	transition: background .15s ease, color .15s ease;
}
.aifd-root .aifd-hbtn:focus, .aifd-root .aifd-hbtn:active { background: none; color: var(--aifd-muted); border: 0; }
.aifd-root .aifd-hbtn:hover { background: var(--aifd-soft); color: var(--aifd-text); border: 0; }

.aifd-root .aifd-log {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 18px 16px 8px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	scrollbar-width: thin;
}

.aifd-root .aifd-msg { display: flex; flex-direction: column; gap: 8px; max-width: 100%; }
.aifd-root .aifd-msg.aifd-in { animation: aifd-rise .25s ease both; }
.aifd-root .aifd-bubble { padding: 10px 14px; border-radius: var(--aifd-radius); max-width: 88%; overflow-wrap: anywhere; }
.aifd-root .aifd-bot .aifd-bubble { background: var(--aifd-soft); border-top-left-radius: 4px; align-self: flex-start; }
.aifd-root .aifd-user { align-items: flex-end; }
.aifd-root .aifd-user .aifd-bubble { background: var(--aifd-primary); color: var(--aifd-bg); border-top-right-radius: 4px; white-space: pre-wrap; }
.aifd-root .aifd-bubble p + p, .aifd-root .aifd-bubble p + ul, .aifd-root .aifd-bubble ul + p { margin-top: 8px; }
.aifd-root .aifd-bubble ul { list-style: none; }
.aifd-root .aifd-bubble li { position: relative; padding-left: 14px; }
.aifd-root .aifd-bubble li + li { margin-top: 4px; }
.aifd-root .aifd-bubble li::before { content: ''; position: absolute; left: 2px; top: .65em; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .5; }
.aifd-root .aifd-note { font-size: 12.5px; color: var(--aifd-muted); padding: 0 4px; max-width: 88%; }

/* Links and download cards ------------------------------------------ */
.aifd-root .aifd-links { display: flex; flex-direction: column; gap: 6px; max-width: 88%; }
.aifd-root .aifd-link {
	display: flex; align-items: center; gap: 10px;
	padding: 10px 12px;
	border: 1px solid var(--aifd-line);
	border-radius: var(--aifd-radius);
	color: var(--aifd-text) !important;
	text-decoration: none !important;
	background: var(--aifd-bg);
	transition: border-color .15s ease, background .15s ease;
	max-width: 88%;
}
.aifd-root .aifd-links .aifd-link { max-width: 100%; }
.aifd-root .aifd-link:hover { border-color: var(--aifd-primary); background: var(--aifd-soft); }
.aifd-root .aifd-link-label { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }

/* Buttons ------------------------------------------------------------ */
.aifd-root .aifd-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.aifd-root .aifd-actions.aifd-menu { flex-direction: column; flex-wrap: nowrap; }
.aifd-root .aifd-btn {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 8px 14px;
	border: 1px solid var(--aifd-line);
	border-radius: 999px;
	background: var(--aifd-bg);
	cursor: pointer;
	text-align: left;
	font-size: 14px;
	transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.aifd-root .aifd-btn:focus, .aifd-root .aifd-btn:active, .aifd-root .aifd-btn[disabled] { background: var(--aifd-bg); color: var(--aifd-text); border-color: var(--aifd-line); }
.aifd-root .aifd-btn:hover:not([disabled]) { background: var(--aifd-bg); color: var(--aifd-text); border-color: var(--aifd-primary); }
.aifd-root .aifd-btn[disabled] { opacity: .45; cursor: default; }
.aifd-root .aifd-btn-menu {
	width: 100%;
	border-radius: var(--aifd-radius);
	padding: 11px 14px;
	font-size: 14.5px;
}
.aifd-root .aifd-btn-menu:hover:not([disabled]) { background: var(--aifd-soft); }
.aifd-root .aifd-btn-menu svg { color: var(--aifd-muted); }
.aifd-root .aifd-menu .aifd-btn-ghost { align-self: flex-start; border-color: transparent; padding-left: 4px; }
.aifd-root .aifd-btn-primary, .aifd-root .aifd-btn-primary:focus, .aifd-root .aifd-btn-primary:active, .aifd-root .aifd-btn-primary:hover:not([disabled]) { background: var(--aifd-primary); color: var(--aifd-bg); border-color: var(--aifd-primary); }
.aifd-root .aifd-btn-primary:hover:not([disabled]) { opacity: .9; }
.aifd-root .aifd-btn-ghost, .aifd-root .aifd-btn-ghost:hover:not([disabled]), .aifd-root .aifd-btn-ghost:focus { color: var(--aifd-muted); }
.aifd-root .aifd-btn-slot { font-variant-numeric: tabular-nums; }

/* Typing ------------------------------------------------------------- */
.aifd-root .aifd-typing .aifd-dots { display: inline-flex; gap: 4px; padding: 14px; background: var(--aifd-soft); border-radius: var(--aifd-radius); border-top-left-radius: 4px; align-self: flex-start; }
.aifd-root .aifd-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--aifd-muted); animation: aifd-dot 1.1s infinite ease-in-out; }
.aifd-root .aifd-dots span:nth-child(2) { animation-delay: .15s; }
.aifd-root .aifd-dots span:nth-child(3) { animation-delay: .3s; }

/* Form --------------------------------------------------------------- */
.aifd-root .aifd-form {
	display: flex; align-items: flex-end; gap: 8px;
	padding: 10px 12px 10px 16px;
	border-top: 1px solid var(--aifd-line);
	position: relative;
}
.aifd-root .aifd-input {
	flex: 1;
	resize: none;
	border: 0 !important;
	outline: none;
	background: transparent !important;
	box-shadow: none !important;
	padding: 8px 0 !important;
	min-height: 38px;
	max-height: 120px;
	font-size: 16px; /* 16px stops iOS zooming in */
	line-height: 1.4;
}
.aifd-root .aifd-input::placeholder { color: var(--aifd-muted); opacity: 1; }
.aifd-root .aifd-send, .aifd-root .aifd-send:hover, .aifd-root .aifd-send:focus, .aifd-root .aifd-send:active {
	width: 38px; height: 38px; border-radius: 50%;
	border: 0; background: var(--aifd-primary); color: var(--aifd-bg);
	display: grid; place-items: center; cursor: pointer; flex: none; padding: 0;
}
.aifd-root .aifd-busy .aifd-send { opacity: .5; }
.aifd-root .aifd-privacy { font-size: 11.5px; color: var(--aifd-muted); padding: 0 16px 12px; line-height: 1.35; }

/* Phones ------------------------------------------------------------- */
@media (max-width: 600px) {
	.aifd-root { --aifd-x: 16px; --aifd-y: 16px; }
	.aifd-root .aifd-panel { width: calc(100vw - 2 * var(--aifd-x)); }
	.aifd-root.aifd-modal { inset: 0; bottom: 0; left: 0; right: 0; }
	.aifd-root.aifd-modal .aifd-panel {
		position: fixed; inset: 0; width: 100%; height: 100%; max-height: none;
		border-radius: 0; border: 0;
		padding-top: env(safe-area-inset-top, 0px);
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	.aifd-root.aifd-modal .aifd-launcher { display: none; }
	.aifd-root .aifd-min { display: none; }
	.aifd-root .aifd-bubble, .aifd-root .aifd-links, .aifd-root .aifd-note { max-width: 94%; }
}
html.aifd-lock, html.aifd-lock body { overflow: hidden !important; }

/* Motion ------------------------------------------------------------- */
@keyframes aifd-open { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes aifd-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes aifd-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.aifd-root.aifd-still, .aifd-root.aifd-still * { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
	.aifd-root, .aifd-root * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print { .aifd-root { display: none !important; } }
