/* ---------- Frontend chat widget ---------- */
#lcs-chat-root {
	position: fixed;
	bottom: 20px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#lcs-chat-root.lcs-position-bottom-right { right: 20px; }
#lcs-chat-root.lcs-position-bottom-left { left: 20px; }

.lcs-bubble {
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--lcs-color, #2563eb);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0,0,0,.2);
	border: none;
	position: relative;
	transition: transform .15s ease;
}
.lcs-bubble:hover { transform: scale(1.06); }
.lcs-bubble svg { width: 28px; height: 28px; position: relative; z-index: 2; }

/* Soft, continuous "breathing" ring that draws the eye without being
   obnoxious — runs for as long as the widget is closed. */
.lcs-bubble::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background: var(--lcs-color, #2563eb);
	opacity: 0;
	z-index: 1;
}
.lcs-bubble.lcs-pulse::before {
	animation: lcs-pulse-ring 2.4s ease-out infinite;
}
@keyframes lcs-pulse-ring {
	0%   { opacity: .55; transform: scale(1); }
	80%  { opacity: 0;   transform: scale(1.8); }
	100% { opacity: 0;   transform: scale(1.8); }
}

/* Periodic bounce nudge — toggled on/off by JS every N seconds, rather than
   looping forever, so it stays noticeable without becoming annoying. */
.lcs-bubble.lcs-bounce-active {
	animation: lcs-bounce .9s ease;
}
@keyframes lcs-bounce {
	0%, 100% { transform: translateY(0); }
	25%      { transform: translateY(-10px); }
	50%      { transform: translateY(0); }
	70%      { transform: translateY(-5px); }
	85%      { transform: translateY(0); }
}

.lcs-bubble-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	border-radius: 999px;
	min-width: 18px;
	height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	z-index: 2;
}

/* ---------- Greeting teaser bubble ---------- */
.lcs-teaser {
	position: absolute;
	bottom: 74px;
	max-width: 240px;
	background: #fff;
	color: #111827;
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(0,0,0,.18);
	padding: 12px 30px 12px 14px;
	font-size: 13px;
	line-height: 1.4;
	cursor: pointer;
	animation: lcs-teaser-in .35s ease;
}
#lcs-chat-root.lcs-position-bottom-right .lcs-teaser { right: 0; }
#lcs-chat-root.lcs-position-bottom-left .lcs-teaser { left: 0; }
@keyframes lcs-teaser-in {
	0%   { opacity: 0; transform: translateY(8px) scale(.96); }
	100% { opacity: 1; transform: translateY(0) scale(1); }
}
.lcs-teaser::after {
	content: '';
	position: absolute;
	bottom: -7px;
	width: 14px;
	height: 14px;
	background: #fff;
	transform: rotate(45deg);
}
#lcs-chat-root.lcs-position-bottom-right .lcs-teaser::after { right: 22px; }
#lcs-chat-root.lcs-position-bottom-left .lcs-teaser::after { left: 22px; }
.lcs-teaser-close {
	position: absolute;
	top: 6px;
	right: 8px;
	background: none;
	border: none;
	font-size: 15px;
	line-height: 1;
	color: #9ca3af;
	cursor: pointer;
	padding: 4px;
}
.lcs-teaser-close:hover { color: #4b5563; }

@media (prefers-reduced-motion: reduce) {
	.lcs-bubble.lcs-pulse::before,
	.lcs-bubble.lcs-bounce-active,
	.lcs-teaser {
		animation: none !important;
	}
}

.lcs-window {
	width: 340px;
	max-width: calc(100vw - 40px);
	height: 480px;
	max-height: calc(100vh - 100px);
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 40px rgba(0,0,0,.25);
	display: none;
	flex-direction: column;
	overflow: hidden;
	position: absolute;
	bottom: 74px;
}
#lcs-chat-root.lcs-position-bottom-right .lcs-window { right: 0; }
#lcs-chat-root.lcs-position-bottom-left .lcs-window { left: 0; }
.lcs-window.lcs-open { display: flex; }

.lcs-header {
	background: var(--lcs-color, #2563eb);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.lcs-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.lcs-header .lcs-status-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #22c55e;
	margin-right: 6px;
}
.lcs-header .lcs-status-dot.offline { background: #9ca3af; }
.lcs-header-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 18px;
	cursor: pointer;
	line-height: 1;
	opacity: .85;
}
.lcs-header-close:hover { opacity: 1; }

.lcs-body {
	flex: 1;
	overflow-y: auto;
	padding: 12px;
	background: #f8fafc;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.lcs-msg {
	max-width: 80%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.4;
	white-space: pre-wrap;
	word-wrap: break-word;
}
.lcs-msg-visitor {
	align-self: flex-end;
	background: var(--lcs-color, #2563eb);
	color: #fff;
	border-bottom-right-radius: 2px;
}
.lcs-msg-admin {
	align-self: flex-start;
	background: #e5e7eb;
	color: #111827;
	border-bottom-left-radius: 2px;
}
.lcs-msg-meta {
	font-size: 10px;
	opacity: .65;
	margin-top: 3px;
}

.lcs-prechat {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.lcs-prechat input {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 13px;
	box-sizing: border-box;
}
.lcs-prechat button {
	background: var(--lcs-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 10px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.lcs-footer {
	border-top: 1px solid #e5e7eb;
	padding: 10px;
	display: flex;
	gap: 8px;
	background: #fff;
}
.lcs-footer textarea {
	flex: 1;
	resize: none;
	border: 1px solid #d1d5db;
	border-radius: 10px;
	padding: 8px 10px;
	font-size: 13px;
	font-family: inherit;
	height: 38px;
	max-height: 90px;
	box-sizing: border-box;
}
.lcs-footer button {
	background: var(--lcs-color, #2563eb);
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 0 16px;
	cursor: pointer;
	font-weight: 600;
	font-size: 13px;
}
.lcs-footer button:disabled { opacity: .5; cursor: default; }

/* ---------- Admin inbox ---------- */
.lcs-admin-inbox {
	display: flex;
	gap: 0;
	margin-top: 16px;
	background: #fff;
	border: 1px solid #ccd0d4;
	min-height: 600px;
}
.lcs-admin-sidebar {
	width: 320px;
	border-right: 1px solid #e2e2e2;
	display: flex;
	flex-direction: column;
}
.lcs-search-row {
	padding: 10px;
	border-bottom: 1px solid #e2e2e2;
}
.lcs-search-input {
	width: 100%;
	box-sizing: border-box;
	padding: 6px 10px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 13px;
}
.lcs-admin-filter {
	display: flex;
	gap: 6px;
	padding: 10px;
	border-bottom: 1px solid #e2e2e2;
}
.lcs-filter-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.lcs-history-toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 12px 0;
	flex-wrap: wrap;
}
.lcs-history-toolbar .lcs-search-input {
	flex: 1;
	min-width: 240px;
	max-width: 420px;
}

.lcs-conversation-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	flex: 1;
}
.lcs-conversation-item {
	padding: 12px 14px;
	border-bottom: 1px solid #f0f0f1;
	cursor: pointer;
}
.lcs-conversation-item:hover { background: #f6f7f7; }
.lcs-conversation-item.active { background: #eef2ff; }
.lcs-conv-name { font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; }
.lcs-conv-preview { font-size: 12px; color: #666; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lcs-conv-unread {
	background: #ef4444;
	color: #fff;
	border-radius: 999px;
	font-size: 10px;
	padding: 1px 6px;
	font-weight: 700;
}
.lcs-conv-status-closed { color: #999; text-decoration: line-through; }

.lcs-admin-thread {
	flex: 1;
	display: flex;
	flex-direction: column;
}
.lcs-thread-header {
	padding: 14px;
	border-bottom: 1px solid #e2e2e2;
	font-size: 13px;
}
.lcs-thread-messages {
	flex: 1;
	padding: 14px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #f8fafc;
}
.lcs-reply-form {
	border-top: 1px solid #e2e2e2;
	padding: 10px;
	display: flex;
	gap: 8px;
	align-items: flex-start;
}
.lcs-reply-form textarea {
	flex: 1;
	resize: vertical;
}

.lcs-badge-count {
	background: #ef4444;
	color: #fff;
	border-radius: 999px;
	font-size: 11px;
	padding: 1px 7px;
	margin-left: 4px;
}

.lcs-tab-panel { margin-top: 10px; }

.lcs-history-notes {
	width: 100%;
	min-width: 180px;
	box-sizing: border-box;
	font-size: 12px;
	padding: 4px 6px;
}
.lcs-history-pager {
	margin-top: 12px;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}
.lcs-pager-summary { font-size: 13px; color: #666; }
.lcs-pager-nav {
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
}
.lcs-pager-nav .button { min-width: 32px; }
.lcs-pager-ellipsis { padding: 0 4px; color: #999; }

.lcs-reply-actions {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-top: 8px;
	flex-wrap: wrap;
}

.lcs-canned-picker {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 10px;
	border-top: 1px solid #e2e2e2;
	background: #fafafa;
}
.lcs-canned-item { font-size: 12px; }
.lcs-canned-empty { color: #666; font-size: 12px; padding: 4px; }

.lcs-invite-modal {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.4);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}
.lcs-invite-modal-inner {
	background: #fff;
	border-radius: 8px;
	padding: 20px;
	width: 420px;
	max-width: calc(100vw - 40px);
	box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.lcs-invite-modal-inner h2 { margin-top: 0; }
.lcs-invite-target { color: #666; font-size: 13px; margin-bottom: 10px; }
.lcs-invite-modal-inner textarea {
	width: 100%;
	box-sizing: border-box;
	margin: 10px 0;
	padding: 8px;
	border: 1px solid #ccd0d4;
	border-radius: 4px;
}
