/**
 * Lime Technologies — AI Chat Assistant Styles
 *
 * Scoped, production-grade styles for Lime AI conversational assistant.
 * Desktop floating modal + mobile full-sheet view.
 * Zero dependency on external UI frameworks.
 *
 * @package Lime_Technologies
 */

:root {
	--lime-chat-bg: #080d0a;
	--lime-chat-surface: #0e1511;
	--lime-chat-surface-hover: #152219;
	--lime-chat-surface-card: #121c15;
	--lime-chat-border: rgba(255, 255, 255, 0.12);
	--lime-chat-border-accent: rgba(138, 232, 28, 0.35);
	--lime-chat-electric: #8ae81c;
	--lime-chat-text: #f0f4f1;
	--lime-chat-text-muted: rgba(240, 244, 241, 0.65);
	--lime-chat-text-dim: rgba(240, 244, 241, 0.45);
	--lime-chat-user-bg: #132417;
	--lime-chat-user-border: rgba(138, 232, 28, 0.28);
	--lime-chat-whatsapp: #25d366;
	--lime-chat-whatsapp-hover: #20ba59;
}

/* ==================================================
   Floating Launcher Button
   ================================================== */
.lime-chat-launcher {
	background-color: #14832f;
	color: #ffffff !important;
	border: 1px solid rgba(255, 255, 255, 0.25);
	width: auto;
	height: 48px;
	padding: 0 18px 0 14px;
	border-radius: 24px;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 2px 12px rgba(20, 131, 47, 0.4);
	cursor: pointer;
	text-decoration: none;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
	transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
	pointer-events: auto;
}

.lime-chat-launcher:hover {
	background-color: #106f27;
	border-color: rgba(255, 255, 255, 0.4);
	transform: translateY(-2px);
	box-shadow: 0 6px 24px rgba(20, 131, 47, 0.55);
}

.lime-chat-launcher:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 3px;
}

.lime-chat-launcher-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
}

.lime-chat-launcher-icon svg {
	width: 20px;
	height: 20px;
	display: block;
	stroke: currentColor;
}

.lime-chat-launcher-text {
	color: #ffffff !important;
	white-space: nowrap;
}

/* ==================================================
   Chat Panel Container (Desktop)
   ================================================== */
.lime-chat-backdrop {
	display: none;
}

.lime-chat-panel {
	position: fixed;
	bottom: 86px;
	right: 28px;
	width: 400px;
	max-width: calc(100vw - 36px);
	height: 620px;
	max-height: calc(100vh - 110px);
	background: var(--lime-chat-bg);
	border: 1px solid var(--lime-chat-border);
	border-radius: 16px;
	box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
	z-index: 1000;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(14px) scale(0.98);
	transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
}

.lime-chat-panel.lime-chat-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0) scale(1);
}

/* ==================================================
   Chat Header
   ================================================== */
.lime-chat-header {
	padding: 14px 18px;
	background: var(--lime-chat-surface);
	border-bottom: 1px solid var(--lime-chat-border);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.lime-chat-header-brand {
	display: flex;
	align-items: center;
	gap: 12px;
}

.lime-chat-avatar {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: var(--lime-chat-user-bg);
	border: 1px solid var(--lime-chat-border-accent);
	color: var(--lime-chat-electric);
	display: flex;
	align-items: center;
	justify-content: center;
}

.lime-chat-avatar svg {
	width: 18px;
	height: 18px;
	display: block;
}

.lime-chat-title-group {
	display: flex;
	flex-direction: column;
}

.lime-chat-title {
	font-size: 15px;
	font-weight: 700;
	color: var(--lime-chat-text);
	line-height: 1.2;
}

.lime-chat-subtitle {
	font-size: 11.5px;
	color: var(--lime-chat-text-muted);
	line-height: 1.3;
	margin-top: 2px;
}

.lime-chat-close-btn {
	background: transparent;
	border: none;
	color: var(--lime-chat-text-muted);
	width: 32px;
	height: 32px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.lime-chat-close-btn:hover {
	background: var(--lime-chat-surface-hover);
	color: var(--lime-chat-text);
}

.lime-chat-close-btn:focus-visible {
	outline: 2px solid var(--lime-chat-electric);
}

/* ==================================================
   Messages Area
   ================================================== */
.lime-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	overscroll-behavior: contain;
}

.lime-chat-msg-row {
	display: flex;
	flex-direction: column;
	max-width: 88%;
}

.lime-chat-msg-row--ai {
	align-self: flex-start;
}

.lime-chat-msg-row--user {
	align-self: flex-end;
}

.lime-chat-bubble {
	padding: 13px 16px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.6;
	word-break: break-word;
}

.lime-chat-msg-row--ai .lime-chat-bubble {
	background: #121d16;
	color: #f5f8f6 !important;
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-top-left-radius: 4px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.lime-chat-msg-row--user .lime-chat-bubble {
	background: #182e1d;
	color: #ffffff !important;
	border: 1px solid rgba(138, 232, 28, 0.35);
	border-top-right-radius: 4px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Markdown and list styling inside message bubble */
.lime-chat-bubble p {
	margin: 0 0 8px 0;
	color: inherit !important;
	font-size: 14px;
	line-height: 1.6;
}
.lime-chat-bubble p:last-child {
	margin-bottom: 0;
}
.lime-chat-bubble strong {
	color: #ffffff !important;
	font-weight: 700;
}
.lime-chat-bubble ol,
.lime-chat-bubble ul {
	margin: 6px 0 6px 18px;
	padding: 0;
	color: inherit !important;
}
.lime-chat-bubble li {
	margin-bottom: 4px;
	color: inherit !important;
	line-height: 1.55;
}

/* ==================================================
   Source Links UI
   ================================================== */
.lime-chat-sources {
	margin-top: 8px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.lime-chat-source-tag {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: var(--lime-chat-surface-card);
	border: 1px solid var(--lime-chat-border);
	color: var(--lime-chat-electric);
	font-size: 11px;
	font-weight: 500;
	padding: 3px 8px;
	border-radius: 6px;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lime-chat-source-tag:hover {
	background: var(--lime-chat-surface-hover);
	border-color: var(--lime-chat-electric);
	color: #ffffff;
}

/* ==================================================
   In-Chat WhatsApp & Human Handoff Card
   ================================================== */
.lime-chat-handoff-card {
	margin-top: 10px;
	background: var(--lime-chat-surface-card);
	border: 1px solid rgba(37, 211, 102, 0.35);
	border-radius: 12px;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.lime-chat-handoff-header {
	font-size: 12px;
	font-weight: 600;
	color: var(--lime-chat-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.lime-chat-whatsapp-btn {
	background: var(--lime-chat-whatsapp);
	color: #ffffff;
	border: none;
	border-radius: 8px;
	padding: 10px 14px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 13.5px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.lime-chat-whatsapp-btn:hover {
	background: var(--lime-chat-whatsapp-hover);
	transform: translateY(-1px);
}

.lime-chat-whatsapp-btn svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
	display: block;
}

.lime-chat-handoff-secondary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 11.5px;
	color: var(--lime-chat-text-muted);
	padding-top: 4px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lime-chat-handoff-secondary a {
	color: var(--lime-chat-text-muted);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.lime-chat-handoff-secondary a:hover {
	color: var(--lime-chat-text);
}

/* ==================================================
   Quick Actions Container
   ================================================== */
.lime-chat-quick-actions {
	padding: 8px 16px 12px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	background: var(--lime-chat-bg);
	border-top: 1px solid rgba(255, 255, 255, 0.06);
	flex-shrink: 0;
}

.lime-chat-action-pill {
	background: var(--lime-chat-surface);
	border: 1px solid var(--lime-chat-border);
	color: var(--lime-chat-text);
	font-size: 12px;
	font-weight: 500;
	padding: 6px 11px;
	border-radius: 20px;
	cursor: pointer;
	font-family: inherit;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.lime-chat-action-pill:hover {
	background: var(--lime-chat-surface-hover);
	border-color: var(--lime-chat-electric);
	color: var(--lime-chat-electric);
}

.lime-chat-action-pill:focus-visible {
	outline: 2px solid var(--lime-chat-electric);
}

/* ==================================================
   Structured "Start a Project" Flow in Panel
   ================================================== */
.lime-chat-lead-flow {
	background: var(--lime-chat-surface);
	border: 1px solid var(--lime-chat-border);
	border-radius: 12px;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-top: 6px;
}

.lime-chat-lead-flow-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--lime-chat-text);
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.lime-chat-lead-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.lime-chat-lead-field label {
	font-size: 11.5px;
	font-weight: 600;
	color: var(--lime-chat-text-muted);
}

.lime-chat-lead-field label span.req {
	color: var(--lime-chat-electric);
}

.lime-chat-lead-field input,
.lime-chat-lead-field select,
.lime-chat-lead-field textarea {
	background: var(--lime-chat-bg);
	border: 1px solid var(--lime-chat-border);
	border-radius: 8px;
	padding: 8px 10px;
	font-size: 13px;
	color: var(--lime-chat-text);
	font-family: inherit;
	outline: none;
	transition: border-color 0.15s ease;
}

.lime-chat-lead-field input:focus,
.lime-chat-lead-field select:focus,
.lime-chat-lead-field textarea:focus {
	border-color: var(--lime-chat-electric);
}

.lime-chat-lead-field textarea {
	min-height: 64px;
	resize: vertical;
}

.lime-chat-lead-confirm-box {
	background: var(--lime-chat-surface-card);
	border: 1px solid var(--lime-chat-border);
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 12px;
	color: var(--lime-chat-text-muted);
	line-height: 1.45;
}

.lime-chat-lead-buttons {
	display: flex;
	gap: 8px;
	margin-top: 4px;
}

.lime-chat-lead-submit-btn {
	flex: 1;
	background: var(--lime-chat-electric);
	color: #080d0a;
	border: none;
	border-radius: 8px;
	padding: 9px 12px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.lime-chat-lead-submit-btn:hover {
	background: #9cf030;
}

.lime-chat-lead-cancel-btn {
	background: transparent;
	color: var(--lime-chat-text-muted);
	border: 1px solid var(--lime-chat-border);
	border-radius: 8px;
	padding: 9px 12px;
	font-size: 12.5px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.lime-chat-lead-cancel-btn:hover {
	background: var(--lime-chat-surface-hover);
	color: var(--lime-chat-text);
}

/* ==================================================
   Thinking / Loading Indicator
   ================================================== */
.lime-chat-thinking {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 12px;
	color: var(--lime-chat-text-muted);
	font-size: 12.5px;
}

.lime-chat-thinking-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--lime-chat-electric);
	opacity: 0.6;
	animation: limeDotPulse 1.4s infinite ease-in-out both;
}

.lime-chat-thinking-dot:nth-child(1) { animation-delay: -0.32s; }
.lime-chat-thinking-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes limeDotPulse {
	0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
	40% { transform: scale(1.1); opacity: 1; }
}

/* ==================================================
   Composer Input Area
   ================================================== */
.lime-chat-composer-wrap {
	padding: 10px 16px 8px;
	background: var(--lime-chat-bg);
	border-top: 1px solid var(--lime-chat-border);
	flex-shrink: 0;
}

.lime-chat-composer-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	background: var(--lime-chat-surface);
	border: 1px solid var(--lime-chat-border);
	border-radius: 12px;
	padding: 6px 8px 6px 12px;
	transition: border-color 0.15s ease;
}

.lime-chat-composer-form:focus-within {
	border-color: var(--lime-chat-electric);
}

.lime-chat-input {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	color: var(--lime-chat-text);
	font-size: 13.5px;
	font-family: inherit;
	line-height: 1.4;
	resize: none;
	max-height: 84px;
	padding: 4px 0;
}

.lime-chat-input::placeholder {
	color: var(--lime-chat-text-dim);
}

.lime-chat-send-btn {
	background: var(--lime-chat-electric);
	color: #080d0a;
	border: none;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: background-color 0.15s ease, transform 0.1s ease;
}

.lime-chat-send-btn:hover:not(:disabled) {
	background: #9cf030;
	transform: scale(1.05);
}

.lime-chat-send-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.lime-chat-send-btn svg {
	width: 16px;
	height: 16px;
	display: block;
}

/* Privacy Notice in Panel */
.lime-chat-privacy {
	padding: 6px 16px 10px;
	background: var(--lime-chat-bg);
	font-size: 12.5px;
	color: rgba(240, 244, 241, 0.78);
	line-height: 1.45;
	text-align: center;
	flex-shrink: 0;
}

.lime-chat-privacy a {
	color: #00FF66;
	text-decoration: underline;
	font-weight: 500;
}

.lime-chat-privacy a:hover {
	color: #ffffff;
}

/* ==================================================
   Mobile Responsive Adjustments
   ================================================== */
@media (max-width: 768px) {
	.lime-chat-panel {
		bottom: 80px;
		right: 18px;
		width: 380px;
	}
}

@media (max-width: 480px) {
	.lime-chat-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.65);
		backdrop-filter: blur(4px);
		-webkit-backdrop-filter: blur(4px);
		z-index: 994;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transition: opacity 0.22s ease, visibility 0.22s;
	}

	.lime-chat-backdrop.lime-chat-open {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	.lime-chat-panel {
		top: 72px;
		bottom: 12px;
		left: 10px;
		right: 10px;
		width: auto;
		max-width: none;
		height: auto;
		max-height: none;
		border-radius: 16px;
		z-index: 995;
		transform: translateY(20px);
	}

	.lime-chat-panel.lime-chat-open {
		transform: translateY(0);
	}

	.lime-chat-launcher {
		height: 44px;
		padding: 0 14px 0 12px;
		font-size: 13px;
	}

	.lime-chat-launcher-text {
		font-size: 13px;
	}

	.lime-chat-privacy {
		font-size: 12.5px;
		line-height: 1.45;
		padding: 5px 12px 8px;
	}
}

/* Very narrow devices (360px) */
@media (max-width: 375px) {
	.lime-chat-launcher {
		padding: 0 12px 0 10px;
		font-size: 12.5px;
		gap: 6px;
	}

	.lime-chat-privacy {
		font-size: 12px;
		line-height: 1.4;
		padding: 4px 10px 8px;
	}
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.lime-chat-panel,
	.lime-chat-launcher,
	.lime-chat-backdrop,
	.lime-chat-thinking-dot {
		transition: none !important;
		transform: none !important;
		animation: none !important;
	}
}
