/* Mako AI Assistant — widget styles. Scoped under .makoai-root. */

.makoai-root {
	--makoai-primary: #2546A5;
	--makoai-bg: #ffffff;
	--makoai-text: #1f2430;
	--makoai-muted: #6b7280;
	--makoai-user: var(--makoai-primary);
	--makoai-assistant-bg: #f3f5fb;
	--makoai-radius: 16px;
	--makoai-shadow: 0 12px 40px rgba(16, 24, 64, 0.18);
	--makoai-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	position: fixed;
	bottom: 24px;
	z-index: 2147483000;
	font-family: var(--makoai-font);
	color: var(--makoai-text);
	box-sizing: border-box;
}
.makoai-root *,
.makoai-root *::before,
.makoai-root *::after { box-sizing: border-box; }

/* Neutralise inherited theme styles (esp. for the no-Shadow-DOM fallback). */
.makoai-root button,
.makoai-root textarea,
.makoai-root input,
.makoai-root a,
.makoai-root p,
.makoai-root span,
.makoai-root div {
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
}
.makoai-root button {
	-webkit-appearance: none;
	appearance: none;
	min-width: 0;
	min-height: 0;
	text-decoration: none;
	text-shadow: none;
}
.makoai-root textarea,
.makoai-root input {
	-webkit-appearance: none;
	appearance: none;
}
.makoai-root img { max-width: none; }

.makoai-bottom-right { right: 24px; }
.makoai-bottom-left { left: 24px; }

/* ---- Launcher ---- */
.makoai-launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 0;
	cursor: pointer;
	background: var(--makoai-primary);
	color: #fff;
	padding: 14px 18px;
	border-radius: 999px;
	box-shadow: var(--makoai-shadow);
	font: 600 15px/1 var(--makoai-font);
	transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.makoai-launcher:hover { transform: translateY(-2px); }
.makoai-launcher:focus-visible { outline: 3px solid rgba(37, 70, 165, .45); outline-offset: 2px; }
.makoai-launcher-label { white-space: nowrap; }
.makoai-is-open .makoai-launcher { opacity: 0; pointer-events: none; }

/* ---- Panel ---- */
.makoai-panel {
	position: absolute;
	bottom: 0;
	width: 384px;
	max-width: calc(100vw - 32px);
	height: 600px;
	max-height: calc(100vh - 48px);
	background: var(--makoai-bg);
	border-radius: var(--makoai-radius);
	box-shadow: var(--makoai-shadow);
	display: none; /* shown only via the .makoai-is-open class */
	flex-direction: column;
	overflow: hidden;
}
.makoai-root.makoai-is-open .makoai-panel {
	display: flex;
	animation: makoai-in .18s ease;
}
.makoai-bottom-right .makoai-panel { right: 0; }
.makoai-bottom-left .makoai-panel { left: 0; }

@keyframes makoai-in {
	from { opacity: 0; transform: translateY(12px) scale(.98); }
	to   { opacity: 1; transform: none; }
}

/* ---- Header ---- */
.makoai-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	background: var(--makoai-primary);
	color: #fff;
}
.makoai-avatar {
	width: 34px; height: 34px;
	border-radius: 9px;
	background: #fff;
	padding: 3px;
	flex: 0 0 auto;
	object-fit: contain;
}
.makoai-titles { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.makoai-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.makoai-ai-tag { font-size: 11px; opacity: .85; line-height: 1.3; margin-top: 2px; }
.makoai-header-actions { display: flex; gap: 4px; }
.makoai-icon-btn {
	border: 0; background: rgba(255,255,255,.15); color: #fff;
	width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
	transition: background .15s ease;
}
.makoai-icon-btn:hover { background: rgba(255,255,255,.28); }
.makoai-icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* ---- Contact action bar ---- */
.makoai-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 8px 12px;
	background: #fff;
	border-bottom: 1px solid #eef0f6;
}
.makoai-action {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	text-decoration: none;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--makoai-primary);
	background: rgba(37, 70, 165, .08);
	padding: 6px 11px;
	border-radius: 999px;
	transition: background .15s ease;
}
.makoai-action:hover { background: rgba(37, 70, 165, .16); }
.makoai-action svg { width: 15px; height: 15px; flex: 0 0 auto; }

/* ---- Quick-reply chips ---- */
.makoai-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 4px;
}
.makoai-chip {
	border: 1px solid var(--makoai-primary);
	background: #fff;
	color: var(--makoai-primary);
	border-radius: 999px;
	padding: 8px 13px;
	font: 500 13px var(--makoai-font);
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}
.makoai-chip:hover { background: var(--makoai-primary); color: #fff; }
.makoai-chip:focus-visible { outline: 3px solid rgba(37, 70, 165, .4); outline-offset: 2px; }

/* ---- Body / messages ---- */
.makoai-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: #fbfbfd;
	scroll-behavior: smooth;
	/* Stop scroll from chaining to the page behind the chat. */
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}
.makoai-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.makoai-msg-user { justify-content: flex-end; }
.makoai-msg-avatar {
	width: 26px; height: 26px; border-radius: 7px; background: #fff;
	padding: 2px; flex: 0 0 auto; object-fit: contain;
	border: 1px solid #eef0f6;
}
.makoai-bubble {
	max-width: 80%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 14.5px;
	line-height: 1.5;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.makoai-msg-user .makoai-bubble {
	background: var(--makoai-user);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.makoai-msg-assistant .makoai-bubble {
	background: var(--makoai-assistant-bg);
	color: var(--makoai-text);
	border-bottom-left-radius: 4px;
}
.makoai-bubble p { margin: 0 0 8px; }
.makoai-bubble p:last-child { margin-bottom: 0; }
.makoai-bubble ul { margin: 4px 0; padding-left: 20px; }
.makoai-bubble a { color: var(--makoai-primary); text-decoration: underline; }
.makoai-msg-user .makoai-bubble a { color: #fff; }
.makoai-bubble code { background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 5px; font-size: .9em; }

/* ---- Sources + disclaimer (AI Act) ---- */
.makoai-sources {
	margin-top: 8px; padding-top: 8px;
	border-top: 1px solid rgba(0,0,0,.08);
	font-size: 12px; color: var(--makoai-muted);
	display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
}
.makoai-sources-label { font-weight: 600; }
.makoai-sources a {
	color: var(--makoai-primary);
	background: rgba(37,70,165,.08);
	padding: 2px 8px; border-radius: 999px; text-decoration: none;
	font-size: 11.5px;
}
.makoai-disclaimer {
	margin-top: 6px;
	font-size: 11px;
	color: var(--makoai-muted);
	font-style: italic;
}

/* ---- Typing dots ---- */
.makoai-dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.makoai-dots i {
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--makoai-muted); display: inline-block;
	animation: makoai-bounce 1.2s infinite ease-in-out;
}
.makoai-dots i:nth-child(2) { animation-delay: .15s; }
.makoai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes makoai-bounce { 0%,80%,100% { transform: scale(.6); opacity:.5;} 40% { transform: scale(1); opacity:1;} }

/* ---- Footer / consent / input ---- */
.makoai-footer { border-top: 1px solid #eef0f6; background: #fff; }

.makoai-consent { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.makoai-consent-text { margin: 0; font-size: 13px; line-height: 1.55; color: var(--makoai-text); }
.makoai-consent-link { font-size: 12.5px; color: var(--makoai-primary); }
.makoai-btn {
	border: 0; border-radius: 10px; padding: 11px 14px;
	font: 600 14px var(--makoai-font); cursor: pointer;
}
.makoai-btn-primary { background: var(--makoai-primary); color: #fff; }
.makoai-btn-primary:hover { filter: brightness(1.05); }
.makoai-btn:focus-visible { outline: 3px solid rgba(37,70,165,.4); outline-offset: 2px; }

.makoai-inputbar {
	display: flex; align-items: flex-end; gap: 8px;
	padding: 10px 12px 4px;
}
.makoai-input {
	flex: 1; resize: none; border: 1px solid #d9dde8;
	border-radius: 12px; padding: 10px 12px;
	font: 14.5px/1.4 var(--makoai-font); color: var(--makoai-text);
	max-height: 120px; outline: none; background: #fff;
}
.makoai-input:focus { border-color: var(--makoai-primary); box-shadow: 0 0 0 3px rgba(37,70,165,.12); }
.makoai-send {
	flex: 0 0 auto; border: 0; cursor: pointer;
	width: 42px; height: 42px; border-radius: 12px;
	background: var(--makoai-primary); color: #fff;
	display: inline-flex; align-items: center; justify-content: center;
	transition: opacity .15s ease;
}
.makoai-send:disabled { opacity: .5; cursor: default; }
.makoai-send:focus-visible { outline: 3px solid rgba(37,70,165,.4); outline-offset: 2px; }
.makoai-foot-note {
	margin: 0; padding: 2px 14px 10px;
	font-size: 10.5px; color: var(--makoai-muted); text-align: center;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
	.makoai-root { bottom: 12px; }
	.makoai-bottom-right { right: 12px; }
	.makoai-bottom-left { left: 12px; }
	.makoai-panel {
		width: 100vw; max-width: 100vw;
		height: 100vh; height: 100dvh; max-height: 100dvh;
		border-radius: 0;
		position: fixed; inset: 0;
		overscroll-behavior: none;
	}
	/* >=16px stops iOS Safari from auto-zooming when the field gains focus. */
	.makoai-input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.makoai-panel, .makoai-launcher, .makoai-dots i { animation: none; transition: none; }
}
