#ct-widget-root {
	--ct-brand: var(--wd-brand-color, #2563eb);
	--ct-bg: #f7f8fa;
	--ct-border: #e4e7eb;
	--ct-text: #1f2430;
	direction: rtl;
	font-family: inherit;
}

/* ===== دکمه‌های شناور ===== */
.ct-fab-stack {
	position: fixed;
	bottom: 22px;
	left: auto;
	right: 22px;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.ct-fab {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: none;
	background: var(--ct-brand);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 16px rgba(0,0,0,0.22);
	position: relative;
	transition: transform 0.2s;
}
.ct-fab:hover { transform: scale(1.06); }

.ct-fab-badge {
	position: absolute;
	top: -2px;
	right: -2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #ef4444;
	border: 2px solid #fff;
}

.ct-fab-status {
	position: absolute;
	bottom: 2px;
	left: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 2px solid #fff;
}
.ct-fab-status.ct-online { background: #22c55e; }
.ct-fab-status.ct-offline { background: #9ca3af; }

.ct-call-wrap { position: relative; }
.ct-fab-call { background: #16a34a; }

.ct-call-menu {
	position: absolute;
	bottom: 68px;
	right: 0;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 6px 20px rgba(0,0,0,0.18);
	padding: 8px;
	display: none;
	min-width: 200px;
	border: 1px solid var(--ct-border);
}
.ct-call-wrap:hover .ct-call-menu,
.ct-call-wrap.ct-open .ct-call-menu { display: block; }

.ct-call-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 6px;
	text-decoration: none;
	color: var(--ct-text);
}
.ct-call-item:hover { background: var(--ct-bg); }
.ct-call-label { font-weight: 600; font-size: 13.5px; }
.ct-call-number { font-size: 13px; color: #6b7280; }

/* ===== پنل چت ===== */
.ct-panel {
	position: fixed;
	bottom: 95px;
	right: 22px;
	width: 370px;
	max-width: calc(100vw - 30px);
	height: 550px;
	max-height: 75vh;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(0,0,0,0.25);
	display: none;
	flex-direction: column;
	overflow: hidden;
	z-index: 99998;
	border: 1px solid var(--ct-border);
}
.ct-panel.ct-open { display: flex; }

.ct-panel-header {
	background: var(--ct-brand);
	color: #fff;
	padding: 16px 18px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-shrink: 0;
}
.ct-header-title { font-weight: 700; font-size: 16px; }
.ct-header-status { font-size: 12.5px; opacity: 0.92; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.ct-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ct-dot-online { background: #4ade80; }
.ct-dot-offline { background: #d1d5db; }

.ct-panel-close {
	background: rgba(255,255,255,0.15);
	border: none;
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 14px;
}

.ct-panel-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: var(--ct-bg);
}

.ct-stage { display: flex; flex-direction: column; gap: 12px; height: 100%; }

.ct-welcome-text, .ct-offline-intro { font-size: 14px; color: var(--ct-text); line-height: 1.7; margin: 0 0 4px; }

.ct-field { display: flex; flex-direction: column; gap: 5px; }
.ct-field label { font-size: 13px; font-weight: 600; color: var(--ct-text); }
.ct-field input, .ct-field textarea {
	padding: 10px 12px;
	border: 1.5px solid var(--ct-border);
	border-radius: 8px;
	font-size: 14.5px;
	font-family: inherit;
	background: #fff;
	box-sizing: border-box;
	width: 100%;
}
.ct-field input:focus, .ct-field textarea:focus { outline: none; border-color: var(--ct-brand); }

.ct-error { color: #e11d48; font-size: 13px; min-height: 16px; }

.ct-btn-primary {
	padding: 12px;
	border: none;
	border-radius: 10px;
	background: var(--ct-brand);
	color: #fff;
	font-size: 14.5px;
	font-weight: 700;
	cursor: pointer;
}
.ct-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== پیام‌ها ===== */
.ct-messages {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 10px;
}

.ct-msg {
	max-width: 82%;
	padding: 10px 13px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.6;
	word-wrap: break-word;
	white-space: pre-wrap;
}
.ct-msg-customer {
	align-self: flex-end;
	background: var(--ct-brand);
	color: #fff;
	border-bottom-left-radius: 3px;
}
.ct-msg-operator, .ct-msg-system {
	align-self: flex-start;
	background: #fff;
	color: var(--ct-text);
	border: 1px solid var(--ct-border);
	border-bottom-right-radius: 3px;
}
.ct-msg-meta { font-size: 11px; opacity: 0.7; margin-top: 4px; }

.ct-offline-form { border-top: 1px dashed var(--ct-border); padding-top: 14px; margin-top: 6px; display: flex; flex-direction: column; gap: 10px; }

/* ===== نوار ورودی چت زنده ===== */
.ct-panel-footer {
	flex-shrink: 0;
	border-top: 1px solid var(--ct-border);
	padding: 10px;
	display: flex;
	gap: 8px;
	background: #fff;
}
.ct-panel-footer input {
	flex: 1;
	padding: 11px 14px;
	border: 1.5px solid var(--ct-border);
	border-radius: 22px;
	font-size: 14px;
	font-family: inherit;
}
.ct-panel-footer input:focus { outline: none; border-color: var(--ct-brand); }
.ct-send-btn {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: none;
	background: var(--ct-brand);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transform: scaleX(-1);
}

/* ===== ریسپانسیو موبایل: پنل تمام‌صفحه ===== */
@media (max-width: 480px) {
	.ct-fab-stack { bottom: 16px; right: 16px; }
	.ct-fab { width: 54px; height: 54px; }
	.ct-panel {
		bottom: 0;
		right: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
	}
	.ct-call-menu { right: -10px; }
}

@media (min-width: 481px) and (max-width: 900px) {
	.ct-panel { width: 340px; height: 500px; }
}
