/* Live Support Chat - Widget public (stil Messenger) */

.lsc-widget-root {
	--lsc-primary: #0084ff;
	--lsc-radius: 20px;
	--lsc-launcher-size: 62px;
	--lsc-panel-width: 372px;
	--lsc-panel-height: 560px;
	--lsc-font-size: 13px;
	--lsc-emoji-font: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
	position: fixed;
	bottom: 22px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
}
.lsc-widget-root.lsc-pos-right { right: 22px; }
.lsc-widget-root.lsc-pos-left { left: 22px; }

.lsc-launcher {
	width: var(--lsc-launcher-size);
	height: var(--lsc-launcher-size);
	border-radius: 50%;
	border: none;
	cursor: pointer;
	background: linear-gradient(145deg, var(--lsc-primary), var(--lsc-secondary, color-mix(in srgb, var(--lsc-primary) 45%, #6d2fe0)));
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--lsc-primary) 55%, #000 10%), 0 2px 6px rgba(0,0,0,.12);
	transition: transform .2s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease;
	position: relative;
}
.lsc-launcher-icon-svg {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	width: 55%;
	height: 55%;
}
.lsc-launcher-icon-svg svg { width: 100%; height: 100%; }
.lsc-launcher-ring {
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	border: 1.5px solid color-mix(in srgb, var(--lsc-primary) 35%, transparent);
	pointer-events: none;
}
.lsc-launcher:hover { transform: scale(1.07) translateY(-1px); box-shadow: 0 14px 30px -6px color-mix(in srgb, var(--lsc-primary) 60%, #000 10%), 0 3px 8px rgba(0,0,0,.14); }
.lsc-launcher:active { transform: scale(.95); }

.lsc-launcher-presence {
	position: absolute;
	bottom: 2px;
	left: 2px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 2.5px solid #fff;
	background: #b0b3b8;
}
.lsc-launcher-presence.is-online { background: #22c55e; }
.lsc-launcher-presence.is-away { background: #f5a623; }
.lsc-launcher-presence.is-offline { background: #b0b3b8; }

.lsc-launcher-badge {
	position: absolute;
	top: -3px;
	right: -3px;
	background: #ff3b30;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	min-width: 20px;
	height: 20px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	padding: 0 4px;
}

.lsc-panel {
	position: absolute;
	bottom: 82px;
	width: var(--lsc-panel-width);
	max-width: calc(100vw - 32px);
	height: var(--lsc-panel-height);
	max-height: calc(100vh - 140px);
	background: #fff;
	border-radius: var(--lsc-radius);
	box-shadow: 0 16px 48px rgba(0,0,0,.2), 0 4px 12px rgba(0,0,0,.08);
	display: none;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(16px) scale(.98);
	transition: opacity .18s ease, transform .18s ease;
	font-size: var(--lsc-font-size);
}
.lsc-widget-root.lsc-pos-right .lsc-panel { right: 0; }
.lsc-widget-root.lsc-pos-left .lsc-panel { left: 0; }
.lsc-widget-root.is-open .lsc-panel {
	display: flex;
	opacity: 1;
	transform: translateY(0) scale(1);
}

.lsc-panel-header {
	background: linear-gradient(120deg, var(--lsc-primary), var(--lsc-secondary, color-mix(in srgb, var(--lsc-primary) 60%, #7a3cff)));
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
	box-shadow: 0 2px 8px rgba(0,0,0,.1);
	position: relative;
	z-index: 1;
}
.lsc-panel-header-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.lsc-panel-header-text strong { font-size: 15px; line-height: 1.25; }
.lsc-panel-header-text span.lsc-header-subtitle-default { font-size: 12px; opacity: .85; }
.lsc-header-department {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	opacity: .95;
}
.lsc-presence-dot {
	width: 8px; height: 8px; border-radius: 50%; background: #b0b3b8; flex-shrink: 0;
	box-shadow: 0 0 0 2px rgba(255,255,255,.35);
}
.lsc-presence-dot.is-online { background: #22c55e; }
.lsc-presence-dot.is-away { background: #f5a623; }
.lsc-presence-dot.is-offline { background: #ff5b5b; }

.lsc-back-btn, .lsc-minimize-btn {
	background: rgba(255,255,255,.15);
	border: none;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 16px;
	line-height: 1;
}
.lsc-back-btn:hover, .lsc-minimize-btn:hover { background: rgba(255,255,255,.28); }

.lsc-screen { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 18px 16px; overflow-y: auto; }
.lsc-screen-chat { padding: 0; }

.lsc-welcome-text { font-size: 13.5px; color: #444; margin: 0 0 14px; line-height: 1.5; }
.lsc-loading { font-size: 13px; color: #888; padding: 12px 0; }

.lsc-department-list { display: flex; flex-direction: column; gap: 10px; }

.lsc-department-card {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border: 1px solid #ececec;
	border-radius: 14px;
	cursor: pointer;
	text-align: left;
	background: #fff;
	transition: border-color .15s ease, background .15s ease;
}
.lsc-department-card:hover { border-color: var(--dept-color, var(--lsc-primary)); background: #f7fafd; }

.lsc-department-icon {
	width: 40px; height: 40px; border-radius: 50%;
	background: var(--dept-color, var(--lsc-primary));
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	flex-shrink: 0;
	font-size: 18px;
}

.lsc-department-info { flex: 1; min-width: 0; }
.lsc-department-name { font-size: 13.5px; font-weight: 600; color: #1c1e21; }
.lsc-department-desc { font-size: 11.5px; color: #8a8d91; margin-top: 2px; }
.lsc-department-online { font-size: 10.5px; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }
.lsc-department-online.is-online { color: #22c55e; }
.lsc-department-online.is-away { color: #f5a623; }
.lsc-department-online.is-offline { color: #ff5b5b; }
.lsc-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.lsc-field { margin-bottom: 14px; }
.lsc-field label { display: block; font-size: 12px; font-weight: 600; color: #444; margin-bottom: 5px; }
.lsc-field input {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid #dcdcde;
	font-size: 16px;
}
.lsc-field input:focus { outline: none; border-color: var(--lsc-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lsc-primary) 18%, transparent); }

.lsc-otp-input {
	letter-spacing: 8px;
	font-size: 20px !important;
	text-align: center;
	font-weight: 700;
}

.lsc-field-error {
	color: #d33;
	font-size: 12px;
	margin: -6px 0 12px;
}

.lsc-link-btn {
	background: none;
	border: none;
	color: var(--lsc-primary);
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	padding: 6px 0;
	text-align: center;
	width: 100%;
}
.lsc-link-btn:hover { text-decoration: underline; }

.lsc-session-banner {
	margin-top: auto;
	padding-top: 12px;
	border-top: 1px solid #f0f0f0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 11.5px;
	color: #8a8d91;
}
.lsc-session-banner button {
	background: none; border: none; color: var(--lsc-primary); font-weight: 600; font-size: 11.5px; cursor: pointer;
}

.lsc-chat-toolbar {
	display: flex;
	justify-content: flex-end;
	padding: 6px 14px 0;
	flex-shrink: 0;
}
.lsc-chat-toolbar .lsc-link-btn { width: auto; padding: 4px 8px; }

.lsc-form-dept-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-weight: 600; font-size: 13.5px; color: #1c1e21; }

.lsc-primary-btn {
	background: var(--lsc-primary);
	color: #fff;
	border: none;
	padding: 11px 16px;
	border-radius: 10px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	width: 100%;
}
.lsc-primary-btn:hover { filter: brightness(1.06); }

.lsc-chat-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	background: #fff;
}

.lsc-msg-row { display: flex; max-width: 100%; align-items: flex-end; gap: 6px; }
.lsc-msg-row.from-visitor { justify-content: flex-end; }
.lsc-msg-row.from-agent { justify-content: flex-start; }

/* ---- Avatar operator (poza de profil sau initiale colorate) ---- */
.lsc-msg-avatar {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	flex-shrink: 0;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--lsc-primary);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	box-shadow: 0 0 0 1.5px #fff, 0 1px 3px rgba(0,0,0,.15);
}
.lsc-msg-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.lsc-msg-avatar-spacer { width: 24px; flex-shrink: 0; }

.lsc-bubble {
	max-width: 75%;
	padding: 9px 14px;
	border-radius: 18px;
	font-size: 1em;
	line-height: 1.42;
	word-wrap: break-word;
}
.from-visitor .lsc-bubble {
	background: var(--lsc-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.from-agent .lsc-bubble {
	background: #f0f0f0;
	color: #050505;
	border-bottom-left-radius: 4px;
}
.lsc-bubble-time { display: block; font-size: 9.5px; opacity: .6; margin-top: 3px; }

.lsc-agent-label { font-size: 10.5px; color: #8a8d91; margin: 6px 0 2px 4px; }
.lsc-sender-label {
	font-size: 10.5px;
	color: #8a8d91;
	margin: 8px 2px 2px 34px;
	font-weight: 600;
}
.lsc-msg-row.from-visitor + .lsc-msg-row .lsc-sender-label,
.lsc-msg-row:first-child .lsc-sender-label { margin-top: 2px; }

.lsc-emoji-btn {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: transparent;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: #65676b;
	padding: 0;
	margin: 0 0 2px;
}
.lsc-emoji-btn svg { width: 20px; height: 20px; display: block; pointer-events: none; }
.lsc-emoji-btn:hover { background: #e7e9ec; color: #1c1e21; }
.lsc-emoji-btn.is-active { background: color-mix(in srgb, var(--lsc-primary) 14%, #fff); color: var(--lsc-primary); }

/* PicMo se deschide deasupra casetei, in afara panoului (overflow:hidden). */
.picmo__popupContainer.lsc-picmo {
	z-index: 1000005 !important;
	box-sizing: border-box;
}
.picmo__popupContainer.lsc-picmo .picmo__emojiButton {
	font-size: var(--emoji-size, 1.5rem) !important;
	font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif !important;
	width: 100% !important;
	height: 100% !important;
	min-height: 0 !important;
	padding: 0 !important;
	margin: 0 !important;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	line-height: 1 !important;
	color: inherit !important;
	text-transform: none !important;
}
.picmo__popupContainer.lsc-picmo .picmo__categoryButton,
.picmo__popupContainer.lsc-picmo .picmo__clearSearchButton {
	background: transparent !important;
	box-shadow: none !important;
	min-height: 0 !important;
	line-height: 1 !important;
	text-transform: none !important;
}
.picmo__popupContainer.lsc-picmo .picmo__searchField {
	font-size: 16px !important;
	line-height: 1.2 !important;
	height: auto !important;
	min-height: 0 !important;
	margin: 0 !important;
	box-shadow: none !important;
}

.lsc-typing-hint {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 16px 8px;
	font-size: 11.5px;
	color: #8a8d91;
}
.lsc-typing-dots { display: inline-flex; gap: 3px; }
.lsc-typing-dots span {
	width: 5px; height: 5px; border-radius: 50%; background: #b0b3b8;
	animation: lscTypingBounce 1.2s infinite ease-in-out;
}
.lsc-typing-dots span:nth-child(2) { animation-delay: .15s; }
.lsc-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes lscTypingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }

/* ---- Zona de compunere mesaj ---- */
.lsc-chat-form {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px 10px 10px;
	background: #fff;
	border-top: 1px solid #ececec;
	flex-shrink: 0;
	box-sizing: border-box;
}

.lsc-chat-compose {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.lsc-chat-input-wrap {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 44px;
	display: flex;
	align-items: flex-end;
	gap: 2px;
	background: #f2f3f5;
	border: 1.5px solid transparent;
	border-radius: 22px;
	padding: 2px 6px 2px 4px;
	box-sizing: border-box;
	transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.lsc-chat-input-wrap:focus-within {
	background: #fff;
	border-color: var(--lsc-primary, #0084ff);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--lsc-primary, #0084ff) 14%, transparent);
}

.lsc-chat-form textarea,
.lsc-chat-input-wrap textarea,
#lsc-widget-root #lsc-chat-input {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	box-sizing: border-box;
	resize: none !important;
	border: none !important;
	background: transparent !important;
	box-shadow: none !important;
	border-radius: 0;
	margin: 0;
	padding: 9px 4px;
	font-size: 16px;
	line-height: 22px;
	font-family: inherit;
	color: #1c1e21;
	/* O linie intreaga de la prima afisare. Inaltimea 0 pusa cat caseta e ascunsa
	   nu o mai poate strange: min-height tine placeholderul vizibil. */
	height: 40px;
	min-height: 40px;
	max-height: 96px;
	overflow-y: hidden;
}
.lsc-chat-form textarea::-webkit-resizer { display: none; }
.lsc-chat-form textarea::placeholder { color: #8a8d91; }
.lsc-chat-form textarea:focus { outline: none; }

.lsc-chat-send {
	width: 40px;
	height: 40px;
	min-width: 40px;
	margin-bottom: 2px;
	border-radius: 50%;
	background: linear-gradient(145deg, var(--lsc-primary, #0084ff), var(--lsc-secondary, color-mix(in srgb, var(--lsc-primary, #0084ff) 55%, #6d2fe0)));
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	box-shadow: 0 3px 10px -2px color-mix(in srgb, var(--lsc-primary, #0084ff) 55%, transparent);
	transition: transform .12s ease, filter .12s ease, opacity .12s ease;
	opacity: 1;
	visibility: visible;
}
.lsc-chat-send svg { width: 17px; height: 17px; flex-shrink: 0; pointer-events: none; }
.lsc-chat-send:hover { filter: brightness(1.08); transform: scale(1.05); }
.lsc-chat-send:active { transform: scale(.94); }
.lsc-chat-send:disabled { opacity: .45; cursor: default; transform: none; }

.lsc-closed-banner {
	background: #fff4e5;
	color: #8a5a00;
	font-size: 12px;
	text-align: center;
	padding: 8px;
	margin: 8px 16px 0;
	border-radius: 8px;
}

/* 16px pe orice latime: sub acest prag Safari mareste toata pagina la focus. */
#lsc-widget-root .lsc-field input:not(.lsc-otp-input),
#lsc-widget-root textarea,
#lsc-visitor-name,
#lsc-visitor-email,
#lsc-chat-input {
	font-size: 16px !important;
}
#lsc-widget-root #lsc-otp-code {
	font-size: 20px !important;
}

/* Cat chat-ul e deschis pe mobil, pagina din spate nu preia scroll-ul.
   overflow:hidden pe html deselecteaza campul imediat pe iOS, asa ca
   scroll-ul din afara widgetului e oprit din JS. */
html.lsc-chat-lock,
html.lsc-chat-lock body {
	overscroll-behavior: none;
}

/* ---- Responsive mobil: headerul sta fix in partea de sus a ecranului.
   Doar fereastra de sub el (mesaje + caseta) isi schimba inaltimea, dupa
   viewportul vizibil. 100vh include zona de sub bara browserului. Campurile
   raman la 16px. Transform-ul e scos: un scale pe parinte face iOS sa trateze
   textul ca fiind mai mic de 16px si sa faca zoom. ---- */
@media (max-width: 600px) {
	.lsc-widget-root { bottom: 14px; touch-action: manipulation; }
	.lsc-widget-root.lsc-pos-right { right: 14px; }
	.lsc-widget-root.lsc-pos-left { left: 14px; }

	.lsc-widget-root.is-open .lsc-launcher { display: none; }

	.lsc-panel-header {
		position: fixed;
		top: 0;
		left: 0 !important;
		right: 0 !important;
		width: auto;
		z-index: 2;
		box-sizing: border-box;
		padding-top: max(16px, env(safe-area-inset-top));
		flex: 0 0 auto;
	}

	.lsc-panel,
	.lsc-widget-root.is-open .lsc-panel {
		position: fixed;
		top: var(--lsc-head, 72px);
		bottom: auto;
		right: 0 !important;
		left: 0 !important;
		width: 100%;
		max-width: 100%;
		height: calc(100svh - var(--lsc-head, 72px));
		max-height: calc(100svh - var(--lsc-head, 72px));
		box-sizing: border-box;
		border-radius: 0;
		box-shadow: none;
		transform: none;
		z-index: 1;
		overscroll-behavior: contain;
	}

	.lsc-screen,
	.lsc-chat-messages {
		overscroll-behavior: contain;
	}

	.lsc-chat-form {
		padding-bottom: max(10px, env(safe-area-inset-bottom));
	}

	#lsc-widget-root .lsc-field input,
	#lsc-widget-root textarea,
	#lsc-chat-input,
	#lsc-otp-code {
		touch-action: manipulation;
	}

	.lsc-emoji-btn,
	.lsc-chat-send {
		width: 40px;
		height: 40px;
		min-width: 40px;
	}

	.lsc-launcher-badge,
	.lsc-launcher-presence {
		display: none !important;
	}
}
