/* 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;
	position: fixed;
	bottom: 22px;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.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: 13.5px;
}
.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: 30px; height: 30px; border-radius: 50%;
	background: transparent; border: none; cursor: pointer;
	font-size: 17px; display: flex; align-items: center; justify-content: center;
	flex-shrink: 0; color: #8a8d91; line-height: 1;
}
.lsc-emoji-btn:hover { background: #ebedf0; }
.lsc-emoji-btn.is-active { background: color-mix(in srgb, var(--lsc-primary) 14%, transparent); }

.lsc-emoji-panel {
	display: grid;
	grid-template-columns: repeat(8, 1fr);
	gap: 2px;
	max-height: 150px;
	overflow-y: auto;
	padding: 10px 12px;
	border-top: 1px solid #ececec;
	flex-shrink: 0;
}
.lsc-emoji-panel button {
	background: none;
	border: none;
	font-size: 19px;
	line-height: 1;
	padding: 5px;
	cursor: pointer;
	border-radius: 6px;
}
.lsc-emoji-panel button:hover { background: #f0f0f0; }

.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: caseta "pill" moderna + buton Send rotund, vizibil garantat ---- */
.lsc-chat-form {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid #ececec;
	flex-shrink: 0;
	box-sizing: border-box;
}

.lsc-chat-input-wrap {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: flex-end;
	gap: 4px;
	background: #f2f3f5;
	border: 1.5px solid transparent;
	border-radius: 22px;
	padding: 4px 6px 4px 8px;
	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-input-wrap .lsc-emoji-btn { margin-bottom: 1px; }

.lsc-chat-form textarea,
.lsc-chat-input-wrap textarea,
#lsc-chat-input {
	flex: 1 1 auto;
	min-width: 0;
	resize: none !important;
	border: none;
	background: transparent;
	border-radius: 16px;
	padding: 7px 4px;
	font-size: 14px;
	line-height: 1.3;
	/* Maxim ~2 randuri; peste, textul scroll-eaza in interiorul casutei in loc sa o
	   mai crestem (si utilizatorul nu mai poate trage manual de un "resize handle" -
	   vezi resize:none mai sus, fortat cu specificitate mare ca sa nu poata fi
	   suprascris de un reset CSS din tema site-ului). */
	height: 20px;
	max-height: 42px;
	overflow-y: auto;
	font-family: inherit;
	color: #1c1e21;
}
.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: 38px;
	height: 38px;
	min-width: 38px;
	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;
}

/* ---- Responsive mobil: fereastra de chat ocupa tot ecranul, fara sa depinda de un viewport
   fix (foloseste dvh cu fallback vh), si evita zoom-ul automat din iOS Safari pe campurile
   de input (necesita font-size >= 16px pe inputuri/textarea) ---- */
@media (max-width: 600px) {
	.lsc-widget-root { bottom: 14px; }
	.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 {
		position: fixed;
		inset: 0;
		bottom: 0;
		right: 0 !important;
		left: 0 !important;
		width: 100vw;
		max-width: 100vw;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
		box-shadow: none;
	}

	.lsc-panel-header {
		padding-top: max(16px, env(safe-area-inset-top));
		flex-shrink: 0;
	}

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

	/* Font >= 16px pe campurile editabile ca sa nu declanseze zoom automat pe iOS Safari. */
	.lsc-field input,
	.lsc-chat-form textarea,
	.lsc-otp-input {
		font-size: 16px;
	}

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

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