/* Chatbot WP Frontend Stylesheet */

#local-ai-widget-container {
	position: fixed;
	z-index: 999990;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
	font-size: var(--chatbot-font-size, 14px);
}

#local-ai-widget-container * {
	box-sizing: border-box;
}

.local-ai-pos-bottom-right {
	bottom: var(--chatbot-offset-bottom, 24px);
	right: var(--chatbot-offset-side, 24px);
}

.local-ai-pos-bottom-left {
	bottom: var(--chatbot-offset-bottom, 24px);
	left: var(--chatbot-offset-side, 24px);
}

.local-ai-launcher-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}

.local-ai-pos-bottom-left .local-ai-launcher-wrap {
	flex-direction: row-reverse;
}

/* Callout Tooltip Badge */
.local-ai-callout-badge {
	background: #ffffff;
	color: #1e293b;
	padding: 8px 14px;
	border-radius: 20px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
	font-size: 12.5px;
	font-weight: 600;
	border: 1px solid #e2e8f0;
	white-space: nowrap;
	animation: badgeFloat 3s infinite ease-in-out;
}

@keyframes badgeFloat {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-4px); }
}

/* Floating Launcher Button */
#local-ai-launcher-btn {
	width: var(--chatbot-launcher-size, 60px);
	height: var(--chatbot-launcher-size, 60px);
	border-radius: 50%;
	background: var(--chatbot-launcher-bg, #2563eb);
	color: var(--chatbot-launcher-icon, #ffffff);
	border: none;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
	outline: none;
}

#local-ai-launcher-btn:hover {
	transform: scale(1.08);
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.28);
}

.local-ai-launcher-icon {
	display: flex;
	align-items: center;
	justify-content: center;
}

.local-ai-icon-close {
	display: none;
}

#local-ai-widget-container.is-active .local-ai-icon-open {
	display: none;
}

#local-ai-widget-container.is-active .local-ai-icon-close {
	display: flex;
}

#local-ai-widget-container.is-active .local-ai-callout-badge {
	display: none;
}

/* Chat Window Box */
#local-ai-chat-window {
	position: absolute;
	bottom: calc(var(--chatbot-launcher-size, 60px) + 15px);
	width: var(--chatbot-width, 380px);
	height: var(--chatbot-height, 580px);
	max-height: calc(100vh - 100px);
	background: #ffffff;
	border-radius: var(--chatbot-radius, 16px);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid #e2e8f0;
	transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
	transform-origin: bottom right;
}

.local-ai-pos-bottom-left #local-ai-chat-window {
	left: 0;
	transform-origin: bottom left;
}

.local-ai-pos-bottom-right #local-ai-chat-window {
	right: 0;
	transform-origin: bottom right;
}

#local-ai-chat-window.local-ai-hidden {
	opacity: 0;
	pointer-events: none;
	transform: translateY(20px) scale(0.95);
	visibility: hidden;
}

/* Header */
#local-ai-header {
	background: var(--chatbot-header-bg, #2563eb);
	color: var(--chatbot-header-text, #ffffff);
	padding: 14px 18px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.local-ai-header-profile {
	display: flex;
	align-items: center;
	gap: 12px;
}

.local-ai-avatar-img {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid rgba(255, 255, 255, 0.8);
}

.local-ai-avatar-default {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
}

.local-ai-header-name {
	font-weight: 700;
	font-size: 15px;
	line-height: 1.2;
}

.local-ai-header-status {
	font-size: 11px;
	opacity: 0.9;
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 2px;
}

.local-ai-status-dot {
	width: 7px;
	height: 7px;
	background: #10b981;
	border-radius: 50%;
	display: inline-block;
}

.local-ai-header-actions {
	display: flex;
	gap: 8px;
}

.local-ai-header-actions button {
	background: transparent;
	border: none;
	color: var(--chatbot-header-text, #ffffff);
	cursor: pointer;
	opacity: 0.8;
	padding: 4px;
	border-radius: 4px;
	transition: opacity 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.local-ai-header-actions button:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.15);
}

/* Messages Container */
#local-ai-messages-wrap {
	flex: 1;
	padding: 16px;
	overflow-y: auto;
	background: var(--chatbot-body-bg, #f8fafc);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

#local-ai-messages-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* Message Bubbles */
.local-ai-msg {
	max-width: 85%;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.45;
	word-wrap: break-word;
}

.local-ai-msg-user {
	align-self: flex-end;
	background: var(--chatbot-user-msg-bg, #2563eb);
	color: var(--chatbot-user-msg-text, #ffffff);
	border-bottom-right-radius: 2px;
}

.local-ai-msg-bot {
	align-self: flex-start;
	background: var(--chatbot-bot-msg-bg, #ffffff);
	color: var(--chatbot-bot-msg-text, #1e293b);
	border: 1px solid #e2e8f0;
	border-bottom-left-radius: 2px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.local-ai-sources-pill {
	margin-top: 8px;
	padding-top: 6px;
	border-top: 1px dashed #e2e8f0;
	font-size: 11px;
	color: #64748b;
}

.local-ai-sources-pill a {
	color: var(--chatbot-header-bg, #2563eb);
	text-decoration: none;
	font-weight: 500;
}

/* Typing indicator */
.local-ai-typing {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 10px 14px;
	background: var(--chatbot-bot-msg-bg, #ffffff);
	border: 1px solid #e2e8f0;
	border-radius: 14px;
	width: fit-content;
}

.local-ai-typing span {
	width: 6px;
	height: 6px;
	background: #94a3b8;
	border-radius: 50%;
	animation: localAiPulse 1.2s infinite ease-in-out;
}

.local-ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.local-ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes localAiPulse {
	0%, 80%, 100% { transform: scale(0); }
	40% { transform: scale(1); }
}

/* Suggested Question Chips */
#local-ai-suggestions-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.local-ai-chip {
	background: #ffffff;
	color: var(--chatbot-header-bg, #2563eb);
	border: 1px solid #bfdbfe;
	padding: 6px 12px;
	border-radius: 12px;
	font-size: 11.5px;
	cursor: pointer;
	transition: all 0.15s;
}

.local-ai-chip:hover {
	background: #eff6ff;
	border-color: var(--chatbot-header-bg, #2563eb);
}

/* Input Area */
#local-ai-input-wrap {
	padding: 12px;
	background: #ffffff;
	border-top: 1px solid #e2e8f0;
	display: flex;
	gap: 8px;
	align-items: center;
}

#local-ai-user-input {
	flex: 1;
	border: 1px solid #cbd5e1;
	border-radius: 10px;
	padding: 8px 12px;
	font-size: 13.5px;
	resize: none;
	max-height: 80px;
	outline: none;
	font-family: inherit;
	color: #1e293b;
}

#local-ai-user-input:focus {
	border-color: var(--chatbot-header-bg, #2563eb);
}

#local-ai-send-btn {
	background: var(--chatbot-header-bg, #2563eb);
	color: var(--chatbot-header-text, #ffffff);
	border: none;
	border-radius: 10px;
	width: 38px;
	height: 38px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s;
}

#local-ai-send-btn:hover {
	opacity: 0.9;
}

/* Branding footer */
#local-ai-branding {
	text-align: center;
	font-size: 10.5px;
	color: #94a3b8;
	padding: 6px 0;
	background: #f8fafc;
	border-top: 1px solid #f1f5f9;
}

#local-ai-branding a {
	color: #64748b;
	text-decoration: underline;
}

/* Lead Drawer */
#local-ai-lead-drawer {
	background: #ffffff;
	border-top: 2px solid var(--chatbot-header-bg, #2563eb);
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}

#local-ai-lead-drawer.local-ai-lead-hidden {
	display: none;
}

.local-ai-lead-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.local-ai-lead-header h4 {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
}

#local-ai-lead-close {
	background: none;
	border: none;
	font-size: 18px;
	cursor: pointer;
	color: #64748b;
}

.local-ai-lead-desc {
	margin: 0;
	font-size: 12px;
	color: #64748b;
}

#local-ai-lead-form {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 4px;
}

#local-ai-lead-form input {
	padding: 7px 10px;
	border: 1px solid #cbd5e1;
	border-radius: 6px;
	font-size: 12px;
}

#local-ai-lead-submit {
	background: var(--chatbot-header-bg, #2563eb);
	color: var(--chatbot-header-text, #ffffff);
	border: none;
	border-radius: 6px;
	padding: 8px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}

/* Mobile full responsiveness */
@media (max-width: 480px) {
	#local-ai-chat-window {
		width: 100vw;
		height: 100vh;
		max-height: 100vh;
		bottom: 0;
		right: 0;
		left: 0;
		border-radius: 0;
	}
	.local-ai-pos-bottom-right, .local-ai-pos-bottom-left {
		bottom: 12px;
		right: 12px;
	}
}