:root {
	--lgfc-cw-accent: #289ded;
	--lgfc-cw-accent-dark: #067aca;
	--lgfc-cw-warm: #fba000;
	--lgfc-cw-surface: #ffffff;
	--lgfc-cw-surface-alt: #f3f5f7;
	--lgfc-cw-text: #1c2430;
	--lgfc-cw-text-muted: #667085;
	--lgfc-cw-border: rgba(20, 25, 35, 0.1);
	--lgfc-cw-radius: 16px;
}

@media (prefers-color-scheme: dark) {
	.lgfc-cw:not([data-theme='light']) {
		--lgfc-cw-surface: #1a2028;
		--lgfc-cw-surface-alt: #232b35;
		--lgfc-cw-text: #eef1f5;
		--lgfc-cw-text-muted: #9aa4b2;
		--lgfc-cw-border: rgba(255, 255, 255, 0.12);
	}
}

.lgfc-cw,
.lgfc-cw * {
	box-sizing: border-box;
}

.lgfc-cw {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}

.lgfc-cw-bubble {
	height: 52px;
	padding: 0 20px 0 16px;
	border-radius: 999px;
	background: var(--lgfc-cw-accent);
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	transition: transform 160ms ease, box-shadow 160ms ease, padding 160ms ease, width 160ms ease;
	animation: lgfc-cw-bubble-in 420ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}
.lgfc-cw-bubble:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}
.lgfc-cw-bubble svg {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}
.lgfc-cw-bubble-label {
	overflow: hidden;
}

/* Once the panel is open, the bubble collapses to an icon-only circle —
   the panel header already carries the "LGFC Trip Assistant" label, so
   repeating it on the bubble is redundant and the circle is a clearer
   "close" affordance in that state. */
.lgfc-cw.is-open .lgfc-cw-bubble {
	width: 52px;
	padding: 0;
	justify-content: center;
	animation: none;
}
.lgfc-cw.is-open .lgfc-cw-bubble-label {
	display: none;
}

@keyframes lgfc-cw-bubble-in {
	from { transform: scale(0.6); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

.lgfc-cw-panel {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: min(360px, calc(100vw - 40px));
	height: min(520px, calc(100vh - 120px));
	background: var(--lgfc-cw-surface);
	color: var(--lgfc-cw-text);
	border-radius: var(--lgfc-cw-radius);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 160ms ease, transform 160ms ease;
}
.lgfc-cw.is-open .lgfc-cw-panel {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.lgfc-cw-header {
	background: var(--lgfc-cw-accent);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}
.lgfc-cw-header strong {
	display: block;
	font-size: 14px;
}
.lgfc-cw-header span {
	display: block;
	font-size: 12px;
	opacity: 0.85;
}
.lgfc-cw-close {
	background: rgba(255, 255, 255, 0.18);
	border: none;
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.lgfc-cw-messages {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: var(--lgfc-cw-surface-alt);
}

.lgfc-cw-msg {
	max-width: 85%;
	padding: 9px 12px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.lgfc-cw-msg.user {
	align-self: flex-end;
	background: var(--lgfc-cw-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.lgfc-cw-msg.assistant {
	align-self: flex-start;
	background: var(--lgfc-cw-surface);
	border: 1px solid var(--lgfc-cw-border);
	border-bottom-left-radius: 4px;
}
.lgfc-cw-msg.system {
	align-self: center;
	background: transparent;
	color: var(--lgfc-cw-text-muted);
	font-size: 12px;
	text-align: center;
	max-width: 100%;
}

.lgfc-cw-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 10px 12px;
	background: var(--lgfc-cw-surface);
	border: 1px solid var(--lgfc-cw-border);
	border-radius: 14px;
}
.lgfc-cw-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--lgfc-cw-text-muted);
	animation: lgfc-cw-bounce 1.2s infinite ease-in-out;
}
.lgfc-cw-typing span:nth-child(2) { animation-delay: 0.15s; }
.lgfc-cw-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes lgfc-cw-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

.lgfc-cw-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-self: flex-start;
	max-width: 100%;
}
.lgfc-cw-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	border-radius: 999px;
	border: 1px solid var(--lgfc-cw-border);
	background: var(--lgfc-cw-surface);
	color: var(--lgfc-cw-text);
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.lgfc-cw-action-btn.whatsapp { border-color: #25d366; color: #128c3e; }
.lgfc-cw-action-btn.call { border-color: var(--lgfc-cw-accent); color: var(--lgfc-cw-accent-dark); }

.lgfc-cw-lead-card {
	align-self: stretch;
	background: var(--lgfc-cw-surface);
	border: 1px solid var(--lgfc-cw-border);
	border-radius: 14px;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.lgfc-cw-lead-card p {
	margin: 0 0 2px;
	font-size: 12.5px;
	color: var(--lgfc-cw-text-muted);
}
.lgfc-cw-lead-card input {
	width: 100%;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid var(--lgfc-cw-border);
	background: var(--lgfc-cw-surface-alt);
	color: var(--lgfc-cw-text);
	font-size: 13px;
}
.lgfc-cw-lead-card .lgfc-cw-website-field {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.lgfc-cw-lead-card button {
	background: var(--lgfc-cw-warm);
	color: #241800;
	border: none;
	padding: 9px;
	border-radius: 8px;
	font-weight: 700;
	cursor: pointer;
}
.lgfc-cw-lead-card .lgfc-cw-lead-note {
	font-size: 11px;
	color: var(--lgfc-cw-text-muted);
}
.lgfc-cw-lead-card.done {
	align-items: center;
	text-align: center;
	color: var(--lgfc-cw-text-muted);
}

.lgfc-cw-inputbar {
	flex-shrink: 0;
	display: flex;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid var(--lgfc-cw-border);
	background: var(--lgfc-cw-surface);
}
.lgfc-cw-inputbar input {
	flex: 1;
	padding: 10px 12px;
	border-radius: 999px;
	border: 1px solid var(--lgfc-cw-border);
	background: var(--lgfc-cw-surface-alt);
	color: var(--lgfc-cw-text);
	font-size: 13.5px;
}
.lgfc-cw-inputbar input:focus-visible,
.lgfc-cw-bubble:focus-visible,
.lgfc-cw-close:focus-visible,
.lgfc-cw-send:focus-visible {
	outline: 3px solid var(--lgfc-cw-warm);
	outline-offset: 2px;
}
.lgfc-cw-send {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: var(--lgfc-cw-accent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.lgfc-cw-send:disabled {
	opacity: 0.5;
	cursor: default;
}

@media (max-width: 480px) {
	.lgfc-cw { right: 12px; bottom: 12px; }
	.lgfc-cw-panel { width: calc(100vw - 24px); }
}

@media (prefers-reduced-motion: reduce) {
	.lgfc-cw-panel, .lgfc-cw-bubble, .lgfc-cw-typing span {
		transition: none !important;
		animation: none !important;
	}
}
