/* ===== Govharino Chat Advisor ===== */
#govbot-root {
	--gb-accent: var(--wd-primary-color, #1f5f5b);   /* رنگ اصلی از قالب Woodmart */
	--gb-accent-2: #c9a45c;                           /* طلایی برای جزئیات */
	--gb-ink: #1d2422;
	--gb-muted: #7a8582;
	--gb-bg: #ffffff;
	--gb-soft: #f4f6f5;
	--gb-line: #e8ecea;
	--gb-radius: 20px;
	--gb-bottom: 20px;
	position: fixed;
	right: 20px;
	bottom: var(--gb-bottom);
	z-index: 99990;
	direction: rtl;
	font-family: inherit;
	color: var(--gb-ink);
	-webkit-text-size-adjust: 100%;
}
#govbot-root *,
#govbot-root *::before,
#govbot-root *::after { box-sizing: border-box; }

/* ریست دکمه‌ها و فیلدها در برابر استایل قالب */
#govbot-root button,
#govbot-root textarea {
	font: inherit; letter-spacing: normal; text-transform: none;
	margin: 0; min-height: 0; min-width: 0; box-shadow: none; line-height: 1.6;
}
#govbot-root button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ---------- دکمه‌ی شناور ---------- */
#govbot-root .govbot-launch {
	position: relative;
	width: 62px; height: 62px; padding: 0; border: 0; border-radius: 50%;
	color: #fff;
	background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.35), transparent 45%), var(--gb-accent);
	box-shadow: 0 10px 28px -6px rgba(0,0,0,.35), inset 0 0 0 2px rgba(255,255,255,.18);
	display: grid; place-items: center;
	transition: transform .25s cubic-bezier(.3,1.4,.5,1), box-shadow .25s;
}
#govbot-root .govbot-launch:hover { transform: translateY(-2px) scale(1.04); }
#govbot-root .govbot-launch svg { width: 30px; height: 30px; transition: transform .3s, opacity .2s; }
#govbot-root .govbot-launch .gb-ic-close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(.6); }
#govbot-root.is-open .govbot-launch .gb-ic-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
#govbot-root.is-open .govbot-launch .gb-ic-close { opacity: 1; transform: none; }
#govbot-root .govbot-launch::after {
	content: ""; position: absolute; inset: -4px; border-radius: 50%;
	border: 2px solid var(--gb-accent); opacity: 0;
	animation: gb-pulse 2.6s ease-out 1.5s 3;
}
#govbot-root .govbot-dot {
	position: absolute; top: 4px; right: 4px; width: 13px; height: 13px; border-radius: 50%;
	background: #22c55e; border: 2px solid #fff;
}
@keyframes gb-pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.45); opacity: 0; } }

/* حباب دعوت */
#govbot-root .govbot-teaser {
	position: absolute; bottom: 74px; right: 0;
	width: max-content; max-width: 240px;
	background: var(--gb-bg); color: var(--gb-ink);
	padding: 11px 14px 11px 32px; border-radius: 16px 16px 4px 16px;
	font-size: 13.5px; line-height: 1.8;
	box-shadow: 0 10px 30px -8px rgba(0,0,0,.25);
	cursor: pointer;
	animation: gb-in .35s ease-out;
}
#govbot-root .govbot-teaser button {
	position: absolute; top: 6px; left: 8px; width: 20px; height: 20px; padding: 0;
	border: 0; background: none; color: var(--gb-muted); font-size: 16px; line-height: 1;
}

/* ---------- پنجره‌ی چت ---------- */
#govbot-root .govbot-panel {
	position: absolute; bottom: 78px; right: 0;
	width: 380px; height: 600px;
	max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px);
	background: var(--gb-bg);
	border-radius: var(--gb-radius);
	overflow: hidden;
	display: flex; flex-direction: column;
	box-shadow: 0 24px 60px -12px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.04);
	transform-origin: bottom right;
	animation: gb-open .28s cubic-bezier(.2,.9,.3,1.1);
}
#govbot-root .govbot-panel[hidden] { display: none; }
@keyframes gb-open { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes gb-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* سربرگ */
#govbot-root .govbot-head {
	flex: none;
	display: flex; align-items: center; gap: 12px;
	padding: 16px 18px;
	color: #fff;
	background:
		radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.18), transparent 55%),
		var(--gb-accent);
}
#govbot-root .govbot-avatar {
	flex: none; width: 44px; height: 44px; border-radius: 50%;
	display: grid; place-items: center;
	background: rgba(255,255,255,.16);
	box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35);
}
#govbot-root .govbot-avatar svg { width: 24px; height: 24px; }
#govbot-root .govbot-title { flex: 1; min-width: 0; }
#govbot-root .govbot-title strong { display: block; font-size: 15.5px; font-weight: 700; line-height: 1.5; color: #fff; }
#govbot-root .govbot-title span { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .85; }
#govbot-root .govbot-title span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
#govbot-root .govbot-close {
	flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
	background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center;
}
#govbot-root .govbot-close:hover { background: rgba(255,255,255,.26); }
#govbot-root .govbot-close svg { width: 18px; height: 18px; }

/* بدنه‌ی گفتگو */
#govbot-root .govbot-log {
	flex: 1; min-height: 0;
	overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
	padding: 18px 14px 10px;
	display: flex; flex-direction: column; gap: 10px;
	background: linear-gradient(180deg, var(--gb-soft), #fff 220px);
}
#govbot-root .govbot-log > * { flex-shrink: 0; }
#govbot-root .govbot-msg {
	max-width: 86%;
	padding: 10px 14px;
	border-radius: 18px;
	font-size: 14px; line-height: 1.95;
	white-space: pre-wrap; overflow-wrap: anywhere;
	animation: gb-in .25s ease-out;
}
#govbot-root .govbot-msg strong { font-weight: 700; }
#govbot-root .govbot-assistant {
	align-self: flex-start;
	background: #fff; color: var(--gb-ink);
	border: 1px solid var(--gb-line);
	border-top-right-radius: 6px;
	box-shadow: 0 2px 8px -4px rgba(0,0,0,.08);
}
#govbot-root .govbot-user {
	align-self: flex-end;
	background: var(--gb-accent); color: #fff;
	border-top-left-radius: 6px;
}
#govbot-root .govbot-error {
	align-self: center; max-width: 92%;
	background: #fff1f1; color: #9b2c2c; border: 1px solid #fbd5d5;
	font-size: 13px; text-align: center;
}

/* نشانگر در حال نوشتن */
#govbot-root .govbot-typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
#govbot-root .govbot-typing i {
	width: 7px; height: 7px; border-radius: 50%; background: var(--gb-muted);
	animation: gb-dot 1.2s infinite ease-in-out;
}
#govbot-root .govbot-typing i:nth-child(2) { animation-delay: .15s; }
#govbot-root .govbot-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes gb-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-5px); opacity: 1; } }

/* پیشنهادهای سریع */
#govbot-root .govbot-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; animation: gb-in .3s ease-out; }
#govbot-root .govbot-chip {
	padding: 7px 13px; border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--gb-accent) 35%, transparent);
	background: #fff; color: var(--gb-accent);
	font-size: 13px; line-height: 1.5;
	transition: background .15s, color .15s;
}
#govbot-root .govbot-chip:hover { background: var(--gb-accent); color: #fff; }

/* کارت محصول */
#govbot-root .govbot-cards {
	display: flex; gap: 10px;
	overflow-x: auto; scroll-snap-type: x mandatory;
	margin: 0 -14px; padding: 2px 14px 8px;
	scrollbar-width: none;
}
#govbot-root .govbot-cards::-webkit-scrollbar { display: none; }
#govbot-root .govbot-card {
	flex: 0 0 152px; scroll-snap-align: start;
	display: flex; flex-direction: column;
	background: #fff; border: 1px solid var(--gb-line); border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 4px 14px -8px rgba(0,0,0,.18);
	transition: transform .2s, box-shadow .2s;
}
#govbot-root .govbot-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -10px rgba(0,0,0,.25); }
#govbot-root .govbot-card a { color: inherit; text-decoration: none; }
#govbot-root .govbot-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--gb-soft); margin: 0; }
#govbot-root .govbot-card-body { padding: 9px 10px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
#govbot-root .govbot-card-name {
	font-size: 12.5px; font-weight: 600; line-height: 1.7;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	min-height: 3.4em;
}
#govbot-root .govbot-card-price { font-size: 13px; font-weight: 700; color: var(--gb-accent); }
#govbot-root .govbot-card-btn {
	margin-top: auto; display: block; text-align: center;
	padding: 7px 6px; border-radius: 10px;
	background: color-mix(in srgb, var(--gb-accent) 10%, #fff);
	color: var(--gb-accent) !important; font-size: 12px; font-weight: 600;
	transition: background .15s, color .15s;
}
#govbot-root .govbot-card-btn:hover { background: var(--gb-accent); color: #fff !important; }
#govbot-root .govbot-card-btn.is-busy { opacity: .6; pointer-events: none; }
#govbot-root .govbot-card-btn.is-added { background: #e8f6ee; color: #1a7a45 !important; }

/* پاورقی: انتقال به انسان + ورودی */
#govbot-root .govbot-foot { flex: none; border-top: 1px solid var(--gb-line); background: #fff; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
#govbot-root .govbot-handoff {
	display: inline-flex; align-items: center; gap: 6px; margin: 0 4px 8px;
	font-size: 12px; color: var(--gb-muted); text-decoration: none;
}
#govbot-root .govbot-handoff:hover { color: var(--gb-accent); }
#govbot-root .govbot-handoff svg { width: 14px; height: 14px; }
#govbot-root .govbot-form {
	display: flex; align-items: flex-end; gap: 8px;
	background: var(--gb-soft); border: 1px solid var(--gb-line);
	border-radius: 16px; padding: 5px 5px 5px 5px;
	transition: border-color .15s, box-shadow .15s;
}
#govbot-root .govbot-form:focus-within { border-color: var(--gb-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gb-accent) 14%, transparent); background: #fff; }
#govbot-root .govbot-form textarea {
	flex: 1; width: auto; height: 40px; max-height: 110px;
	resize: none; border: 0; outline: 0; background: transparent;
	padding: 8px 10px; font-size: 14px; color: var(--gb-ink);
	border-radius: 0;
}
#govbot-root .govbot-send {
	flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px;
	background: var(--gb-accent); color: #fff;
	display: grid; place-items: center;
	transition: transform .15s, opacity .15s;
}
#govbot-root .govbot-send svg { width: 19px; height: 19px; transform: scaleX(-1); }
#govbot-root .govbot-send:disabled { opacity: .45; cursor: default; }
#govbot-root .govbot-send:not(:disabled):active { transform: scale(.92); }
#govbot-root .govbot-note { margin: 7px 4px 0; font-size: 10.5px; color: var(--gb-muted); text-align: center; }

/* ---------- موبایل: تمام‌صفحه ---------- */
@media (max-width: 600px) {
	#govbot-root { right: 14px; }
	#govbot-root .govbot-launch { width: 56px; height: 56px; }
	#govbot-root .govbot-teaser { bottom: 68px; max-width: 210px; }
	#govbot-root .govbot-panel {
		position: fixed;
		top: 0; right: 0; bottom: 0; left: 0;
		width: 100%; height: 100%; max-height: none;
		border-radius: 0;
		animation: gb-in .25s ease-out;
	}
	/* فونت ۱۶ پیکسل جلوی زوم خودکار آیفون هنگام تایپ را می‌گیرد */
	#govbot-root .govbot-form textarea { font-size: 16px; }
	#govbot-root.is-open .govbot-launch,
	#govbot-root.is-open .govbot-teaser { display: none; }
	#govbot-root .govbot-head { padding-top: calc(14px + env(safe-area-inset-top)); }
}
html.govbot-lock, html.govbot-lock body { overflow: hidden !important; }

@media (prefers-reduced-motion: reduce) {
	#govbot-root *, #govbot-root *::after { animation: none !important; transition: none !important; }
}
