/**
 * NeuroDesk AI — چت‌باکس شناور (فرانتاند) — الگوی Crisp
 * رنگ‌ها و اندازه‌ها از متغیرهای CSS تزریقی (.nrdk-root) می‌آیند.
 */

.nrdk-root {
	position: relative;
	font-family: inherit;
	--nrdk-shadow: 0 18px 50px rgba(15, 23, 42, .22);
	--nrdk-ring: 0 0 0 6px rgba(255, 255, 255, .12);
}

.nrdk-root *,
.nrdk-root *::before,
.nrdk-root *::after { box-sizing: border-box; }

.nrdk-hidden { display: none !important; }

/* ---------- دکمهٔ شناور ---------- */
.nrdk-root .nrdk-launcher {
	width: var(--nrdk-size, 58px);
	height: var(--nrdk-size, 58px);
	border-radius: var(--nrdk-shape, 50%);
	background: var(--nrdk-brand, #6d28d9);
	color: var(--nrdk-icon, #fff);
	border: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--nrdk-shadow);
	transition: transform .2s ease, box-shadow .2s ease;
	padding: 0;
	z-index: 2;
	position: relative;
	overflow: hidden;
}

.nrdk-root .nrdk-launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(255, 255, 255, .25), rgba(255, 255, 255, 0) 55%);
	pointer-events: none;
}

.nrdk-root .nrdk-launcher:hover,
.nrdk-root .nrdk-launcher:focus-visible {
	transform: translateY(-3px) scale(1.05);
	box-shadow: var(--nrdk-shadow), var(--nrdk-ring);
	outline: none;
}

.nrdk-root .nrdk-launcher img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
}

.nrdk-root .nrdk-launcher .nrdk-symbol {
	font-size: calc(var(--nrdk-size, 58px) * .46);
	line-height: 1;
	position: relative;
}

/* هالهٔ نبض */
.nrdk-root .nrdk-launcher::before {
	content: "";
	position: absolute;
	inset: -6px;
	border-radius: inherit;
	box-shadow: 0 0 0 0 var(--nrdk-brand, #6d28d9);
	opacity: 0;
	animation: nrdkPing 2.6s ease-out infinite;
	pointer-events: none;
}

@keyframes nrdkPing {
	0% { box-shadow: 0 0 0 0 var(--nrdk-brand, #6d28d9); opacity: .55; }
	70% { box-shadow: 0 0 0 16px transparent; opacity: 0; }
	100% { box-shadow: 0 0 0 16px transparent; opacity: 0; }
}

/* نشان پیام جدید */
.nrdk-root .nrdk-launcher-dot {
	display: none;
	position: absolute;
	top: 4px;
	inset-inline-end: 4px;
	width: 13px;
	height: 13px;
	border-radius: 50%;
	background: #22c55e;
	border: 2px solid #fff;
	z-index: 3;
}

.nrdk-root .nrdk-launcher.nrdk-unread .nrdk-launcher-dot { display: block; }

/* ---------- حباب تشویقی ---------- */
.nrdk-root .nrdk-teaser {
	position: fixed;
	display: flex;
	align-items: center;
	gap: 9px;
	background: #fff;
	color: #0f172a;
	border-radius: 16px;
	border-end-end-radius: 4px;
	padding: 9px 12px;
	font-size: 13px;
	max-width: 250px;
	box-shadow: var(--nrdk-shadow);
	z-index: 3;
	animation: nrdkTeaserIn .3s ease;
}

@keyframes nrdkTeaserIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

.nrdk-root .nrdk-teaser-av {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--nrdk-brand, #6d28d9);
	color: #fff;
	font-size: 13px;
	font-style: normal;
	font-weight: 700;
}

.nrdk-root .nrdk-teaser-av img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nrdk-root .nrdk-teaser .nrdk-teaser-close {
	margin-inline-start: 4px;
	cursor: pointer;
	font-weight: bold;
	opacity: .55;
	flex: 0 0 auto;
}

/* ---------- پنجرهٔ گفتگو ---------- */
.nrdk-root .nrdk-window {
	background: var(--nrdk-body, #f8fafc);
	color: var(--nrdk-text, #0f172a);
	border-radius: var(--nrdk-radius, 18px);
	box-shadow: var(--nrdk-shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	z-index: 2;
	opacity: 0;
	pointer-events: none;
	transition: opacity .22s ease, transform .22s ease;
	border: 1px solid rgba(15, 23, 42, .06);
}

.nrdk-root .nrdk-window.nrdk-open { opacity: 1; pointer-events: auto; }

/* ---------- سربرگ (الگوی Crisp) ---------- */
.nrdk-root .nrdk-header {
	background: var(--nrdk-hbg, #6d28d9);
	color: var(--nrdk-hcolor, #fff);
	padding: 12px 14px;
	display: flex;
	align-items: center;
	gap: 11px;
	position: relative;
}

.nrdk-root .nrdk-header::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(255, 255, 255, .18), rgba(0, 0, 0, .08));
	pointer-events: none;
}

/* آواتارها */
.nrdk-root .nrdk-avatar {
	position: relative;
	flex: 0 0 auto;
	border-radius: 50%;
	overflow: visible;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--nrdk-accent, #6d28d9), var(--nrdk-brand, #6d28d9));
	color: #fff;
	font-weight: 700;
}

.nrdk-root .nrdk-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.nrdk-root .nrdk-avatar.nrdk-avatar-lg {
	width: 40px;
	height: 40px;
	font-size: 17px;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .35);
	z-index: 1;
}

.nrdk-root .nrdk-avatar.nrdk-avatar-sm {
	width: 27px;
	height: 27px;
	font-size: 12px;
	flex: 0 0 27px;
	margin-top: auto;
}

.nrdk-root .nrdk-avatar .nrdk-initial { line-height: 1; font-style: normal; }

/* نقطهٔ آنلاین */
.nrdk-root .nrdk-dot,
.nrdk-root .nrdk-on-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #22c55e;
	box-shadow: 0 0 0 0 rgba(34, 197, 94, .7);
	animation: nrdkOnline 2s infinite;
}

.nrdk-root .nrdk-on-dot {
	position: absolute;
	bottom: 0;
	inset-inline-end: 0;
	width: 11px;
	height: 11px;
	border: 2px solid var(--nrdk-hbg, #6d28d9);
}

@keyframes nrdkOnline {
	0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
	70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
	100% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

.nrdk-root .nrdk-header-info {
	display: flex;
	flex-direction: column;
	min-width: 0;
	z-index: 1;
}

.nrdk-root .nrdk-title {
	font-size: calc(var(--nrdk-fs, 14px) + 2px);
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 190px;
}

.nrdk-root .nrdk-sub {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: calc(var(--nrdk-fs, 14px) - 3px);
	opacity: .95;
	min-height: 14px;
}

.nrdk-root .nrdk-sub .nrdk-dot { width: 7px; height: 7px; flex: 0 0 7px; }

.nrdk-root .nrdk-role { font-style: normal; }

.nrdk-root .nrdk-balance {
	font-size: calc(var(--nrdk-fs, 14px) - 4px);
	opacity: .8;
	direction: ltr;
}

.nrdk-root .nrdk-header-actions {
	display: flex;
	gap: 3px;
	margin-inline-start: auto;
	z-index: 1;
}

.nrdk-root .nrdk-header-actions button {
	background: transparent;
	border: 0;
	color: inherit;
	cursor: pointer;
	font-size: 17px;
	line-height: 1;
	padding: 5px 8px;
	border-radius: 9px;
	opacity: .9;
	transition: background .15s ease, transform .15s ease;
}

.nrdk-root .nrdk-header-actions button:hover {
	background: rgba(255, 255, 255, .2);
	opacity: 1;
	transform: translateY(-1px);
}

/* حالت کوچک‌شده */
.nrdk-root .nrdk-window.nrdk-minimized .nrdk-msgs,
.nrdk-root .nrdk-window.nrdk-minimized .nrdk-inputrow { display: none; }

/* ---------- پیام‌ها ---------- */
.nrdk-root .nrdk-msgs {
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	scroll-behavior: smooth;
	background-image: radial-gradient(rgba(15, 23, 42, .045) 1px, transparent 1px);
	background-size: 18px 18px;
}

.nrdk-root .nrdk-row {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	max-width: 88%;
	align-self: flex-start;
}

.nrdk-root .nrdk-row .nrdk-msg { flex: 1 1 auto; }

.nrdk-root .nrdk-msg {
	max-width: 82%;
	padding: 10px 13px;
	border-radius: 16px;
	font-size: var(--nrdk-fs, 14px);
	line-height: 1.7;
	white-space: pre-wrap;
	word-break: break-word;
	animation: nrdkMsgIn .18s ease;
}

@keyframes nrdkMsgIn {
	from { opacity: 0; transform: translateY(5px); }
	to { opacity: 1; transform: translateY(0); }
}

.nrdk-root .nrdk-msg.nrdk-user {
	align-self: flex-end;
	background: var(--nrdk-ubg, #6d28d9);
	color: var(--nrdk-ucolor, #fff);
	border-end-end-radius: 5px;
	box-shadow: 0 4px 12px -4px var(--nrdk-ubg, #6d28d9);
}

.nrdk-root .nrdk-msg.nrdk-bot {
	align-self: flex-start;
	background: var(--nrdk-bbg, #fff);
	color: var(--nrdk-bcolor, #0f172a);
	border-end-start-radius: 5px;
	box-shadow: 0 1px 5px rgba(15, 23, 42, .08);
}

.nrdk-root .nrdk-msg.nrdk-error {
	color: #b91c1c;
	align-self: center;
	font-size: calc(var(--nrdk-fs, 14px) - 1px);
	background: #fee2e2;
	border-radius: 10px;
	padding: 7px 11px;
}

.nrdk-root .nrdk-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.nrdk-root .nrdk-typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--nrdk-accent, #6d28d9);
	animation: nrdkBlink 1.2s infinite ease-in-out;
}
.nrdk-root .nrdk-typing i:nth-child(2) { animation-delay: .18s; }
.nrdk-root .nrdk-typing i:nth-child(3) { animation-delay: .36s; }

@keyframes nrdkBlink {
	0%, 80%, 100% { opacity: .25; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

/* انیمیشن بازشدن پنجره */
.nrdk-root[data-anim="slide"] .nrdk-window { transform: translateY(16px); }
.nrdk-root[data-anim="slide"] .nrdk-window.nrdk-open { transform: translateY(0); }
.nrdk-root[data-anim="scale"] .nrdk-window { transform: scale(.92); transform-origin: bottom; }
.nrdk-root[data-anim="scale"] .nrdk-window.nrdk-open { transform: scale(1); }
.nrdk-root[data-anim="fade"] .nrdk-window { transform: none; }

/* ---------- کامپوزر (بدون textarea، الگوی Crisp) ---------- */
.nrdk-root .nrdk-inputrow {
	padding: 10px 12px 6px;
	background: var(--nrdk-bbg, #fff);
	border-top: 1px solid rgba(15, 23, 42, .07);
}

.nrdk-root .nrdk-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	border: 1.5px solid rgba(15, 23, 42, .12);
	border-radius: 22px;
	background: var(--nrdk-body, #f8fafc);
	padding: 4px 4px 4px 14px;
	transition: border-color .16s ease, box-shadow .16s ease;
}

.nrdk-root[dir="rtl"] .nrdk-composer { padding: 4px 14px 4px 4px; }

.nrdk-root .nrdk-composer:focus-within {
	border-color: var(--nrdk-accent, #6d28d9);
	box-shadow: 0 0 0 3px -1px var(--nrdk-accent, #6d28d9);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--nrdk-accent, #6d28d9) 25%, transparent);
}

.nrdk-root .nrdk-input {
	flex: 1 1 auto;
	min-height: 38px;
	max-height: 132px;
	overflow-y: auto;
	outline: none;
	border: 0;
	background: transparent;
	font-size: var(--nrdk-fs, 14px);
	font-family: inherit;
	line-height: 1.6;
	padding: 8px 0;
	color: var(--nrdk-text, #0f172a);
	word-break: break-word;
}

.nrdk-root .nrdk-input:empty::before {
	content: attr(data-placeholder);
	color: #94a3b8;
	pointer-events: none;
}

.nrdk-root .nrdk-send {
	border: 0;
	background: linear-gradient(135deg, var(--nrdk-accent, #6d28d9), var(--nrdk-ubg, #6d28d9));
	color: #fff;
	border-radius: 50%;
	width: 38px;
	height: 38px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
	box-shadow: 0 6px 14px -6px var(--nrdk-accent, #6d28d9);
}

.nrdk-root .nrdk-send:hover { transform: scale(1.08) rotate(-8deg); filter: brightness(1.07); }
.nrdk-root .nrdk-send:disabled { opacity: .55; cursor: default; transform: none; }
.nrdk-root .nrdk-send svg { display: block; }

/*
 * آینه‌کردن دکمهٔ ارسال در حالت راست‌چین.
 * توجه: dir روی خود .nrdk-root قرار می‌گیرد، پس سلکتور باید صفت را روی همان عنصر بخواند
 * (با [dir="rtl"] .nrdk-root فقط وقتی کار می‌کرد که زبان کل سایت راست‌چین باشد).
 */
.nrdk-root[dir="rtl"] .nrdk-send svg { transform: scaleX(-1); }

.nrdk-root .nrdk-composer-note {
	font-size: calc(var(--nrdk-fs, 14px) - 4px);
	opacity: .55;
	text-align: center;
	padding: 4px 0 2px;
}

/* ---------- متفرقه ---------- */
.nrdk-root .nrdk-powered {
	font-size: calc(var(--nrdk-fs, 14px) - 3px);
	opacity: .6;
	text-align: center;
	padding: 4px 0 6px;
}

/* حالت درون‌صفحه‌ای (کد کوتاه) */
.nrdk-root.nrdk-inline .nrdk-window {
	position: static !important;
	margin: 0 !important;
	width: 100% !important;
	max-width: 100% !important;
	opacity: 1;
	pointer-events: auto;
	transform: none;
	box-shadow: 0 4px 18px rgba(15, 23, 42, .08);
}

.nrdk-root.nrdk-inline .nrdk-msgs { height: 380px !important; }

/* موبایل و حرکت کم */
@media (max-width: 480px) {
	.nrdk-root.nrdk-hide-mobile { display: none !important; }
	.nrdk-root .nrdk-window { max-height: 76vh; }
	.nrdk-root .nrdk-msgs { max-height: 60vh; height: auto !important; }
}

@media (prefers-reduced-motion: reduce) {
	.nrdk-root *,
	.nrdk-root *::before,
	.nrdk-root *::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}


