.aida-chat-widget {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	width: 100%;
	max-width: 480px;
	display: flex;
	flex-direction: column;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 6px 28px rgba(0, 0, 0, .14);
	background: #fff;
	border: 1px solid #e2e2e2;
}

/* ── Header ── */
.aida-chat-header {
	background: #1a1a2e;
	color: #fff;
	padding: 14px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}

.aida-chat-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	background: #444;
}

.aida-chat-avatar-placeholder {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #3a3a5c;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.aida-chat-avatar-placeholder svg {
	width: 22px;
	height: 22px;
	fill: #aab;
}

.aida-chat-header-info {
	flex: 1;
	min-width: 0;
}

.aida-chat-bot-name {
	font-weight: 600;
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aida-chat-status {
	font-size: 11px;
	color: #8ecf9e;
	margin-top: 2px;
}

/* ── Messages area ── */
.aida-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px 14px;
	min-height: 280px;
	max-height: 400px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #f4f4f8;
	scroll-behavior: smooth;
}

.aida-msg {
	max-width: 82%;
	padding: 10px 14px;
	border-radius: 18px;
	font-size: 14px;
	line-height: 1.55;
	word-break: break-word;
}

.aida-msg.user {
	align-self: flex-end;
	background: #1a1a2e;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.aida-msg.bot {
	align-self: flex-start;
	background: #fff;
	color: #222;
	border: 1px solid #e4e4e8;
	border-bottom-left-radius: 4px;
}

.aida-msg.bot.error {
	color: #b92b2b;
	border-color: #f5c2c2;
	background: #fff5f5;
}

/* typing indicator */
.aida-msg.typing {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e4e4e8;
	border-bottom-left-radius: 4px;
	padding: 12px 16px;
}

.aida-typing-dots {
	display: flex;
	gap: 4px;
	align-items: center;
}

.aida-typing-dots span {
	display: inline-block;
	width: 7px;
	height: 7px;
	background: #aaa;
	border-radius: 50%;
	animation: aida-bounce 1.2s infinite ease-in-out;
}

.aida-typing-dots span:nth-child(2) { animation-delay: .2s; }
.aida-typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes aida-bounce {
	0%, 80%, 100% { transform: scale(.75); opacity: .4; }
	40%           { transform: scale(1);    opacity: 1;   }
}

/* ── Footer / input ── */
.aida-chat-footer {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid #e2e2e2;
	flex-shrink: 0;
}

.aida-chat-input {
	flex: 1;
	border: 1px solid #d0d0d8;
	border-radius: 22px;
	padding: 9px 16px;
	font-size: 14px;
	outline: none;
	font-family: inherit;
	transition: border-color .2s;
	background: #fafafa;
}

.aida-chat-input:focus {
	border-color: #1a1a2e;
	background: #fff;
}

.aida-chat-input:disabled {
	opacity: .5;
	cursor: not-allowed;
}

.aida-chat-send {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: #1a1a2e;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background .2s, transform .1s;
}

.aida-chat-send:hover:not(:disabled) {
	background: #2e2e50;
	transform: scale(1.06);
}

.aida-chat-send:disabled {
	background: #b0b0c0;
	cursor: not-allowed;
	transform: none;
}

.aida-chat-send svg {
	width: 18px;
	height: 18px;
	fill: #fff;
}

/* ── Shortcode hint in admin ── */
.aida-shortcode-hint {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #f0f0f7;
	border: 1px solid #d0d0e0;
	border-radius: 6px;
	padding: 8px 14px;
	font-family: monospace;
	font-size: 14px;
	color: #333;
	margin: 12px 0 20px;
}

.aida-chat-not-configured {
	text-align: center;
	padding: 20px;
	color: #888;
	font-size: 14px;
}

/* ── Requirements list ── */
.aida-requirements-list {
	margin: 10px 0 20px;
	padding: 0;
	list-style: none;
	max-width: 620px;
}

.aida-requirements-list li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 14px;
	margin-bottom: 5px;
	border-radius: 7px;
	font-size: 14px;
}

.aida-req-ok   { background: #f0fff5; border: 1px solid #b9f0cc; }
.aida-req-fail { background: #fff5f5; border: 1px solid #ffc9c9; }

.aida-req-icon {
	font-size: 15px;
	width: 20px;
	text-align: center;
	flex-shrink: 0;
}

.aida-req-ok   .aida-req-icon { color: #1e9e4f; }
.aida-req-fail .aida-req-icon { color: #c0392b; }

.aida-req-label {
	flex: 1;
	font-weight: 500;
	color: #222;
}

.aida-req-value {
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 12px;
	color: #555;
}

.aida-req-link {
	font-size: 12px;
	color: #0073aa;
	text-decoration: none;
	white-space: nowrap;
}

.aida-req-link:hover { text-decoration: underline; }

/* ── Toggle switch ── */
.aida-bot-toggle-row {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 18px 0 10px;
}

.aida-switch {
	position: relative;
	display: inline-block;
	width: 54px;
	height: 28px;
	flex-shrink: 0;
}

.aida-switch input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.aida-switch-slider {
	position: absolute;
	inset: 0;
	background: #c8c8d8;
	border-radius: 28px;
	transition: background .25s;
	cursor: pointer;
}

.aida-switch-slider::before {
	content: '';
	position: absolute;
	width: 22px;
	height: 22px;
	left: 3px;
	top: 3px;
	background: #fff;
	border-radius: 50%;
	transition: transform .25s;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}

.aida-switch input:checked + .aida-switch-slider            { background: #1e9e4f; }
.aida-switch input:checked + .aida-switch-slider::before   { transform: translateX(26px); }
.aida-switch input:disabled + .aida-switch-slider          { opacity: .45; cursor: not-allowed; }

.aida-bot-toggle-label {
	font-size: 15px;
	font-weight: 500;
	color: #222;
}

/* health check */
.aida-health-ok   { color: #1e9e4f; font-weight: 600; }
.aida-health-fail { color: #c0392b; font-weight: 600; }
.aida-health-spin { color: #888; font-style: italic; }

/* ── Floating widget ── */
#aida-floating-widget {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

#aida-float-panel {
	width: 360px;
	max-width: calc(100vw - 48px);
	transform-origin: bottom right;
	transform: scale(0.85) translateY(20px);
	opacity: 0;
	pointer-events: none;
	transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), opacity 0.2s ease;
}

#aida-float-panel.aida-open {
	transform: scale(1) translateY(0);
	opacity: 1;
	pointer-events: auto;
}

#aida-float-panel .aida-chat-messages {
	min-height: 240px;
	max-height: 340px;
}

/* Clear conversation button (header, both widgets) */
.aida-chat-clear {
	background: rgba(255,255,255,.12);
	border: none;
	cursor: pointer;
	color: #fff;
	width: 30px;
	height: 30px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background .15s;
	flex-shrink: 0;
}
.aida-chat-clear:hover {
	background: rgba(255,255,255,.28);
}
.aida-chat-clear svg {
	width: 17px;
	height: 17px;
	fill: currentColor;
}

/* Close button inside panel header */
#aida-float-close {
	background: rgba(255,255,255,.12);
	border: none;
	cursor: pointer;
	color: #fff;
	width: 30px;
	height: 30px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background .15s;
	flex-shrink: 0;
	margin-left: auto;
}
#aida-float-close:hover {
	background: rgba(255,255,255,.28);
}
#aida-float-close svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* Floating toggle button */
#aida-float-toggle {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: none;
	background: #1a1a2e;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	box-shadow: 0 4px 18px rgba(0,0,0,.28);
	transition: transform .15s, box-shadow .2s;
	position: relative;
	flex-shrink: 0;
	padding: 0;
}

#aida-float-toggle:hover {
	transform: scale(1.08);
	box-shadow: 0 6px 24px rgba(0,0,0,.32);
}

#aida-float-toggle .aida-float-btn-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}

#aida-float-toggle svg {
	width: 28px;
	height: 28px;
	fill: #fff;
}

/* ── Markdown rendering inside bot messages ─────────────────────────────── */
.aida-msg.bot .aida-md-p {
	margin: 0 0 .5em;
}
.aida-msg.bot .aida-md-p:last-child {
	margin-bottom: 0;
}
.aida-msg.bot .aida-md-h {
	font-size: 1em;
	font-weight: 700;
	margin: .6em 0 .3em;
	line-height: 1.3;
	color: #1a1a2e;
}
.aida-msg.bot .aida-md-h:first-child {
	margin-top: 0;
}
.aida-msg.bot .aida-md-list {
	margin: .35em 0 .5em 1.15em;
	padding: 0;
}
.aida-msg.bot .aida-md-list:last-child {
	margin-bottom: 0;
}
.aida-msg.bot .aida-md-list li {
	margin-bottom: .2em;
	line-height: 1.5;
}
.aida-msg.bot .aida-md-list li:last-child {
	margin-bottom: 0;
}
.aida-msg.bot strong {
	font-weight: 700;
	color: #111;
}
.aida-msg.bot em {
	font-style: italic;
	color: #444;
}
.aida-msg.bot .aida-md-code {
	background: #f0f0f5;
	border: 1px solid #e0e0ea;
	border-radius: 4px;
	padding: .1em .4em;
	font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
	font-size: .88em;
	color: #c0392b;
}
.aida-msg.bot .aida-md-link {
	color: #0057cc;
	text-decoration: underline;
	text-underline-offset: 2px;
	font-weight: 500;
}
.aida-msg.bot .aida-md-link:hover {
	color: #003d99;
	text-decoration-thickness: 2px;
}
.aida-msg.bot .aida-md-hr {
	border: none;
	border-top: 1px solid #e0e0e8;
	margin: .6em 0;
}

/* Pulse animation on first load */
@keyframes aida-pulse {
	0%   { box-shadow: 0 4px 18px rgba(0,0,0,.28), 0 0 0 0 rgba(26,26,46,.5); }
	70%  { box-shadow: 0 4px 18px rgba(0,0,0,.28), 0 0 0 14px rgba(26,26,46,0); }
	100% { box-shadow: 0 4px 18px rgba(0,0,0,.28), 0 0 0 0 rgba(26,26,46,0); }
}
#aida-float-toggle.aida-pulse {
	animation: aida-pulse 1.8s ease-out 2;
}
