/* LCW Support Agent v1.0.0 */
#lcwsa-root {
	--lcwsa-primary: #1f8a4c;
	--lcwsa-primary-dark: color-mix(in srgb, var(--lcwsa-primary) 78%, #000);
	--lcwsa-primary-soft: color-mix(in srgb, var(--lcwsa-primary) 10%, #fff);
	--lcwsa-text: #1d2724;
	--lcwsa-muted: #6b7672;
	--lcwsa-line: #e4e9e6;
	--lcwsa-bg: #f5f7f6;
	--lcwsa-shadow: 0 12px 40px rgba(16, 32, 24, .18), 0 2px 8px rgba(16, 32, 24, .08);
	--lcwsa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 2147483000;
	font-family: var(--lcwsa-font);
	font-size: 15px;
	line-height: 1.45;
	color: var(--lcwsa-text);
	-webkit-font-smoothing: antialiased;
}
#lcwsa-root.lcwsa-left { right: auto; left: 20px; }
#lcwsa-root *, #lcwsa-root *::before, #lcwsa-root *::after { box-sizing: border-box; }
#lcwsa-root button {
	font-family: inherit; font-size: inherit; line-height: inherit; letter-spacing: normal;
	text-transform: none; margin: 0; cursor: pointer; box-shadow: none; min-height: 0;
}
#lcwsa-root svg { display: block; }

/* ---------- Launcher ---------- */
#lcwsa-root .lcwsa-launcher {
	position: relative;
	width: 62px; height: 62px;
	border-radius: 50%;
	border: 0; padding: 0;
	background: var(--lcwsa-primary);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 20px color-mix(in srgb, var(--lcwsa-primary) 45%, transparent), 0 2px 6px rgba(0,0,0,.15);
	transition: transform .2s ease, background .2s ease;
	margin-left: auto;
}
#lcwsa-root.lcwsa-left .lcwsa-launcher { margin-left: 0; }
#lcwsa-root .lcwsa-launcher:hover { transform: scale(1.06); background: var(--lcwsa-primary-dark); }
#lcwsa-root .lcwsa-launcher:focus-visible { outline: 3px solid color-mix(in srgb, var(--lcwsa-primary) 40%, #fff); outline-offset: 3px; }
#lcwsa-root .lcwsa-launcher .lcwsa-ico { position: absolute; transition: transform .25s ease, opacity .2s ease; }
#lcwsa-root .lcwsa-launcher .lcwsa-ico-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
#lcwsa-root.lcwsa-open .lcwsa-launcher .lcwsa-ico-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
#lcwsa-root.lcwsa-open .lcwsa-launcher .lcwsa-ico-close { opacity: 1; transform: none; }
#lcwsa-root .lcwsa-launcher::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%;
	border: 2px solid var(--lcwsa-primary); opacity: 0;
	animation: lcwsa-pulse 2.4s ease-out 1s 3;
}
#lcwsa-root .lcwsa-badge {
	position: absolute; top: -3px; right: -3px;
	min-width: 22px; height: 22px; padding: 0 6px;
	border-radius: 11px; background: #e02424; color: #fff;
	font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
	border: 2px solid #fff;
	transition: transform .2s ease;
}
#lcwsa-root .lcwsa-badge[hidden] { display: none; }

/* ---------- Teaser (greeting + prompt bubbles) ---------- */
#lcwsa-root .lcwsa-teaser {
	position: absolute; bottom: 78px; right: 0;
	width: 300px;
	display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
	opacity: 0; transform: translateY(10px); pointer-events: none;
	transition: opacity .3s ease, transform .3s ease;
}
#lcwsa-root.lcwsa-left .lcwsa-teaser { right: auto; left: 0; align-items: flex-start; }
#lcwsa-root.lcwsa-teaser-on .lcwsa-teaser { opacity: 1; transform: none; pointer-events: auto; }
#lcwsa-root.lcwsa-open .lcwsa-teaser { opacity: 0; transform: translateY(10px); pointer-events: none; }
#lcwsa-root .lcwsa-greet {
	position: relative; align-self: stretch;
	background: #fff; color: var(--lcwsa-text);
	border-radius: 16px; padding: 16px 40px 16px 18px;
	box-shadow: var(--lcwsa-shadow);
	font-size: 16px; font-weight: 500;
	margin-bottom: 10px;
	cursor: pointer;
}
#lcwsa-root .lcwsa-greet-close {
	position: absolute; top: -10px; right: -8px;
	width: 26px; height: 26px; border-radius: 50%;
	border: 0; padding: 0;
	background: #fff; color: var(--lcwsa-muted);
	box-shadow: 0 2px 8px rgba(0,0,0,.18);
	display: flex; align-items: center; justify-content: center;
}
#lcwsa-root .lcwsa-greet-close:hover { color: var(--lcwsa-text); }
#lcwsa-root .lcwsa-pill {
	background: #fff; color: var(--lcwsa-primary);
	border: 1.5px solid var(--lcwsa-primary);
	border-radius: 10px;
	padding: 9px 16px;
	font-size: 15px; font-weight: 500; text-align: left;
	box-shadow: 0 3px 10px rgba(16,32,24,.10);
	transition: background .15s ease, color .15s ease, transform .15s ease;
	max-width: 100%;
}
#lcwsa-root .lcwsa-pill:hover, #lcwsa-root .lcwsa-pill:focus-visible { background: var(--lcwsa-primary); color: #fff; transform: translateY(-1px); outline: none; }
#lcwsa-root .lcwsa-teaser .lcwsa-pill { opacity: 0; transform: translateY(6px); animation: lcwsa-rise .35s ease forwards; }

/* ---------- Panel ---------- */
#lcwsa-root .lcwsa-panel {
	position: absolute; bottom: 78px; right: 0;
	width: 380px; height: 600px;
	max-height: calc(100vh - 110px);
	background: #fff;
	border-radius: 18px;
	box-shadow: var(--lcwsa-shadow);
	display: flex; flex-direction: column;
	overflow: hidden;
	opacity: 0; transform: translateY(16px) scale(.98); transform-origin: bottom right;
	pointer-events: none; visibility: hidden;
	transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s;
}
#lcwsa-root.lcwsa-left .lcwsa-panel { right: auto; left: 0; transform-origin: bottom left; }
#lcwsa-root.lcwsa-open .lcwsa-panel {
	opacity: 1; transform: none; pointer-events: auto; visibility: visible;
	transition: opacity .25s ease, transform .25s ease, visibility 0s;
}

#lcwsa-root .lcwsa-head {
	display: flex; align-items: center; gap: 12px;
	padding: 16px 16px 16px 18px;
	background: linear-gradient(135deg, var(--lcwsa-primary), var(--lcwsa-primary-dark));
	color: #fff;
	flex-shrink: 0;
}
#lcwsa-root .lcwsa-avatar {
	position: relative; flex-shrink: 0;
	width: 42px; height: 42px; border-radius: 50%;
	background: rgba(255,255,255,.18);
	display: flex; align-items: center; justify-content: center;
}
#lcwsa-root .lcwsa-avatar::after {
	content: ""; position: absolute; right: 0; bottom: 1px;
	width: 11px; height: 11px; border-radius: 50%;
	background: #4ade80; border: 2px solid var(--lcwsa-primary-dark);
}
#lcwsa-root .lcwsa-title { flex: 1; min-width: 0; }
#lcwsa-root .lcwsa-title strong { display: block; font-size: 16px; font-weight: 700; line-height: 1.2; color: #fff; }
#lcwsa-root .lcwsa-title span { display: block; font-size: 12.5px; opacity: .85; margin-top: 2px; }
#lcwsa-root .lcwsa-head-btn {
	width: 34px; height: 34px; border-radius: 50%;
	border: 0; padding: 0;
	background: transparent; color: #fff;
	display: flex; align-items: center; justify-content: center;
	transition: background .15s ease;
}
#lcwsa-root .lcwsa-head-btn:hover { background: rgba(255,255,255,.16); }

#lcwsa-root .lcwsa-body {
	flex: 1; overflow-y: auto; overscroll-behavior: contain;
	padding: 18px 16px 8px;
	background: var(--lcwsa-bg);
	scroll-behavior: smooth;
}
#lcwsa-root .lcwsa-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: flex-end; animation: lcwsa-rise .25s ease; }
#lcwsa-root .lcwsa-row.lcwsa-user { justify-content: flex-end; }
#lcwsa-root .lcwsa-mini {
	flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
	background: var(--lcwsa-primary); color: #fff;
	display: flex; align-items: center; justify-content: center;
}
#lcwsa-root .lcwsa-msg {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14.5px;
	word-wrap: break-word; overflow-wrap: anywhere;
}
#lcwsa-root .lcwsa-bot .lcwsa-msg { background: #fff; color: var(--lcwsa-text); border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(16,32,24,.08); }
#lcwsa-root .lcwsa-user .lcwsa-msg { background: var(--lcwsa-primary); color: #fff; border-bottom-right-radius: 5px; }
#lcwsa-root .lcwsa-msg p { margin: 0 0 8px; }
#lcwsa-root .lcwsa-msg p:last-child { margin-bottom: 0; }
#lcwsa-root .lcwsa-msg ul { margin: 4px 0 8px; padding-left: 18px; }
#lcwsa-root .lcwsa-msg li { margin: 2px 0; }
#lcwsa-root .lcwsa-msg a { color: var(--lcwsa-primary-dark); text-decoration: underline; font-weight: 500; word-break: normal; overflow-wrap: anywhere; }
#lcwsa-root .lcwsa-msg a[href^="tel:"], #lcwsa-root .lcwsa-msg a[href^="mailto:"] { white-space: nowrap; }
#lcwsa-root .lcwsa-user .lcwsa-msg a { color: #fff; }
#lcwsa-root .lcwsa-msg strong { font-weight: 700; }

#lcwsa-root .lcwsa-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px 36px; }
#lcwsa-root .lcwsa-quick .lcwsa-pill { padding: 7px 12px; font-size: 13.5px; border-radius: 18px; box-shadow: none; }

#lcwsa-root .lcwsa-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
#lcwsa-root .lcwsa-typing i {
	width: 7px; height: 7px; border-radius: 50%; background: #9aa5a0;
	animation: lcwsa-bounce 1.2s infinite ease-in-out;
}
#lcwsa-root .lcwsa-typing i:nth-child(2) { animation-delay: .15s; }
#lcwsa-root .lcwsa-typing i:nth-child(3) { animation-delay: .3s; }

#lcwsa-root .lcwsa-form {
	display: flex; align-items: flex-end; gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--lcwsa-line);
	background: #fff;
	flex-shrink: 0;
}
#lcwsa-root .lcwsa-input {
	flex: 1;
	resize: none;
	border: 1px solid var(--lcwsa-line) !important;
	border-radius: 12px !important;
	padding: 10px 12px !important;
	font: inherit; font-size: 15px !important; line-height: 1.4;
	color: var(--lcwsa-text) !important;
	background: var(--lcwsa-bg) !important;
	max-height: 110px; min-height: 42px; height: 42px;
	outline: none; box-shadow: none !important; margin: 0 !important;
	width: auto;
}
#lcwsa-root .lcwsa-input:focus { border-color: var(--lcwsa-primary) !important; background: #fff !important; }
#lcwsa-root .lcwsa-send {
	flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px;
	border: 0; padding: 0;
	background: var(--lcwsa-primary); color: #fff;
	display: flex; align-items: center; justify-content: center;
	transition: background .15s ease, opacity .15s ease;
}
#lcwsa-root .lcwsa-send:hover { background: var(--lcwsa-primary-dark); }
#lcwsa-root .lcwsa-send:disabled { opacity: .45; cursor: not-allowed; }

#lcwsa-root .lcwsa-foot {
	display: flex; justify-content: center; gap: 14px;
	padding: 0 12px 10px; background: #fff;
	font-size: 12px; color: var(--lcwsa-muted);
	flex-shrink: 0;
}
#lcwsa-root .lcwsa-foot a { color: var(--lcwsa-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
#lcwsa-root .lcwsa-foot a:hover { color: var(--lcwsa-primary); }

@keyframes lcwsa-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes lcwsa-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
@keyframes lcwsa-pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.5); opacity: 0; } }

/* ---------- Mobile ---------- */
@media (max-width: 520px) {
	#lcwsa-root { bottom: 16px; right: 16px; }
	#lcwsa-root.lcwsa-left { left: 16px; }
	#lcwsa-root .lcwsa-teaser { width: calc(100vw - 32px); max-width: 300px; }
	#lcwsa-root.lcwsa-open .lcwsa-launcher { display: none; }
	#lcwsa-root .lcwsa-panel {
		position: fixed; inset: 0; width: 100%; height: 100%;
		max-height: none; border-radius: 0;
	}
	#lcwsa-root .lcwsa-input { font-size: 16px !important; }
}
#lcwsa-root.lcwsa-hide-mobile { display: none; }
@media (min-width: 521px) { #lcwsa-root.lcwsa-hide-mobile { display: block; } }

@media (prefers-reduced-motion: reduce) {
	#lcwsa-root *, #lcwsa-root *::after { animation: none !important; transition: none !important; }
	#lcwsa-root .lcwsa-teaser .lcwsa-pill { opacity: 1; transform: none; }
}
