#tlc-widget-root {
	position: fixed;
	z-index: 999999;
	font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
	--tlc-brand: #E2540A;
	--tlc-brand-light: #FF8A4D;
	--tlc-brand-dark: #C2450A;
	--tlc-visitor: #E2540A;
	--tlc-visitor-light: #FF8A4D;
	--tlc-visitor-dark: #C2450A;
	--tlc-agent: #F1F1F3;
	--tlc-radius: 16px;
	display: none;
	-webkit-font-smoothing: antialiased;
}
#tlc-widget-root.tlc-visible { display: block; animation: tlc-pop-in .35s cubic-bezier(.34,1.56,.64,1); }

@keyframes tlc-pop-in {
	from { opacity: 0; transform: scale(.7) translateY(10px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- حباب شناور (FAB) ---------- */

.tlc-bubble {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--tlc-brand-light), var(--tlc-brand-dark));
	box-shadow: 0 14px 28px -8px color-mix(in srgb, var(--tlc-brand) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.4);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	border: 1px solid rgba(255,255,255,.3);
	position: relative;
	transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
	padding: 0 18px;
	gap: 8px;
	color: #fff;
	font-family: inherit;
	font-weight: 700;
	font-size: 13px;
	white-space: nowrap;
}
.tlc-bubble:hover { transform: scale(1.07) translateY(-2px); }
.tlc-bubble:active { transform: scale(.96); }
.tlc-bubble svg { width: 22px; height: 22px; flex-shrink: 0; transition: transform .3s ease; }
.tlc-bubble.tlc-is-open .tlc-icon-chat { transform: rotate(90deg) scale(0); position: absolute; opacity: 0; }
.tlc-bubble .tlc-icon-close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(0); }
.tlc-bubble.tlc-is-open .tlc-icon-close { opacity: 1; transform: rotate(0) scale(1); position: static; }

#tlc-widget-root.tlc-shape-circle .tlc-bubble { width: 58px; border-radius: 50%; padding: 0; }
#tlc-widget-root.tlc-shape-rounded .tlc-bubble { width: 58px; border-radius: 20px; padding: 0; }
#tlc-widget-root.tlc-shape-pill .tlc-bubble { width: auto; border-radius: 30px; }
#tlc-widget-root.tlc-shape-pill .tlc-bubble .tlc-bubble-label { display: inline; }
.tlc-bubble-label { display: none; }

.tlc-bubble-badge {
	position: absolute;
	top: -3px;
	left: -3px;
	background: #ef3f3f;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	min-width: 19px;
	height: 19px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 5px;
	box-shadow: 0 0 0 3px #fff;
	animation: tlc-badge-pop .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes tlc-badge-pop { from { transform: scale(0); } to { transform: scale(1); } }

/* ---------- پنجره‌ی شیشه‌ای (Glassmorphism) ---------- */

.tlc-panel {
	position: absolute;
	bottom: 72px;
	width: 366px;
	max-width: 90vw;
	height: 520px;
	max-height: 72vh;
	background: rgba(255,255,255,.68);
	border: 1px solid rgba(255,255,255,.8);
	border-radius: var(--tlc-radius);
	backdrop-filter: blur(22px);
	-webkit-backdrop-filter: blur(22px);
	box-shadow:
		0 30px 60px -20px color-mix(in srgb, var(--tlc-brand) 30%, rgba(20,10,0,.35)),
		0 2px 8px rgba(20,10,0,.06),
		inset 0 1px 0 rgba(255,255,255,.9);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(16px) scale(.96);
	pointer-events: none;
	transition: opacity .22s ease, transform .22s cubic-bezier(.34,1.2,.64,1);
	transform-origin: bottom;
	color: #1E1526;
}
#tlc-widget-root[data-pos="right"] .tlc-panel { right: 0; transform-origin: bottom right; }
#tlc-widget-root[data-pos="left"]  .tlc-panel { left: 0; transform-origin: bottom left; }
#tlc-widget-root[data-pos="center"] .tlc-panel { left: 50%; margin-left: -183px; }
.tlc-panel.tlc-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* گوی‌های محو رنگی پس‌زمینه، فقط جنبه‌ی تزئینی */
.tlc-orb { position: absolute; border-radius: 50%; filter: blur(46px); z-index: 0; pointer-events: none; }
.tlc-orb-a { width: 200px; height: 200px; background: var(--tlc-brand); opacity: .22; top: -50px; right: -40px; }
.tlc-orb-b { width: 160px; height: 160px; background: var(--tlc-brand-light); opacity: .3; bottom: 30px; left: -50px; }

.tlc-panel-header {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 18px 14px;
	border-bottom: 1px solid color-mix(in srgb, var(--tlc-brand) 12%, transparent);
	flex-shrink: 0;
}
.tlc-brand-row { display: flex; align-items: center; gap: 10px; }
.tlc-brand-avatar {
	width: 38px; height: 38px; border-radius: 12px;
	background: linear-gradient(135deg, var(--tlc-brand-light), var(--tlc-brand-dark));
	display: flex; align-items: center; justify-content: center;
	font-weight: 700; font-size: 16px; color: #fff;
	box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--tlc-brand) 70%, transparent);
	flex-shrink: 0;
}
.tlc-panel-header-title { font-size: 14px; font-weight: 700; color: #1E1526; }
.tlc-panel-header-sub { font-size: 11px; color: var(--tlc-brand-dark); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.tlc-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 6px #22C55E; }
.tlc-status-dot.tlc-offline { background: #b7b7bb; box-shadow: none; }

.tlc-panel-header-actions { display: flex; align-items: center; gap: 7px; }
.tlc-panel-header-actions a,
.tlc-panel-header button.tlc-close-x {
	width: 30px; height: 30px; border-radius: 10px;
	background: color-mix(in srgb, #1E1526 5%, transparent);
	border: 1px solid color-mix(in srgb, #1E1526 10%, transparent);
	display: flex; align-items: center; justify-content: center;
	color: #1E1526;
	text-decoration: none;
	cursor: pointer;
	transition: background .15s ease, transform .15s ease;
}
.tlc-panel-header-actions a:hover,
.tlc-panel-header button.tlc-close-x:hover { background: color-mix(in srgb, #1E1526 10%, transparent); transform: scale(1.05); }
.tlc-panel-header-actions a svg,
.tlc-panel-header button.tlc-close-x svg { width: 13px; height: 13px; }
.tlc-panel-header button.tlc-close-x:hover { transform: scale(1.05) rotate(90deg); }

.tlc-panel-body {
	position: relative;
	z-index: 1;
	flex: 1;
	overflow-y: auto;
	padding: 18px 18px 6px;
	scrollbar-width: thin;
	scrollbar-color: color-mix(in srgb, var(--tlc-brand) 30%, #ddd) transparent;
}
.tlc-panel-body::-webkit-scrollbar { width: 6px; }
.tlc-panel-body::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--tlc-brand) 25%, #ddd); border-radius: 3px; }

/* ---------- کارت خوش‌آمدگویی ---------- */

.tlc-welcome {
	background: rgba(255,255,255,.55);
	border: 1px solid rgba(255,255,255,.85);
	border-radius: 18px;
	padding: 16px 18px;
	box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
	margin-bottom: 14px;
}
.tlc-welcome h1 { font-size: 16px; font-weight: 700; margin: 0; color: #1E1526; }
.tlc-welcome p { margin: 6px 0 0; font-size: 12.5px; line-height: 1.9; color: rgba(30,21,38,.62); }
.tlc-welcome.tlc-offline { background: rgba(255,247,238,.75); border-color: rgba(255,207,163,.6); }

/* ---------- چیپ‌های موضوع سریع ---------- */

.tlc-chips { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.tlc-chip {
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 14px;
	background: rgba(255,255,255,.45);
	border: 1px solid rgba(255,255,255,.8);
	border-radius: 14px;
	font-size: 12.5px;
	color: #1E1526;
	cursor: pointer;
	transition: background .15s ease, transform .12s ease;
}
.tlc-chip:hover { background: rgba(255,255,255,.7); transform: translateY(-1px); }
.tlc-chip-plus {
	width: 20px; height: 20px; border-radius: 7px;
	background: color-mix(in srgb, var(--tlc-brand) 14%, transparent);
	color: var(--tlc-brand-dark);
	display: flex; align-items: center; justify-content: center;
	font-size: 13px; flex-shrink: 0;
}

/* ---------- فرم پیش‌چت ---------- */

.tlc-prechat { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding-bottom: 12px; }
.tlc-prechat input,
.tlc-prechat textarea {
	border: 1.5px solid rgba(255,255,255,.9);
	background: rgba(255,255,255,.55);
	border-radius: 12px;
	padding: 10px 14px;
	font-size: 13.5px;
	font-family: inherit;
	width: 100%;
	box-sizing: border-box;
	resize: none;
	transition: border-color .15s ease, background .15s ease;
	color: #1E1526;
}
.tlc-prechat input::placeholder,
.tlc-prechat textarea::placeholder { color: rgba(30,21,38,.42); }
.tlc-prechat input:focus,
.tlc-prechat textarea:focus { outline: none; border-color: var(--tlc-brand); background: rgba(255,255,255,.85); }
.tlc-prechat textarea { min-height: 72px; }
.tlc-prechat button {
	background: linear-gradient(135deg, var(--tlc-brand-light), var(--tlc-brand-dark));
	color: #fff;
	border: none;
	border-radius: 12px;
	padding: 12px;
	font-weight: 700;
	font-size: 13.5px;
	cursor: pointer;
	box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--tlc-brand) 70%, transparent);
	transition: filter .15s ease, transform .1s ease;
}
.tlc-prechat button:hover { filter: brightness(1.06); }
.tlc-prechat button:active { transform: scale(.98); }
.tlc-prechat-error { color: #c0392b; font-size: 12px; display: none; }
.tlc-hp-field { position: absolute !important; left: -9999px !important; opacity: 0; height: 0; }

/* ---------- حباب‌های پیام ---------- */

.tlc-msg {
	position: relative;
	z-index: 1;
	display: table;
	max-width: 82%;
	margin-bottom: 10px;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 13.5px;
	line-height: 1.8;
	white-space: pre-wrap;
	word-wrap: break-word;
	animation: tlc-msg-in .25s ease;
}
@keyframes tlc-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

[dir="rtl"] .tlc-msg-visitor { margin-right: auto; border-bottom-right-radius: 4px; }
[dir="rtl"] .tlc-msg-agent   { margin-left: auto; border-bottom-left-radius: 4px; }
[dir="ltr"] .tlc-msg-visitor { margin-left: auto; border-bottom-left-radius: 4px; }
[dir="ltr"] .tlc-msg-agent   { margin-right: auto; border-bottom-right-radius: 4px; }

.tlc-msg-visitor {
	background: linear-gradient(135deg, var(--tlc-visitor-light), var(--tlc-visitor-dark));
	color: #fff;
	box-shadow: 0 6px 16px -6px rgba(0,0,0,.25);
}
.tlc-msg-agent {
	background: var(--tlc-agent);
	border: 1px solid rgba(0,0,0,.05);
	box-shadow: 0 2px 6px rgba(20,10,0,.08);
	color: #1E1526;
}
.tlc-msg-ai-label { font-size: 10.5px; font-weight: 700; opacity: .6; margin-bottom: 3px; }

.tlc-msg-time { display: block; font-size: 10px; opacity: .65; margin-top: 4px; }

.tlc-typing-bubble {
	position: relative; z-index: 1;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: var(--tlc-agent);
	border: 1px solid rgba(0,0,0,.05);
	box-shadow: 0 2px 6px rgba(20,10,0,.08);
	padding: 11px 14px;
	border-radius: 16px;
	margin-bottom: 10px;
}
.tlc-typing-bubble span {
	width: 6px; height: 6px; border-radius: 50%;
	background: var(--tlc-brand-dark);
	animation: tlc-typing-blink 1.2s infinite ease-in-out;
}
.tlc-typing-bubble span:nth-child(2) { animation-delay: .15s; }
.tlc-typing-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes tlc-typing-blink {
	0%, 60%, 100% { opacity: .3; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- نوار پایین: ورودی و دکمه‌ی ارسال ---------- */

.tlc-input-row {
	position: relative;
	z-index: 1;
	display: flex;
	gap: 10px;
	align-items: center;
	padding: 14px 16px 16px;
	flex-shrink: 0;
}
.tlc-input-row textarea {
	flex: 1;
	border: 1px solid rgba(255,255,255,.85);
	background: rgba(255,255,255,.5);
	border-radius: 999px;
	padding: 11px 16px;
	font-family: inherit;
	font-size: 12.5px;
	resize: none;
	max-height: 70px;
	transition: border-color .15s ease, background .15s ease;
	color: #1E1526;
}
.tlc-input-row textarea::placeholder { color: rgba(30,21,38,.4); }
.tlc-input-row textarea:focus { outline: none; border-color: var(--tlc-brand); background: rgba(255,255,255,.8); }
.tlc-input-row button {
	background: linear-gradient(135deg, var(--tlc-brand-light), var(--tlc-brand-dark));
	border: none;
	color: #fff;
	border-radius: 50%;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--tlc-brand) 70%, transparent);
	transition: transform .15s cubic-bezier(.34,1.56,.64,1), filter .15s ease;
}
.tlc-input-row button:hover { filter: brightness(1.06); transform: scale(1.05); }
.tlc-input-row button:active { transform: scale(.92); }
[dir="rtl"] .tlc-input-row button svg { transform: scaleX(-1); }
.tlc-input-row button svg { width: 16px; height: 16px; }

.tlc-attach-btn {
	background: rgba(30,21,38,.06) !important;
	color: #1E1526 !important;
	box-shadow: none !important;
}
.tlc-attach-btn:hover { background: rgba(30,21,38,.12) !important; }
[dir="rtl"] .tlc-attach-btn svg { transform: none !important; }
.tlc-attach-btn svg { width: 17px; height: 17px; }

.tlc-msg-image {
	display: block; max-width: 100%; max-height: 200px; border-radius: 10px; cursor: pointer;
}
.tlc-msg-file {
	display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit;
	font-size: 12.5px; font-weight: 600;
}

/* ---------- کارت رضایت‌سنجی (CSAT) ---------- */

.tlc-csat-card {
	position: relative; z-index: 1;
	background: rgba(255,255,255,.6);
	border: 1px solid rgba(255,255,255,.85);
	border-radius: 16px;
	padding: 14px 16px;
	margin: 4px 0 12px;
	text-align: center;
}
.tlc-csat-title { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: #1E1526; }
.tlc-csat-stars { font-size: 22px; letter-spacing: 4px; margin-bottom: 8px; direction: ltr; }
.tlc-csat-stars span { color: #d8d8dc; cursor: pointer; transition: color .12s ease, transform .12s ease; display: inline-block; }
.tlc-csat-stars span:hover { transform: scale(1.15); }
.tlc-csat-stars span.tlc-active { color: #ffb020; }
.tlc-csat-card textarea {
	width: 100%; box-sizing: border-box; border: 1.5px solid rgba(255,255,255,.9);
	background: rgba(255,255,255,.6); border-radius: 10px; padding: 8px 12px;
	font-size: 12.5px; font-family: inherit; resize: none; min-height: 50px; margin-bottom: 8px;
}
.tlc-csat-actions { display: flex; gap: 8px; }
.tlc-csat-actions button {
	flex: 1; border: none; border-radius: 10px; padding: 9px; font-size: 12.5px;
	font-weight: 700; cursor: pointer; font-family: inherit;
}
#tlc-csat-skip { background: rgba(30,21,38,.06); color: #1E1526; }
#tlc-csat-submit {
	background: linear-gradient(135deg, var(--tlc-brand-light), var(--tlc-brand-dark));
	color: #fff;
}
#tlc-csat-submit:disabled { opacity: .5; cursor: not-allowed; }
.tlc-csat-thanks { margin: 4px 0; font-size: 13px; font-weight: 700; color: var(--tlc-brand-dark); }

/* ---------- پیام پیشنهادی رفتارمحور ---------- */
.tlc-proactive {
	position: absolute;
	bottom: 72px;
	max-width: 230px;
	background: #fff;
	border: 1px solid rgba(255,255,255,.9);
	border-radius: 16px;
	padding: 14px 16px;
	box-shadow: 0 16px 40px -12px rgba(20,10,0,.28), 0 2px 8px rgba(0,0,0,.06);
	font-size: 13px;
	line-height: 1.8;
	color: #1E1526;
	cursor: pointer;
	opacity: 0;
	transform: translateY(10px) scale(.95);
	transition: opacity .25s ease, transform .25s cubic-bezier(.34,1.2,.64,1);
}
#tlc-widget-root[data-pos="right"] .tlc-proactive { right: 0; }
#tlc-widget-root[data-pos="left"]  .tlc-proactive { left: 0; }
#tlc-widget-root[data-pos="center"] .tlc-proactive { left: 50%; transform: translateX(-50%) translateY(10px) scale(.95); }
.tlc-proactive.tlc-proactive-visible { opacity: 1; transform: translateY(0) scale(1); }
#tlc-widget-root[data-pos="center"] .tlc-proactive.tlc-proactive-visible { transform: translateX(-50%) translateY(0) scale(1); }

.tlc-proactive-close {
	position: absolute;
	top: -8px;
	left: -8px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	border: 1px solid #ECECEF;
	color: #888;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
.tlc-proactive-text { padding-left: 4px; }

/* ---------- اسکلتون ---------- */
.tlc-skeleton-row { position: relative; z-index: 1; display: flex; gap: 8px; margin-bottom: 12px; }
.tlc-skeleton-bubble {
	height: 34px; border-radius: 14px;
	background: linear-gradient(90deg, rgba(255,255,255,.4) 25%, rgba(255,255,255,.7) 37%, rgba(255,255,255,.4) 63%);
	background-size: 400% 100%;
	animation: tlc-shimmer 1.4s ease infinite;
}
@keyframes tlc-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* تراکم فاصله‌گذاری */
#tlc-widget-root.tlc-compact .tlc-panel-body { padding: 12px 14px 4px; }
#tlc-widget-root.tlc-compact .tlc-msg { padding: 7px 11px; margin-bottom: 7px; font-size: 12.5px; }
#tlc-widget-root.tlc-spacious .tlc-panel-body { padding: 18px 18px 8px; }
#tlc-widget-root.tlc-spacious .tlc-msg { padding: 11px 15px; margin-bottom: 12px; }

@media (max-width: 420px) {
	.tlc-panel { width: 92vw; height: 78vh; }
}

@media (prefers-reduced-motion: reduce) {
	#tlc-widget-root.tlc-visible,
	.tlc-bubble,
	.tlc-panel,
	.tlc-msg,
	.tlc-bubble-badge { animation: none !important; transition: none !important; }
}

/* Fallback برای مرورگرهایی که backdrop-filter رو پشتیبانی نمی‌کنن */
@supports not (backdrop-filter: blur(1px)) {
	.tlc-panel { background: #fff; }
	.tlc-welcome, .tlc-chip, .tlc-prechat input, .tlc-prechat textarea, .tlc-input-row textarea, .tlc-msg-agent, .tlc-typing-bubble {
		background: #fff;
	}
}
