/**
 * Front-end AI chat widget styling. Scoped under #adromax-crm-ai-widget so it
 * can never leak into (or be leaked into by) the host theme's CSS. Colors
 * come from a single CSS custom property (--adromax-ai-color) set inline by
 * crm-ai-chat-widget.js from the admin-configured brand color, so the rest
 * of this file never hardcodes the client's color choice.
 */
#adromax-crm-ai-widget {
	--adromax-ai-color: #0F75A1;
	/*
	 * The readable foreground for --adromax-ai-color, computed from it at
	 * runtime rather than assumed. Hard-coding #fff meant any client whose
	 * brand colour is light — a gold, a sand, a pale green — got white text
	 * on it, which on a real brand gold measures about 2:1 against a 4.5:1
	 * requirement. The brand colour is chosen by the site owner, so the
	 * contrast has to be derived, not hoped for.
	 */
	--adromax-ai-on-color: #fff;
	position: fixed;
	z-index: 999999;
	bottom: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#adromax-crm-ai-widget.adromax-ai-pos-right { right: 20px; }
#adromax-crm-ai-widget.adromax-ai-pos-left { left: 20px; }

#adromax-crm-ai-widget .adromax-ai-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--adromax-ai-color);
	color: var(--adromax-ai-on-color, #fff);
	border: none;
	font-size: 26px;
	line-height: 60px;
	text-align: center;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0,0,0,.2);
}

#adromax-crm-ai-widget .adromax-ai-panel {
	position: absolute;
	bottom: 72px;
	width: 340px;
	max-width: calc(100vw - 40px);
	height: 460px;
	max-height: 70vh;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 40px rgba(0,0,0,.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

#adromax-crm-ai-widget.adromax-ai-pos-right .adromax-ai-panel { right: 0; }
#adromax-crm-ai-widget.adromax-ai-pos-left .adromax-ai-panel { left: 0; }

#adromax-crm-ai-widget .adromax-ai-header {
	background: var(--adromax-ai-color);
	color: var(--adromax-ai-on-color, #fff);
	padding: 14px 16px;
	font-weight: 600;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

#adromax-crm-ai-widget .adromax-ai-header button {
	background: transparent;
	border: none;
	color: var(--adromax-ai-on-color, #fff);
	font-size: 20px;
	cursor: pointer;
	line-height: 1;
}

#adromax-crm-ai-widget .adromax-ai-messages {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #f5f9fa;
}

#adromax-crm-ai-widget .adromax-ai-msg {
	max-width: 85%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.4;
	white-space: pre-wrap;
	word-wrap: break-word;
}

#adromax-crm-ai-widget .adromax-ai-msg-assistant {
	background: #fff;
	border: 1px solid #dfe7eb;
	align-self: flex-start;
}

#adromax-crm-ai-widget .adromax-ai-msg-user {
	background: var(--adromax-ai-color);
	color: var(--adromax-ai-on-color, #fff);
	align-self: flex-end;
}

#adromax-crm-ai-widget .adromax-ai-precapture {
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: #fff;
}

#adromax-crm-ai-widget .adromax-ai-precapture input {
	padding: 8px 10px;
	border: 1px solid #d6dfe2;
	border-radius: 8px;
	font-size: 14px;
}

#adromax-crm-ai-widget .adromax-ai-precapture button,
#adromax-crm-ai-widget .adromax-ai-input-row button {
	background: var(--adromax-ai-color);
	color: var(--adromax-ai-on-color, #fff);
	border: none;
	border-radius: 8px;
	padding: 8px 14px;
	font-size: 14px;
	cursor: pointer;
}

#adromax-crm-ai-widget .adromax-ai-input-row {
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #dfe7eb;
	background: #fff;
}

#adromax-crm-ai-widget .adromax-ai-input-row input {
	flex: 1;
	padding: 8px 10px;
	border: 1px solid #d6dfe2;
	border-radius: 8px;
	font-size: 14px;
}

#adromax-crm-ai-widget .adromax-ai-typing {
	font-size: 13px;
	color: #888;
	font-style: italic;
	align-self: flex-start;
}

#adromax-crm-ai-widget[hidden],
#adromax-crm-ai-widget .adromax-ai-panel[hidden] {
	display: none !important;
}
