/* ==== Floating Chat Widget — scoped, theme-proof styles ==== */
#fcw-widget-root {
	--fcw-primary: #4f46e5;
	--fcw-primary-dark: #4338ca;
	--fcw-bg: #ffffff;
	--fcw-bg-soft: #f6f7fb;
	--fcw-border: #e5e7eb;
	--fcw-text: #1f2330;
	--fcw-text-soft: #6b7280;
	--fcw-bubble-visitor: #4f46e5;
	--fcw-bubble-admin: #eef0f6;
	--fcw-radius: 16px;
	--fcw-shadow: 0 12px 32px rgba(20, 20, 43, 0.16);
	all: initial;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#fcw-widget-root, #fcw-widget-root * , #fcw-widget-root *::before, #fcw-widget-root *::after {
	box-sizing: border-box !important;
	font-family: inherit;
	line-height: 1.45;
}
#fcw-widget-root svg {
	display: inline-block !important;
	max-width: none !important;
	width: auto;
	height: auto;
	vertical-align: middle !important;
	flex-shrink: 0;
}

.fcw-bubble {
	position: fixed;
	right: 22px;
	bottom: 22px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--fcw-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: var(--fcw-shadow);
	border: none;
	z-index: 999999;
	transition: transform .15s ease, background .15s ease;
}
.fcw-bubble:hover { background: var(--fcw-primary-dark); transform: scale(1.05); }
.fcw-bubble__badge {
	position: absolute;
	top: -2px;
	right: -2px;
	background: #ef4444;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	border-radius: 999px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	border: 2px solid #fff;
}

.fcw-panel {
	position: fixed;
	right: 22px;
	bottom: 96px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 140px);
	background: var(--fcw-bg);
	border-radius: var(--fcw-radius);
	box-shadow: var(--fcw-shadow);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 999999;
	border: 1px solid var(--fcw-border);
}

.fcw-panel__head {
	background: var(--fcw-primary);
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}
.fcw-panel__head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.fcw-panel__head p { margin: 2px 0 0; font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.fcw-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #d1d5db; flex-shrink: 0; }
.fcw-status-dot.is-online { background: #22c55e; }
.fcw-panel__close {
	background: rgba(255,255,255,.15);
	border: none;
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.fcw-panel__close:hover { background: rgba(255,255,255,.28); }

.fcw-form {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	overflow-y: auto;
}
.fcw-form p { margin: 0 0 4px; font-size: 13px; color: var(--fcw-text-soft); }
.fcw-label { font-size: 12px; font-weight: 600; color: var(--fcw-text); margin-bottom: -6px; }
.fcw-input, .fcw-textarea {
	width: 100%;
	border: 1px solid var(--fcw-border);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	color: var(--fcw-text);
	background: var(--fcw-bg-soft);
	outline: none;
	resize: none;
}
.fcw-input:focus, .fcw-textarea:focus { border-color: var(--fcw-primary); background: #fff; }
.fcw-btn {
	border: none;
	border-radius: 10px;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
}
.fcw-btn--primary { background: var(--fcw-primary); color: #fff; }
.fcw-btn--primary:hover { background: var(--fcw-primary-dark); }
.fcw-btn--ghost { background: transparent; color: var(--fcw-text-soft); }
.fcw-btn:disabled { opacity: .6; cursor: default; }
.fcw-error { color: #dc2626; font-size: 12.5px; margin: 0; min-height: 16px; }

.fcw-thread {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: 0;
}
.fcw-thread__messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: var(--fcw-bg-soft);
}
.fcw-msg {
	max-width: 80%;
	padding: 9px 12px;
	border-radius: 14px;
	font-size: 13.5px;
	word-wrap: break-word;
	white-space: pre-wrap;
}
.fcw-msg--visitor {
	align-self: flex-end;
	background: var(--fcw-bubble-visitor);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.fcw-msg--admin {
	align-self: flex-start;
	background: var(--fcw-bubble-admin);
	color: var(--fcw-text);
	border-bottom-left-radius: 4px;
}
.fcw-msg--system {
	align-self: center;
	background: transparent;
	color: var(--fcw-text-soft);
	font-size: 12px;
	text-align: center;
}
.fcw-thread__composer {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--fcw-border);
	background: #fff;
	flex-shrink: 0;
}
.fcw-thread__composer .fcw-textarea { max-height: 80px; }
.fcw-thread__composer .fcw-btn { flex-shrink: 0; width: 42px; height: 42px; padding: 0; border-radius: 50%; }

@media (max-width: 420px) {
	.fcw-panel { right: 12px; left: 12px; width: auto; bottom: 88px; }
	.fcw-bubble { right: 16px; bottom: 16px; }
}
