/* Samaneh Amlak — assistant widget */
.nmc {
	--nmc-brand: var(--green, #1B7A8A);
	--nmc-brand-2: var(--green-dark, #0D3F4A);
	--nmc-accent: var(--accent, #C0561A);
	--nmc-ink: var(--ink, #14232A);
	--nmc-muted: var(--muted, #51626A);
	--nmc-line: var(--line, #D9E4E8);
	--nmc-bg: #F3F7F8;
	--nmc-mint: var(--mint, #E1F1F4);
	--nmc-gap: 20px;
	--nmc-bottom: 20px;
	position: fixed;
	right: var(--nmc-gap);
	bottom: var(--nmc-bottom);
	z-index: 9990;
	font-family: inherit;
	direction: rtl;
	color: var(--nmc-ink);
	line-height: 1.8;
	-webkit-font-smoothing: antialiased;
}
.nmc *, .nmc *::before, .nmc *::after { box-sizing: border-box; }
.nmc [hidden] { display: none !important; }
.nmc svg { width: 22px; height: 22px; display: block; }
.nmc-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Launcher */
.nmc-launch {
	position: relative;
	width: 62px; height: 62px;
	border: 0; border-radius: 50%;
	background: linear-gradient(145deg, #23909F, var(--nmc-brand) 45%, var(--nmc-brand-2));
	color: #fff;
	display: grid; place-items: center;
	cursor: pointer;
	box-shadow: 0 10px 28px rgba(13, 63, 74, .35), 0 2px 6px rgba(13, 63, 74, .25);
	transition: transform .2s ease, box-shadow .2s ease;
}
.nmc-launch:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 34px rgba(13, 63, 74, .42); }
.nmc-launch:focus-visible { outline: 3px solid var(--nmc-accent); outline-offset: 3px; }
.nmc-launch svg { width: 28px; height: 28px; }
.nmc-launch__icon, .nmc-launch__close { grid-area: 1 / 1; transition: transform .25s ease, opacity .2s ease; }
.nmc-launch__close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.nmc.is-open .nmc-launch__icon { opacity: 0; transform: rotate(90deg) scale(.6); }
.nmc.is-open .nmc-launch__close { opacity: 1; transform: none; }
.nmc-dot {
	position: absolute; top: 5px; right: 6px;
	width: 13px; height: 13px; border-radius: 50%;
	background: #2BC46E; border: 2px solid #fff;
}
.nmc:not(.is-open) .nmc-launch::after {
	content: ""; position: absolute; inset: 0; border-radius: 50%;
	border: 2px solid var(--nmc-brand);
	animation: nmc-ping 2.8s ease-out infinite;
}
@keyframes nmc-ping { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(1.45); opacity: 0; } }

/* Teaser */
.nmc-teaser {
	position: absolute; right: 0; bottom: 76px;
	width: max-content; max-width: min(290px, calc(100vw - 40px));
	background: #fff; border: 1px solid var(--nmc-line); border-radius: 18px 18px 4px 18px;
	padding: 12px 16px 12px 34px;
	box-shadow: 0 12px 30px rgba(20, 35, 42, .16);
	cursor: pointer;
	animation: nmc-in .35s ease both;
}
.nmc-teaser p { margin: 0; font-size: 14px; font-weight: 600; color: var(--nmc-ink); }
.nmc-teaser__x { position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border: 0; background: transparent; color: var(--nmc-muted); border-radius: 50%; cursor: pointer; padding: 3px; }
.nmc-teaser__x svg { width: 16px; height: 16px; }

/* Panel */
.nmc-panel {
	position: absolute; right: 0; bottom: 78px;
	width: 390px; height: min(640px, calc(100vh - 120px));
	background: var(--nmc-bg);
	border-radius: 22px;
	overflow: hidden;
	display: flex; flex-direction: column;
	box-shadow: 0 24px 60px rgba(13, 40, 50, .28), 0 0 0 1px rgba(13, 63, 74, .08);
	animation: nmc-in .28s cubic-bezier(.2, .8, .2, 1) both;
	transform-origin: bottom right;
}
@keyframes nmc-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

.nmc-head {
	display: flex; align-items: center; gap: 10px;
	padding: 14px 14px 14px 10px;
	background: linear-gradient(135deg, var(--nmc-brand-2), var(--nmc-brand));
	color: #fff;
}
.nmc-ava { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); }
.nmc-ava img { width: 40px; height: 40px; border-radius: 50%; object-fit: contain; }
.nmc-ava svg { color: var(--nmc-brand); }
.nmc-ava i { position: absolute; bottom: 1px; right: 1px; width: 11px; height: 11px; border-radius: 50%; background: #2BC46E; border: 2px solid var(--nmc-brand-2); }
.nmc-head__t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.5; }
.nmc-head__t strong { font-size: 15.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nmc-head__t small { font-size: 12px; opacity: .85; }
.nmc-ibtn { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; text-decoration: none; transition: background .15s; }
.nmc-ibtn:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.nmc-ibtn svg { width: 19px; height: 19px; }

/* Log */
.nmc-log {
	flex: 1; overflow-y: auto; overscroll-behavior: contain;
	padding: 18px 14px 8px;
	display: flex; flex-direction: column; gap: 10px;
	background:
		radial-gradient(circle at 100% 0, rgba(27, 122, 138, .07), transparent 40%),
		var(--nmc-bg);
	scrollbar-width: thin;
}
.nmc-row { display: flex; flex-direction: column; max-width: 100%; }
.nmc-row.is-new { animation: nmc-msg .25s ease both; }
@keyframes nmc-msg { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.nmc-row--me { align-items: flex-start; }
.nmc-row--bot { align-items: flex-end; }
.nmc-bubble {
	max-width: 86%;
	padding: 10px 14px;
	font-size: 14.5px;
	border-radius: 18px;
	overflow-wrap: anywhere;
}
.nmc-row--me .nmc-bubble { background: var(--nmc-brand); color: #fff; border-bottom-right-radius: 5px; }
.nmc-row--bot .nmc-bubble { background: #fff; color: var(--nmc-ink); border: 1px solid var(--nmc-line); border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(20, 35, 42, .04); }
.nmc-bubble a { color: var(--nmc-brand); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.nmc-row--me .nmc-bubble a { color: #fff; }
.nmc-bubble strong { font-weight: 800; }
.nmc-bubble--err { background: #FCEBDD !important; border-color: #F3C9A8 !important; }

.nmc-typing .nmc-bubble { display: flex; gap: 5px; padding: 14px 16px; }
.nmc-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--nmc-brand); opacity: .35; animation: nmc-dot 1.2s infinite; }
.nmc-typing i:nth-child(2) { animation-delay: .15s; }
.nmc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes nmc-dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* Listing cards */
.nmc-cards {
	width: calc(100% + 28px); margin: 8px -14px 0;
	display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
	padding: 2px 14px 8px;
	scrollbar-width: none;
}
.nmc-cards::-webkit-scrollbar { display: none; }
.nmc-card {
	flex: 0 0 214px; scroll-snap-align: start;
	background: #fff; border: 1px solid var(--nmc-line); border-radius: 16px; overflow: hidden;
	color: var(--nmc-ink); text-decoration: none;
	display: flex; flex-direction: column;
	transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.nmc-card:hover { transform: translateY(-2px); border-color: var(--nmc-brand); box-shadow: 0 8px 20px rgba(13, 63, 74, .12); color: var(--nmc-ink); }
.nmc-card img, .nmc-card__ph { width: 100%; height: 118px; object-fit: cover; background: var(--nmc-mint); display: block; }
.nmc-card__ph { background: linear-gradient(135deg, var(--nmc-mint), #CFE6EA); }
.nmc-card__b { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px 11px; line-height: 1.6; }
.nmc-card__p { font-size: 13.5px; font-weight: 800; color: var(--nmc-brand-2); }
.nmc-card__t { font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 42px; }
.nmc-card__m { font-size: 12px; color: var(--nmc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nmc-card__c { font-size: 11.5px; color: var(--nmc-accent); font-weight: 700; }

.nmc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.nmc-action { font-size: 13px; font-weight: 700; color: var(--nmc-brand); background: var(--nmc-mint); padding: 6px 12px; border-radius: 999px; text-decoration: none; }
.nmc-action:hover { background: #CFE6EA; color: var(--nmc-brand-2); }

/* Quick replies */
.nmc-quick { display: flex; gap: 6px; overflow-x: auto; padding: 6px 14px 8px; scrollbar-width: none; background: var(--nmc-bg); }
.nmc-quick::-webkit-scrollbar { display: none; }
.nmc-quick button {
	flex: none; font: inherit; font-size: 13px; font-weight: 600; line-height: 1.5;
	padding: 7px 13px; border-radius: 999px;
	border: 1px solid rgba(27, 122, 138, .35); background: #fff; color: var(--nmc-brand-2);
	cursor: pointer; transition: background .15s, border-color .15s;
}
.nmc-quick button:hover { background: var(--nmc-mint); border-color: var(--nmc-brand); }

/* Composer */
.nmc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--nmc-line); }
.nmc-form textarea {
	flex: 1; resize: none; font: inherit; font-size: 15px; line-height: 1.7;
	min-height: 44px; max-height: 120px;
	padding: 9px 14px; border-radius: 16px;
	border: 1px solid var(--nmc-line); background: var(--nmc-bg); color: var(--nmc-ink);
	outline: none; box-shadow: none; margin: 0;
}
.nmc-form textarea:focus { border-color: var(--nmc-brand); background: #fff; box-shadow: 0 0 0 3px rgba(27, 122, 138, .15); }
.nmc-send {
	flex: none; width: 44px; height: 44px; border: 0; border-radius: 14px;
	background: var(--nmc-accent); color: #fff; display: grid; place-items: center; cursor: pointer;
	transition: background .15s, transform .15s;
}
.nmc-send:hover { background: #9C4412; }
.nmc-send:disabled { opacity: .55; cursor: wait; }
.nmc-foot { margin: 0; padding: 0 12px 9px; background: #fff; font-size: 11px; color: var(--nmc-muted); text-align: center; line-height: 1.6; }
.nmc-foot a { color: var(--nmc-brand); }

/* Leave room for the theme's mobile call bar */
@media (max-width: 960px) {
	.nmc--bar { --nmc-bottom: calc(84px + env(safe-area-inset-bottom)); }
	/* حباب کوچک‌تر، تا روی قیمت کارت‌ها کمتر بیفتد. */
	.nmc-launch { width: 52px; height: 52px; }
	.nmc-launch svg { width: 24px; height: 24px; }
}
@media (max-width: 560px) {
	.nmc { --nmc-gap: 14px; }
	.nmc-launch { width: 56px; height: 56px; }
	.nmc-panel {
		position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh;
		border-radius: 0; bottom: 0; right: 0;
	}
	.nmc-head { padding-top: calc(12px + env(safe-area-inset-top)); }
	.nmc-form { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
	.nmc.is-open .nmc-launch { display: none; }
	.nmc-form textarea { font-size: 16px; }
	html.nmc-lock, html.nmc-lock body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
	.nmc *, .nmc *::after { animation: none !important; transition: none !important; }
}
@media print { .nmc { display: none; } }
