/* Visitor chat widget. Scoped under .slc-widget so themes stay untouched. */

.slc-widget {
	--slc-accent: #2563eb;
	--slc-radius: 14px;
	--slc-surface: #ffffff;
	--slc-text: #1f2430;
	--slc-muted: #6b7280;
	--slc-line: #e5e7eb;
	--slc-theirs: #f3f4f6;

	position: fixed;
	bottom: 20px;
	z-index: 99999;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.45;
	color: var(--slc-text);
}

.slc-widget.slc-right { right: 20px; }
.slc-widget.slc-left  { left: 20px; }

.slc-widget .slc-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ------------------------------------------------------------- launcher */

.slc-launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 12px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--slc-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(15, 23, 42, 0.22);
	position: relative;
}

.slc-launcher:hover { filter: brightness(1.06); }
.slc-launcher:focus-visible { outline: 3px solid var(--slc-accent); outline-offset: 3px; }

.slc-launcher-icon { display: inline-flex; }

.slc-launcher-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: #dc2626;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}

.slc-widget[data-open="true"] .slc-launcher { display: none; }

/* ---------------------------------------------------------------- panel */

.slc-panel {
	display: flex;
	flex-direction: column;
	width: 340px;
	max-width: calc(100vw - 40px);
	max-height: min(70vh, 560px);
	background: var(--slc-surface);
	border: 1px solid var(--slc-line);
	border-radius: var(--slc-radius);
	box-shadow: 0 18px 50px rgba(15, 23, 42, 0.24);
	overflow: hidden;
}

.slc-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	padding: 14px 14px 12px;
	background: var(--slc-accent);
	color: #fff;
}

.slc-head-title { display: block; font-size: 15px; }

.slc-status {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12.5px;
	opacity: 0.92;
}

.slc-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #cbd5e1;
	box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
}

.slc-dot.is-online {
	background: #22c55e;
	animation: slc-pulse 2.4s ease-out infinite;
}

@keyframes slc-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
	70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
	100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.slc-dot.is-online { animation: none; }
}

.slc-close {
	flex: none;
	display: inline-flex;
	padding: 4px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	opacity: 0.85;
}

.slc-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.16); }

.slc-greeting,
.slc-offline-note {
	margin: 0;
	padding: 12px 14px;
	font-size: 14px;
	color: var(--slc-muted);
	border-bottom: 1px solid var(--slc-line);
}

.slc-offline-note { background: #fffbeb; color: #92400e; }

/* -------------------------------------------------------------- messages */

.slc-log {
	flex: 1 1 auto;
	min-height: 120px;
	padding: 12px 14px;
	overflow-y: auto;
	overscroll-behavior: contain;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.slc-msg { max-width: 85%; }
.slc-msg-mine { align-self: flex-end; text-align: right; }
.slc-msg-theirs { align-self: flex-start; }

.slc-msg-author {
	display: block;
	margin-bottom: 2px;
	font-size: 12px;
	font-weight: 600;
	color: var(--slc-muted);
}

.slc-msg-body {
	margin: 0;
	padding: 9px 12px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	text-align: left;
}

.slc-msg-mine .slc-msg-body {
	background: var(--slc-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.slc-msg-theirs .slc-msg-body {
	background: var(--slc-theirs);
	color: var(--slc-text);
	border-bottom-left-radius: 4px;
}

.slc-msg-time {
	display: block;
	margin-top: 3px;
	font-size: 11px;
	color: var(--slc-muted);
}

/* ----------------------------------------------------------- attachments */

.slc-file-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	max-width: 100%;
	padding: 8px 11px;
	border: 1px solid var(--slc-line);
	border-radius: 12px;
	background: #fff;
	color: var(--slc-text);
	font-size: 13px;
	text-decoration: none;
	text-align: left;
}

.slc-file-link:hover { border-color: var(--slc-accent); }

.slc-file-link.is-image {
	display: block;
	padding: 0;
	overflow: hidden;
	line-height: 0;
	border-radius: 12px;
}

.slc-file-link.is-image img {
	display: block;
	max-width: 200px;
	max-height: 200px;
	width: auto;
	height: auto;
	object-fit: cover;
}

.slc-file-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.slc-file-size { flex: none; font-size: 11px; color: var(--slc-muted); }

.slc-attach {
	flex: none;
	display: inline-flex;
	padding: 9px;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--slc-muted);
	cursor: pointer;
}

.slc-attach:hover { background: var(--slc-theirs); color: var(--slc-text); }
.slc-attach[disabled] { opacity: 0.5; cursor: default; }

.slc-panel.is-dropping { outline: 2px dashed var(--slc-accent); outline-offset: -6px; }

/* ----------------------------------------------------------------- email */

.slc-email {
	padding: 10px 14px;
	border-top: 1px solid var(--slc-line);
	background: #f9fafb;
}

.slc-email-label { display: block; font-size: 12.5px; color: var(--slc-muted); margin-bottom: 6px; }
.slc-email-row { display: flex; gap: 6px; }

.slc-email-row input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 7px 9px;
	border: 1px solid var(--slc-line);
	border-radius: 8px;
	font: inherit;
	font-size: 14px;
	background: #fff;
	color: var(--slc-text);
}

.slc-email-save {
	flex: none;
	padding: 7px 12px;
	border: 0;
	border-radius: 8px;
	background: var(--slc-text);
	color: #fff;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.slc-email-feedback { margin: 6px 0 0; font-size: 12px; color: #15803d; }

/* --------------------------------------------------------------- composer */

.slc-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--slc-line);
	background: var(--slc-surface);
}

.slc-input {
	flex: 1 1 auto;
	min-width: 0;
	max-height: 120px;
	padding: 9px 11px;
	border: 1px solid var(--slc-line);
	border-radius: 10px;
	font: inherit;
	font-size: 14.5px;
	line-height: 1.4;
	resize: none;
	background: #fff;
	color: var(--slc-text);
}

.slc-input:focus { outline: 2px solid var(--slc-accent); outline-offset: 0; border-color: var(--slc-accent); }

.slc-send {
	flex: none;
	display: inline-flex;
	padding: 9px;
	border: 0;
	border-radius: 10px;
	background: var(--slc-accent);
	color: #fff;
	cursor: pointer;
}

.slc-send[disabled] { opacity: 0.55; cursor: default; }

.slc-error {
	margin: 0;
	padding: 8px 14px 12px;
	font-size: 13px;
	color: #b91c1c;
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 480px) {
	.slc-widget { bottom: 12px; }
	.slc-widget.slc-right { right: 12px; }
	.slc-widget.slc-left { left: 12px; }

	.slc-widget[data-open="true"] {
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
	}

	.slc-panel {
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		border: 0;
		border-radius: 0;
	}

	.slc-launcher-label { display: none; }
	.slc-launcher { padding: 14px; }
}

.slc-file-link.is-expired {
	border-style: dashed;
	background: transparent;
	color: var(--slc-muted);
	font-style: italic;
	cursor: default;
}
