/* mAIa – AI chat widget */
.maia-chat {
	--maia-primary: #5b3df5;
	--maia-bg: #ffffff;
	--maia-surface: #f4f4f7;
	--maia-text: #1c1c24;
	--maia-muted: #6b6b78;
	--maia-border: #e4e4ea;
	--maia-radius: 16px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.5;
	color: var(--maia-text);
	box-sizing: border-box;
}
.maia-chat *, .maia-chat *::before, .maia-chat *::after { box-sizing: border-box; }
.maia-chat [hidden] { display: none !important; }
.maia-chat button { font: inherit; cursor: pointer; }
.maia-chat svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ----- layout: inline ----- */
.maia-mode-inline { height: 560px; max-width: 100%; }
.maia-mode-inline .maia-panel { height: 100%; }

/* ----- layout: floating ----- */
.maia-mode-floating { position: fixed; bottom: 20px; z-index: 99999; }
.maia-mode-floating.maia-pos-right { right: 20px; }
.maia-mode-floating.maia-pos-left { left: 20px; }
.maia-launcher {
	width: 60px; height: 60px; border-radius: 50%; border: 0;
	background: var(--maia-primary); color: #fff;
	display: grid; place-items: center;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
	transition: transform .15s ease;
}
.maia-launcher:hover { transform: scale(1.06); }
.maia-launcher svg { width: 26px; height: 26px; }
.maia-open .maia-launcher { display: none; }
.maia-mode-floating .maia-panel {
	position: absolute; bottom: 0;
	width: 380px; height: min(620px, calc(100vh - 40px));
	box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
}
.maia-pos-right .maia-panel { right: 0; }
.maia-pos-left .maia-panel { left: 0; }
@media (max-width: 480px) {
	.maia-mode-floating.maia-open { inset: 0; }
	.maia-mode-floating .maia-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; }
}

/* ----- panel ----- */
.maia-panel {
	display: flex; flex-direction: column;
	background: var(--maia-bg);
	border: 1px solid var(--maia-border);
	border-radius: var(--maia-radius);
	overflow: hidden;
}
.maia-header {
	display: flex; align-items: center; gap: 10px;
	padding: 12px 14px;
	background: var(--maia-primary); color: #fff;
}
.maia-avatar {
	width: 36px; height: 36px; border-radius: 50%;
	background: rgba(255, 255, 255, .22);
	display: grid; place-items: center; font-weight: 700;
}
.maia-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.maia-title strong { font-size: 16px; }
.maia-title span { font-size: 12px; opacity: .85; }
.maia-header-btns { display: flex; gap: 4px; }
.maia-icon-btn {
	background: transparent; border: 0; color: #fff; padding: 6px; border-radius: 8px; line-height: 0;
}
.maia-icon-btn:hover, .maia-icon-btn:focus-visible { background: rgba(255, 255, 255, .18); }

/* ----- messages ----- */
.maia-log {
	flex: 1; overflow-y: auto; padding: 16px 14px;
	display: flex; flex-direction: column; gap: 10px;
	background: var(--maia-bg);
}
.maia-msg {
	max-width: 85%; padding: 10px 13px; border-radius: 14px;
	word-wrap: break-word; white-space: normal;
}
.maia-msg p { margin: 0 0 6px; }
.maia-msg p:last-child { margin-bottom: 0; }
/* Lists: WordPress admin and many themes reset list bullets, margins and font size – restore them. */
.maia-chat .maia-msg ul { list-style: disc outside !important; margin: 4px 0 6px !important; padding: 0 0 0 20px !important; }
.maia-chat .maia-msg li { display: list-item !important; list-style: inherit !important; margin: 0 0 2px !important; padding: 0 !important; font-size: inherit !important; line-height: inherit !important; }
.maia-chat .maia-msg li::marker { color: currentColor; }
.maia-chat .maia-msg li::before { content: none !important; }
.maia-msg a { color: inherit; text-decoration: underline; }
.maia-bot { align-self: flex-start; background: var(--maia-surface); border-bottom-left-radius: 4px; }
.maia-user {
	align-self: flex-end; background: var(--maia-primary); color: #fff;
	border-bottom-right-radius: 4px; white-space: pre-wrap;
}
.maia-error { background: #fdecec; color: #8a1c1c; }

.maia-typing { display: flex; gap: 4px; padding: 14px; }
.maia-typing span {
	width: 7px; height: 7px; border-radius: 50%; background: var(--maia-muted);
	animation: maia-blink 1.2s infinite ease-in-out;
}
.maia-typing span:nth-child(2) { animation-delay: .15s; }
.maia-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes maia-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ----- quick replies ----- */
.maia-chips { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; padding: 0 14px 10px; }
/* Themes and wp-admin style <button> heavily (padding, height, centring, uppercase): reset for chips. */
.maia-chat .maia-chip {
	display: inline-block !important; width: auto !important; max-width: 100% !important;
	height: auto !important; min-height: 0 !important; margin: 0 !important;
	padding: 5px 12px !important; border: 1px solid var(--maia-primary) !important; border-radius: 14px !important;
	background: transparent !important; color: var(--maia-primary) !important; box-shadow: none !important;
	font-size: 13px !important; font-weight: 400 !important; line-height: 1.35 !important;
	text-align: left !important; text-transform: none !important; letter-spacing: normal !important;
	white-space: normal !important; word-break: normal; overflow-wrap: anywhere;
}
.maia-chat .maia-chip:hover, .maia-chat .maia-chip:focus-visible { background: var(--maia-primary) !important; color: #fff !important; }

/* ----- composer ----- */
.maia-form {
	display: flex; align-items: flex-end; gap: 8px;
	padding: 10px 12px; border-top: 1px solid var(--maia-border);
}
.maia-input {
	flex: 1; resize: none; border: 1px solid var(--maia-border); border-radius: 12px;
	padding: 9px 12px; font: inherit; color: var(--maia-text); background: #fff;
	max-height: 120px; outline: none;
}
.maia-input:focus { border-color: var(--maia-primary); }
.maia-send {
	width: 40px; height: 40px; border-radius: 50%; border: 0;
	background: var(--maia-primary); color: #fff; display: grid; place-items: center; flex-shrink: 0;
}
.maia-footer { padding: 0 12px 10px; text-align: center; }
.maia-footer small { display: block; color: var(--maia-muted); font-size: 11px; line-height: 1.35; }
.maia-human-link {
	background: none; border: 0; padding: 0 0 4px; color: var(--maia-primary);
	font-size: 12px; text-decoration: underline;
}

/* ----- human hand-off ----- */
.maia-handoff {
	align-self: stretch; border: 1px solid var(--maia-border); border-radius: 14px;
	padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #fff;
}
.maia-handoff > small { color: var(--maia-muted); }
.maia-actions { display: flex; flex-direction: column; gap: 6px; }
.maia-action {
	display: block; text-align: center; text-decoration: none !important;
	border: 1px solid var(--maia-primary); color: var(--maia-primary) !important;
	background: #fff; border-radius: 10px; padding: 8px 10px; font-size: 14px;
}
.maia-action.maia-primary { background: var(--maia-primary); color: #fff !important; }

/* ----- other buttons: same protection against theme / wp-admin button styles ----- */
.maia-chat .maia-send, .maia-chat .maia-launcher, .maia-chat .maia-icon-btn, .maia-chat .maia-human-link {
	min-height: 0 !important; margin: 0 !important; box-shadow: none !important;
	text-transform: none !important; letter-spacing: normal !important; font-weight: 400 !important;
}
.maia-chat .maia-send {
	width: 40px !important; height: 40px !important; flex: 0 0 40px; padding: 0 !important;
	border: 0 !important; border-radius: 50% !important; line-height: 0 !important;
	background: var(--maia-primary) !important; color: #fff !important;
}
.maia-chat .maia-launcher {
	width: 60px !important; height: 60px !important; padding: 0 !important;
	border: 0 !important; border-radius: 50% !important; line-height: 0 !important;
	background: var(--maia-primary) !important; color: #fff !important;
}
.maia-chat .maia-icon-btn {
	width: auto !important; height: auto !important; padding: 6px !important;
	border: 0 !important; border-radius: 8px !important; line-height: 0 !important;
	background: transparent !important; color: #fff !important;
}
.maia-chat .maia-icon-btn:hover, .maia-chat .maia-icon-btn:focus-visible { background: rgba(255, 255, 255, .18) !important; }
.maia-chat .maia-human-link {
	width: auto !important; height: auto !important; padding: 0 0 4px !important;
	border: 0 !important; border-radius: 0 !important; background: none !important;
	color: var(--maia-primary) !important; font-size: 12px !important; line-height: 1.4 !important;
}
