/* ============================================================================
 * Zetlink Guest Live Chat widget (ZLC) — v1.0.0
 * Brand: #6455f7 purple / #031f42 navy (matches rabbiitfirm frontend)
 * ============================================================================ */

#zlc-root {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 999999;
	font-family: inherit;
	-webkit-font-smoothing: antialiased;
}

/* ---------------- Launcher ---------------- */
#zlc-launcher {
	position: relative;
	width: 58px;
	height: 58px;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	color: #fff;
	background: linear-gradient(135deg, #6455f7 0%, #8b7bff 100%);
	box-shadow: 0 10px 30px rgba(100, 85, 247, 0.45), 0 3px 8px rgba(3, 31, 66, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#zlc-launcher:hover {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 14px 36px rgba(100, 85, 247, 0.55), 0 4px 10px rgba(3, 31, 66, 0.2);
}
#zlc-launcher:active { transform: scale(0.96); }

#zlc-launcher .zlc-launcher-icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.18s ease, transform 0.18s ease;
}
#zlc-launcher .zlc-icon-close { opacity: 0; transform: rotate(-45deg) scale(0.6); }
.zlc-is-open #zlc-launcher .zlc-icon-chat { opacity: 0; transform: rotate(45deg) scale(0.6); }
.zlc-is-open #zlc-launcher .zlc-icon-close { opacity: 1; transform: rotate(0) scale(1); }

.zlc-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 21px;
	height: 21px;
	padding: 0 5px;
	border-radius: 11px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 2px solid #fff;
	box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
}

/* ---------------- Panel ---------------- */
.zlc-panel {
	position: absolute;
	right: 0;
	bottom: 74px;
	width: 374px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 120px);
	background: #ffffff;
	border-radius: 18px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 24px 64px rgba(3, 31, 66, 0.24), 0 4px 16px rgba(3, 31, 66, 0.12);
	animation: zlc-pop 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes zlc-pop {
	from { opacity: 0; transform: translateY(14px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------- Header ---------------- */
.zlc-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 16px 14px;
	background: linear-gradient(135deg, #6455f7 0%, #7a67ff 55%, #8b7bff 100%);
	color: #fff;
	flex: 0 0 auto;
}
.zlc-hd-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	font-weight: 700;
	font-size: 16px;
	border: 1.5px solid rgba(255, 255, 255, 0.35);
}
.zlc-hd-text { flex: 1 1 auto; min-width: 0; }
.zlc-hd-title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.zlc-hd-sub {
	font-size: 11.5px;
	opacity: 0.92;
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
}
.zlc-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #22e58f;
	box-shadow: 0 0 0 3px rgba(34, 229, 143, 0.25);
	flex: 0 0 auto;
	animation: zlc-pulse 2s infinite;
}
@keyframes zlc-pulse {
	0%, 100% { box-shadow: 0 0 0 3px rgba(34, 229, 143, 0.25); }
	50%      { box-shadow: 0 0 0 5px rgba(34, 229, 143, 0.12); }
}
.zlc-hd-min {
	border: none;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
	flex: 0 0 auto;
}
.zlc-hd-min:hover { background: rgba(255, 255, 255, 0.26); }

/* ---------------- Body ---------------- */
.zlc-body {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	background: #f7f8fd;
}

/* ---------------- Pre-chat form ---------------- */
.zlc-form-wrap {
	padding: 20px 18px 16px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.zlc-form-hello-title {
	font-size: 19px;
	font-weight: 800;
	color: #031f42;
	letter-spacing: -0.2px;
}
.zlc-form-hello-sub {
	font-size: 13px;
	color: #64748b;
	line-height: 1.55;
	margin-top: 4px;
}
.zlc-field { display: flex; flex-direction: column; gap: 5px; }
.zlc-field span {
	font-size: 11.5px;
	font-weight: 700;
	color: #475569;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}
.zlc-field input,
.zlc-field textarea {
	border: 1.5px solid #e2e5f1;
	border-radius: 10px;
	padding: 10px 13px;
	font-size: 14px;
	font-family: inherit;
	color: #1e293b;
	background: #fff;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	resize: none;
	width: 100%;
	box-sizing: border-box;
}
.zlc-field input:focus,
.zlc-field textarea:focus {
	border-color: #6455f7;
	box-shadow: 0 0 0 3px rgba(100, 85, 247, 0.14);
}
.zlc-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}
.zlc-btn-primary {
	border: none;
	border-radius: 11px;
	background: linear-gradient(135deg, #6455f7, #8b7bff);
	color: #fff;
	font-size: 14.5px;
	font-weight: 700;
	font-family: inherit;
	padding: 12px 16px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-shadow: 0 6px 18px rgba(100, 85, 247, 0.35);
	transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
	margin-top: 2px;
}
.zlc-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(100, 85, 247, 0.42); }
.zlc-btn-primary:disabled { opacity: 0.6; cursor: default; transform: none; }
.zlc-btn-primary.zlc-loading span::after { content: '…'; }
.zlc-privacy {
	font-size: 11.5px;
	color: #94a3b8;
	text-align: center;
}
.zlc-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #b91c1c;
	font-size: 12.5px;
	border-radius: 9px;
	padding: 9px 12px;
	line-height: 1.45;
}

/* ---------------- Chat view ---------------- */
.zlc-chat-wrap {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
}
.zlc-banner {
	flex: 0 0 auto;
	font-size: 12px;
	padding: 8px 14px;
	display: flex;
	align-items: center;
	gap: 8px;
	line-height: 1.4;
}
.zlc-banner-wait { background: #fff7e6; color: #92600a; border-bottom: 1px solid #fdeccb; }
.zlc-banner-muted { background: #eef1f7; color: #64748b; border-bottom: 1px solid #e2e7f0; }
.zlc-spinner {
	width: 13px;
	height: 13px;
	border: 2px solid rgba(146, 96, 10, 0.25);
	border-top-color: #b97b0c;
	border-radius: 50%;
	animation: zlc-spin 0.8s linear infinite;
	flex: 0 0 auto;
}
@keyframes zlc-spin { to { transform: rotate(360deg); } }

.zlc-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 16px 14px 10px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scrollbar-width: thin;
	scrollbar-color: #cbd2e4 transparent;
}
.zlc-messages::-webkit-scrollbar { width: 5px; }
.zlc-messages::-webkit-scrollbar-thumb { background: #cbd2e4; border-radius: 3px; }

.zlc-empty {
	margin: auto;
	color: #94a3b8;
	font-size: 13px;
	text-align: center;
}
.zlc-sysmsg {
	text-align: center;
	margin: 4px 0;
}
.zlc-sysmsg span {
	display: inline-block;
	background: #e9ecf6;
	color: #7c8598;
	font-size: 10.5px;
	padding: 4px 12px;
	border-radius: 20px;
	max-width: 92%;
	line-height: 1.4;
}

.zlc-msg-row { display: flex; flex-direction: column; max-width: 82%; }
.zlc-msg-row.zlc-right { align-self: flex-end; align-items: flex-end; }
.zlc-msg-row.zlc-left  { align-self: flex-start; align-items: flex-start; }
.zlc-msg-sender {
	font-size: 10.5px;
	font-weight: 700;
	color: #6455f7;
	margin: 0 4px 3px;
}
.zlc-bubble {
	padding: 9px 13px 6px;
	border-radius: 15px;
	font-size: 13.5px;
	line-height: 1.5;
	word-wrap: break-word;
	overflow-wrap: break-word;
	white-space: pre-line;
}
.zlc-right .zlc-bubble {
	background: linear-gradient(135deg, #6455f7, #7c6bfb);
	color: #fff;
	border-bottom-right-radius: 5px;
	box-shadow: 0 3px 10px rgba(100, 85, 247, 0.28);
}
.zlc-left .zlc-bubble {
	background: #ffffff;
	color: #1e293b;
	border: 1px solid #e6e9f4;
	border-bottom-left-radius: 5px;
	box-shadow: 0 2px 6px rgba(3, 31, 66, 0.05);
}
.zlc-msg-time {
	font-size: 9.5px;
	margin-top: 4px;
	opacity: 0.75;
	display: flex;
	align-items: center;
	gap: 6px;
	justify-content: flex-end;
}
.zlc-left .zlc-msg-time { color: #94a3b8; justify-content: flex-start; }
.zlc-seen { font-weight: 700; }
.zlc-seen-dim { opacity: 0.7; }

.zlc-att-img { display: block; margin-top: 6px; }
.zlc-att-img img { max-width: 190px; border-radius: 10px; display: block; }
.zlc-att-file {
	display: inline-block;
	margin-top: 6px;
	font-size: 12px;
	text-decoration: underline;
	color: inherit;
}

/* ---------------- Composer ---------------- */
.zlc-composer {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	background: #fff;
	border-top: 1px solid #e8ebf4;
}
.zlc-composer textarea {
	flex: 1 1 auto;
	border: 1.5px solid #e2e5f1;
	border-radius: 12px;
	padding: 9px 13px;
	font-size: 13.5px;
	font-family: inherit;
	color: #1e293b;
	outline: none;
	resize: none;
	max-height: 110px;
	line-height: 1.45;
	background: #f9fafd;
	transition: border-color 0.15s ease, background 0.15s ease;
	box-sizing: border-box;
}
.zlc-composer textarea:focus { border-color: #6455f7; background: #fff; }
.zlc-composer button {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border: none;
	border-radius: 11px;
	background: linear-gradient(135deg, #6455f7, #8b7bff);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(100, 85, 247, 0.35);
	transition: transform 0.12s ease, opacity 0.12s ease;
}
.zlc-composer button:hover { transform: scale(1.06); }
.zlc-composer button:disabled { opacity: 0.55; transform: none; cursor: default; }

.zlc-end-link {
	flex: 0 0 auto;
	border: none;
	background: #fff;
	color: #94a3b8;
	font-size: 11px;
	font-family: inherit;
	padding: 6px 0 9px;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.zlc-end-link:hover { color: #ef4444; }

/* ---------------- Toast ---------------- */
.zlc-toast {
	position: absolute;
	left: 50%;
	bottom: 74px;
	transform: translateX(-50%) translateY(8px);
	background: #1e293b;
	color: #fff;
	font-size: 12px;
	padding: 8px 14px;
	border-radius: 9px;
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
	max-width: 88%;
	text-align: center;
	box-shadow: 0 6px 18px rgba(3, 31, 66, 0.3);
}
.zlc-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- Attach (screenshot) ---------------- */
#zlc-attach {
	flex: 0 0 auto !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 40px !important;
	padding: 0 !important;
	border: 1.5px solid #e2e5f1 !important;
	border-radius: 11px;
	background: #f9fafd;
	color: #6455f7;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, border-color 0.15s ease;
}
#zlc-attach:hover { background: #efeefe; border-color: #c9c2fb !important; }

#zlc-file[hidden] { display: none !important; }
.zlc-attach-bar[hidden] { display: none !important; }

.zlc-attach-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 14px;
	background: #f3f1ff;
	border-top: 1px solid #e4e0fb;
	font-size: 12px;
	color: #4c3fd6;
}
.zlc-attach-bar .zlc-attach-name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
}
.zlc-attach-bar button {
	flex: 0 0 auto;
	width: 22px !important;
	height: 22px !important;
	min-width: 22px !important;
	padding: 0 !important;
	border: none !important;
	border-radius: 6px;
	background: rgba(100, 85, 247, 0.12);
	color: #4c3fd6;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}
.zlc-attach-bar button:hover { background: rgba(100, 85, 247, 0.22); }

/* ---------------- Mobile ---------------- */
@media (max-width: 480px) {
	#zlc-root { right: 14px; bottom: 14px; }
	.zlc-panel {
		position: fixed;
		top: 0;
		right: 0;
		left: 0;
		bottom: auto;
		width: 100%;
		max-width: 100%;
		height: 100dvh;
		max-height: 100dvh;
		border-radius: 0;
	}
	.zlc-is-open #zlc-launcher {
		display: none !important; /* header minimize button takes over on mobile */
	}
	.zlc-header { padding-top: calc(14px + env(safe-area-inset-top)); }
	.zlc-composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
	.zlc-panel, #zlc-launcher, .zlc-dot { animation: none !important; transition: none !important; }
}
/* ============================================================================
 * Theme-bleed armor — the marketplace frontend ships global button/span rules
 * (full-width buttons, display resets) that were deforming the widget:
 * stretched oval launcher, word-wrapped header tagline, "0" badge showing.
 * Pin the critical geometry with !important so page CSS can never break it.
 * ============================================================================ */
#zlc-root, #zlc-root * { box-sizing: border-box; }
#zlc-root { font-size: 14px; line-height: 1.5; text-align: left; }

#zlc-launcher {
	width: 58px !important;
	height: 58px !important;
	min-width: 58px !important;
	max-width: 58px !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	border-radius: 50% !important;
	display: flex !important;
}

#zlc-badge[hidden] { display: none !important; }

#zlc-panel[hidden] { display: none !important; }

body.zlc-mobile-lock {
	position: fixed !important;
	inset: 0 !important;
	width: 100% !important;
	overflow: hidden !important;
}
.zlc-hd-min {
	width: 30px !important;
	height: 30px !important;
	min-width: 30px !important;
	flex: 0 0 auto !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
}

.zlc-hd-text { flex: 1 1 auto !important; min-width: 0 !important; }
.zlc-hd-title { display: block !important; }
.zlc-hd-title,
.zlc-hd-sub {
	white-space: nowrap !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
}
.zlc-hd-sub { display: flex !important; }

#zlc-send {
	flex: 0 0 auto !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 40px !important;
	padding: 0 !important;
	border: none !important;
}

.zlc-btn-primary { width: 100% !important; display: flex !important; }
.zlc-field input,
.zlc-field textarea { width: 100% !important; max-width: 100% !important; }
.zlc-composer { width: 100% !important; max-width: 100% !important; }
.zlc-composer textarea {
	flex: 1 1 auto !important;
	width: auto !important;
	min-width: 0 !important;
	max-width: 100% !important;
}
.zlc-end-link {
	width: auto !important;
	display: inline-block !important;
	background: none !important;
	border: none !important;
	box-shadow: none !important;
}