/* Live Chat visitor widget. Colors come from settings as CSS variables. */

.lc-root {
	--lc-primary: #2563eb;
	--lc-primary-hover: #1f54c8;
	--lc-primary-text: #fff;
	--lc-reply-bg: #f1f5f9;
	--lc-reply-text: #0f172a;
	--lc-surface: #fff;
	--lc-text: #1e293b;
	--lc-muted: #64748b;
	--lc-border: #e2e8f0;
	--lc-error: #b91c1c;

	position: fixed;
	bottom: 20px;
	z-index: 2147483000;
	font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--lc-text);
	text-align: left;
}

.lc-root.lc-pos-right { right: 20px; }
.lc-root.lc-pos-left { left: 20px; }

.lc-root *,
.lc-root *::before,
.lc-root *::after {
	box-sizing: border-box;
}

.lc-root [hidden] {
	display: none !important;
}

.lc-root button {
	font: inherit;
	margin: 0;
	cursor: pointer;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
}

/* Launcher button ------------------------------------------------------- */

.lc-root .lc-launcher {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--lc-primary);
	color: var(--lc-primary-text);
	box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
	transition: transform 0.15s ease;
}

.lc-root .lc-launcher:hover { transform: scale(1.05); }

.lc-root .lc-launcher:focus-visible,
.lc-root .lc-panel button:focus-visible {
	outline: 3px solid var(--lc-primary);
	outline-offset: 3px;
}

.lc-root .lc-launcher svg { width: 28px; height: 28px; }
.lc-root .lc-icon-close { display: none; }
.lc-root.lc-is-open .lc-icon-chat { display: none; }
.lc-root.lc-is-open .lc-icon-close { display: block; }

.lc-root .lc-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 11px;
	background: #dc2626;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
}

/* Panel ----------------------------------------------------------------- */

.lc-root .lc-panel {
	position: absolute;
	bottom: 76px;
	display: flex;
	flex-direction: column;
	width: 360px;
	height: min(540px, calc(100vh - 120px));
	overflow: hidden;
	border-radius: 14px;
	background: var(--lc-surface);
	box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
}

.lc-root.lc-pos-right .lc-panel { right: 0; }
.lc-root.lc-pos-left .lc-panel { left: 0; }

.lc-root .lc-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 12px 14px 16px;
	background: var(--lc-primary);
	color: var(--lc-primary-text);
}

.lc-root .lc-dot {
	flex: none;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #94a3b8;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.lc-root.lc-is-online .lc-dot { background: #22c55e; }

.lc-root .lc-title {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	font-weight: 600;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.lc-root .lc-end {
	padding: 4px 10px;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font-size: 12px;
	opacity: 0.9;
}

.lc-root .lc-end.lc-confirming {
	background: var(--lc-primary-text);
	color: var(--lc-primary);
	opacity: 1;
}

.lc-root .lc-min {
	display: flex;
	padding: 4px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
}

.lc-root .lc-min svg { width: 22px; height: 22px; }

.lc-root .lc-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
}

/* Pre-chat form --------------------------------------------------------- */

.lc-root .lc-intro {
	margin: 0 0 14px;
	white-space: pre-line;
}

.lc-root .lc-field {
	display: block;
	margin: 0 0 12px;
}

.lc-root .lc-field span {
	display: block;
	margin-bottom: 4px;
	font-size: 13px;
	font-weight: 600;
}

.lc-root .lc-field em {
	color: var(--lc-muted);
	font-style: normal;
	font-weight: 400;
}

.lc-root .lc-field input,
.lc-root .lc-field textarea,
.lc-root .lc-composer textarea {
	display: block;
	width: 100%;
	margin: 0;
	padding: 9px 11px;
	border: 1px solid var(--lc-border);
	border-radius: 8px;
	background: #fff;
	color: var(--lc-text);
	font: inherit;
	box-shadow: none;
}

.lc-root .lc-field textarea { resize: vertical; }

.lc-root .lc-field input:focus,
.lc-root .lc-field textarea:focus,
.lc-root .lc-composer textarea:focus {
	border-color: var(--lc-primary);
	outline: 2px solid var(--lc-primary);
	outline-offset: -1px;
}

.lc-root .lc-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.lc-root .lc-submit,
.lc-root .lc-new {
	width: 100%;
	padding: 11px;
	border: 0;
	border-radius: 8px;
	background: var(--lc-primary);
	color: var(--lc-primary-text);
	font-weight: 600;
}

.lc-root .lc-submit:disabled { opacity: 0.6; cursor: default; }

.lc-root .lc-error {
	margin: 0 0 12px;
	color: var(--lc-error);
	font-size: 13px;
}

.lc-root .lc-composer-error { margin: 0; padding: 0 16px 8px; }

.lc-root .lc-privacy {
	margin: 12px 0 0;
	color: var(--lc-muted);
	font-size: 12px;
}

.lc-root .lc-privacy a { color: inherit; text-decoration: underline; }

/* Messages -------------------------------------------------------------- */

.lc-root .lc-messages {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.lc-root .lc-msg {
	display: flex;
	flex-direction: column;
	max-width: 85%;
}

.lc-root .lc-msg-visitor { align-self: flex-end; align-items: flex-end; }
.lc-root .lc-msg-operator { align-self: flex-start; align-items: flex-start; }

.lc-root .lc-msg-system {
	align-self: center;
	max-width: 95%;
	color: var(--lc-muted);
	font-size: 13px;
	text-align: center;
}

.lc-root .lc-msg-author {
	margin: 0 0 2px 4px;
	color: var(--lc-muted);
	font-size: 12px;
}

.lc-root .lc-bubble {
	padding: 8px 12px;
	border-radius: 14px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.lc-root .lc-msg-visitor .lc-bubble {
	border-bottom-right-radius: 4px;
	background: var(--lc-primary);
	color: var(--lc-primary-text);
}

.lc-root .lc-msg-operator .lc-bubble {
	border-bottom-left-radius: 4px;
	background: var(--lc-reply-bg);
	color: var(--lc-reply-text);
}

.lc-root .lc-msg-system .lc-bubble { padding: 4px 8px; }

.lc-root .lc-ended {
	margin-top: 16px;
	color: var(--lc-muted);
	text-align: center;
}

.lc-root .lc-ended p { margin: 0 0 10px; }

/* Composer -------------------------------------------------------------- */

.lc-root .lc-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	margin: 0;
	padding: 10px 12px;
	border-top: 1px solid var(--lc-border);
}

.lc-root .lc-composer textarea {
	flex: 1;
	min-height: 40px;
	max-height: 120px;
	resize: none;
}

.lc-root .lc-composer button {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--lc-primary);
	color: var(--lc-primary-text);
}

.lc-root .lc-composer svg { width: 20px; height: 20px; }

/* Hover states ---------------------------------------------------------- */

/* The #lc-root ID outranks theme button:hover rules, which would otherwise
   swap in the theme's own colors. */
#lc-root .lc-launcher:hover,
#lc-root .lc-launcher:focus,
#lc-root .lc-submit:hover:not(:disabled),
#lc-root .lc-submit:focus,
#lc-root .lc-new:hover,
#lc-root .lc-new:focus,
#lc-root .lc-composer button:hover,
#lc-root .lc-composer button:focus {
	border: 0;
	background: var(--lc-primary-hover);
	color: var(--lc-primary-text);
	text-decoration: none;
	box-shadow: none;
}

#lc-root .lc-launcher:hover,
#lc-root .lc-launcher:focus {
	box-shadow: 0 6px 20px rgba(15, 23, 42, 0.25);
}

#lc-root .lc-min:hover,
#lc-root .lc-min:focus,
#lc-root .lc-end:not(.lc-confirming):hover,
#lc-root .lc-end:not(.lc-confirming):focus {
	background: var(--lc-primary-hover);
	color: var(--lc-primary-text);
	text-decoration: none;
	box-shadow: none;
}

#lc-root .lc-end:not(.lc-confirming):hover,
#lc-root .lc-end:not(.lc-confirming):focus {
	border: 1px solid currentColor;
}

/* Small screens --------------------------------------------------------- */

@media (max-width: 600px) {
	.lc-root.lc-hide-mobile { display: none; }
}

@media (max-width: 480px) {
	.lc-root { bottom: 16px; }
	.lc-root.lc-pos-right { right: 16px; }
	.lc-root.lc-pos-left { left: 16px; }

	.lc-root.lc-pos-right .lc-panel,
	.lc-root.lc-pos-left .lc-panel {
		position: fixed;
		top: 16px;
		right: 16px;
		bottom: 88px;
		left: 16px;
		width: auto;
		height: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.lc-root .lc-launcher { transition: none; }
}
