#nac-chat-root, #nac-chat-root * {
	box-sizing: border-box;
}

.nac-widget {
	--nac-color: #7c3aed;
	position: fixed;
	bottom: 22px;
	z-index: 999999;
	font-family: Vazirmatn, IRANYekan, Tahoma, "Segoe UI", sans-serif;
	direction: rtl;
}

.nac-pos-right { right: 22px; }
.nac-pos-left  { left: 22px; }

@media (max-width: 480px) {
	.nac-widget { bottom: 92px; }
}

/* --- bubble --- */
.nac-bubble {
	width: 62px;
	height: 62px;
	border-radius: 50%;
	background: linear-gradient(145deg, var(--nac-color), color-mix(in srgb, var(--nac-color) 70%, #000));
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 24px rgba(0,0,0,.25);
	position: relative;
	transition: transform .2s ease, box-shadow .2s ease;
	animation: nac-bubble-breathe 3.2s ease-in-out infinite;
}
.nac-bubble::before {
	content: '';
	position: absolute;
	inset: -8px;
	border-radius: 50%;
	border: 2px solid var(--nac-color);
	opacity: 0;
	animation: nac-bubble-ring 2.8s ease-out infinite;
	pointer-events: none;
}
@keyframes nac-bubble-breathe {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.05); }
}
@keyframes nac-bubble-ring {
	0% { transform: scale(.85); opacity: .55; }
	100% { transform: scale(1.45); opacity: 0; }
}
.nac-bubble:hover {
	transform: translateY(-3px);
	box-shadow: 0 12px 28px rgba(0,0,0,.3);
	animation-play-state: paused;
}
.nac-bubble img {
	width: auto;
	height: auto;
	border-radius: 50%;
	object-fit: cover;
}
.nac-bubble-dot {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: #22c55e;
	border: 2px solid #fff;
}

/* --- panel --- */
.nac-panel {
	position: absolute;
	bottom: 76px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: 70vh;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(0,0,0,.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: nac-pop .18s ease-out;
}
.nac-pos-right .nac-panel { right: 0; }
.nac-pos-left  .nac-panel { left: 0; }
.nac-panel[hidden] { display: none; }

@keyframes nac-pop {
	from { opacity: 0; transform: translateY(12px) scale(.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.nac-panel-header {
	background: linear-gradient(135deg, var(--nac-color), color-mix(in srgb, var(--nac-color) 65%, #1e1b4b));
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.nac-header-info { display: flex; align-items: center; gap: 10px; }
.nac-header-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.nac-header-title { font-weight: 600; font-size: 14.5px; }
.nac-header-status { font-size: 11.5px; opacity: .85; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.nac-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; display: inline-block; }
.nac-close-btn {
	background: rgba(255,255,255,.15);
	border: none;
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}
.nac-close-btn:hover { background: rgba(255,255,255,.28); }

.nac-messages {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f7f7fb;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.nac-msg { display: flex; }
.nac-msg-user { justify-content: flex-start; }
.nac-msg-bot  { justify-content: flex-end; }

.nac-msg-bubble {
	max-width: 82%;
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.9;
}
.nac-msg-user .nac-msg-bubble {
	background: var(--nac-color);
	color: #fff;
	border-bottom-left-radius: 4px;
}
.nac-msg-bot .nac-msg-bubble {
	background: #fff;
	color: #262233;
	border: 1px solid #ecebf3;
	border-bottom-right-radius: 4px;
}
.nac-msg-bubble a { color: var(--nac-color); text-decoration: underline; word-break: break-all; }
.nac-msg-user .nac-msg-bubble a { color: #fff; }

.nac-typing {
	padding: 0 16px 10px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.nac-typing[hidden] { display: none; }
.nac-typing-label {
	font-size: 12px;
	color: #8b87a0;
}
.nac-typing-dots {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 8px 12px;
	background: #eeecf6;
	border-radius: 14px;
	border-bottom-left-radius: 4px;
}
.nac-typing-dots span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #b3adc9;
	animation: nac-blink 1.2s infinite ease-in-out;
}
.nac-typing-dots span:nth-child(2) { animation-delay: .2s; }
.nac-typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes nac-blink {
	0%, 80%, 100% { opacity: .3; transform: scale(.85); }
	40% { opacity: 1; transform: scale(1); }
}

.nac-input-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid #eee;
	background: #fff;
}
.nac-input-row textarea {
	flex: 1;
	resize: none;
	border: 1px solid #e3e1ec;
	border-radius: 12px;
	padding: 9px 12px;
	font-family: inherit;
	font-size: 13.5px;
	max-height: 110px;
	outline: none;
}
.nac-input-row textarea:focus { border-color: var(--nac-color); }

.nac-send-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: var(--nac-color);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transform: scaleX(-1); /* جهت آیکون ارسال برای راست‌چین */
}
.nac-send-btn:hover { filter: brightness(1.08); }

@media (max-width: 480px) {
	.nac-panel {
		width: calc(100vw - 24px);
		height: 68vh;
	}
}

/* --- proactive greeting bubble --- */
.nac-proactive {
	position: absolute !important;
	bottom: 76px !important;
	top: auto !important;
	left: auto;
	width: 230px !important;
	max-width: 230px !important;
	min-width: 0 !important;
	height: auto !important;
	box-sizing: border-box !important;
	background: #fff !important;
	color: #262233 !important;
	padding: 12px 14px !important;
	margin: 0 !important;
	border: none !important;
	border-radius: 16px !important;
	box-shadow: 0 10px 30px rgba(0,0,0,.18) !important;
	font-size: 13px !important;
	line-height: 1.8 !important;
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	align-items: flex-start !important;
	gap: 8px !important;
	cursor: pointer;
	animation: nac-proactive-in .35s ease;
	list-style: none !important;
}
.nac-pos-right .nac-proactive { right: 0 !important; }
.nac-pos-left  .nac-proactive { left: 0 !important; }
.nac-proactive::after {
	content: '';
	position: absolute !important;
	bottom: -7px !important;
	top: auto !important;
	width: 14px !important;
	height: 14px !important;
	background: #fff !important;
	transform: rotate(45deg);
}
.nac-pos-right .nac-proactive::after { right: 24px !important; }
.nac-pos-left  .nac-proactive::after { left: 24px !important; }
.nac-proactive-text {
	flex: 1 1 auto !important;
	min-width: 0 !important;
	width: auto !important;
	white-space: normal !important;
	word-break: break-word !important;
	display: inline !important;
}
.nac-proactive-close {
	all: unset !important;
	box-sizing: border-box !important;
	flex: 0 0 auto !important;
	width: 18px !important;
	height: 18px !important;
	min-width: 18px !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	background: transparent !important;
	color: #b3adc9 !important;
	cursor: pointer;
	font-size: 16px !important;
	line-height: 1 !important;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	border-radius: 0 !important;
}
.nac-proactive-close:hover { color: #7c7690 !important; }
@keyframes nac-proactive-in {
	from { opacity: 0; transform: translateY(8px) scale(.96); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

