/*
 * ویجت «دستیار هوشمند فروشگاه» (assets/css/assistant.css) – دور ۲۳، به‌روزشده در دور ۲۴.
 * CSS ساده (نه Tailwind) تا پاک‌سازی کلاس‌های Tailwind چیزی را حذف نکند. همهٔ کلاس‌ها با پیشوند fs-as- هستند.
 * دکمهٔ ربات پایین سمت چپ با برچسب نام؛ پنل روی دسکتاپ ۳۷۰ پیکسل و روی موبایل تمام‌صفحه. حالت تیره با کلاس html.dark.
 * دور ۲۴: برچسب نام، موج جلب توجه، نشان پیام تازه، حباب پیش‌نمایش، سه‌نقطهٔ تایپ، نوار کارشناس، نوار راهنما،
 * برجسته‌سازی دکمه‌های صفحه (fs-as-spot + fs-as-tip) و رفع جمع شدن ردیف کارت‌ها (flex-shrink: 0).
 */
.fs-as-launch { position: fixed; left: 16px; bottom: 16px; z-index: 45; display: flex; align-items: flex-end; gap: 8px; direction: rtl; flex-direction: row; }
.fs-as-btn {
  position: relative; flex: 0 0 auto;
  width: 58px; height: 58px; border-radius: 999px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  background: linear-gradient(135deg, color-mix(in srgb, var(--fs-as-color, #0f766e) 65%, #fff), var(--fs-as-color, #0f766e)); color: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, .25);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease;
}
.fs-as-btn:hover { transform: scale(1.06); }
.fs-as-btn:focus-visible { outline: 3px solid #fbbf24; outline-offset: 2px; }
.fs-as-btn svg { width: 30px; height: 30px; fill: currentColor; }
.fs-as-btn.fs-as-ring::before, .fs-as-btn.fs-as-ring::after {
  content: ""; position: absolute; inset: 0; border-radius: 999px; border: 2px solid var(--fs-as-color, #0f766e); pointer-events: none;
  animation: fs-as-ring 1.6s ease-out 3;
}
.fs-as-btn.fs-as-ring::after { animation-delay: .5s; }
@keyframes fs-as-ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
.fs-as-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: #dc2626; color: #fff; font-size: 12px; line-height: 20px; text-align: center; font-weight: 700; box-shadow: 0 0 0 2px #fff;
}
.fs-as-badge[hidden] { display: none; }
.fs-as-tag {
  border: 0; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 700; color: #115e59; background: #fff;
  border-radius: 999px; padding: 6px 12px; margin-bottom: 14px; box-shadow: 0 4px 14px rgba(15, 23, 42, .18); white-space: nowrap;
}
.fs-as-bubble {
  position: absolute; left: 0; bottom: 70px; width: 250px; max-width: calc(100vw - 32px); background: #fff; color: #0f172a;
  border-radius: 14px; border-bottom-left-radius: 4px; padding: 10px 30px 10px 12px; font-size: 13px; line-height: 1.8;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .22); cursor: pointer; animation: fs-as-pop .3s ease-out;
}
.fs-as-bubble[hidden] { display: none; }
.fs-as-bubble-x { position: absolute; top: 4px; right: 6px; border: 0; background: transparent; color: #94a3b8; font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 4px; }
@keyframes fs-as-pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
body.fs-as-open .fs-as-launch { display: none; }
body.has-sticky-buy .fs-as-launch { bottom: 84px; }
@media (max-width: 640px) { .fs-as-tag { display: none; } }
@media (prefers-reduced-motion: reduce) { .fs-as-btn.fs-as-ring::before, .fs-as-btn.fs-as-ring::after, .fs-as-bubble, .fs-as-typing i, .fs-as-spot { animation: none !important; } }
@media print { .fs-as-launch, .fs-as-panel, .fs-as-tip { display: none !important; } }

.fs-as-panel {
  position: fixed; left: 16px; bottom: 16px; z-index: 46;
  width: 370px; max-width: calc(100vw - 32px); height: min(600px, calc(100dvh - 32px));
  background: #fff; color: #0f172a; border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 48px rgba(15, 23, 42, .3);
  display: flex; flex-direction: column; direction: rtl; font-size: 14px;
}
.fs-as-panel[hidden] { display: none; }
@media (max-width: 640px) {
  .fs-as-panel { left: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; border-radius: 0; }
}

.fs-as-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--fs-as-color, #0f766e); color: #fff; }
.fs-as-head b { flex: 1; font-size: 15px; }
.fs-as-avatar { width: 36px; height: 36px; border-radius: 999px; background: rgba(255, 255, 255, .18); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.fs-as-avatar svg { fill: currentColor; }
.fs-as-banner, .fs-as-guide { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12px; }
.fs-as-banner { background: #fef3c7; color: #92400e; }
.fs-as-guide { background: #e0f2fe; color: #075985; }
.fs-as-banner[hidden], .fs-as-guide[hidden], .fs-as-suggest[hidden] { display: none; }
.fs-as-banner span, .fs-as-guide span { flex: 1; }
.fs-as-banner button, .fs-as-guide button { border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 999px; padding: 3px 10px; cursor: pointer; font-family: inherit; font-size: 12px; }
.fs-as-head small { display: block; font-weight: 400; opacity: .85; font-size: 12px; }
.fs-as-close { background: transparent; border: 0; color: #fff; cursor: pointer; font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.fs-as-close:focus-visible { outline: 2px solid #fbbf24; }

.fs-as-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; overscroll-behavior: contain; }
.fs-as-msg { flex-shrink: 0; max-width: 88%; padding: 9px 12px; border-radius: 14px; line-height: 1.8; white-space: pre-line; word-wrap: break-word; }
.fs-as-bot { align-self: flex-start; background: #fff; border: 1px solid #e2e8f0; border-top-right-radius: 4px; }
.fs-as-me { align-self: flex-end; background: #ccfbf1; border-top-left-radius: 4px; }
.fs-as-staff { align-self: flex-start; background: #fef9c3; border: 1px solid #fde68a; border-top-right-radius: 4px; }
.fs-as-author { display: block; font-size: 11px; color: #92400e; }
.fs-as-typing { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.fs-as-typing i { width: 7px; height: 7px; border-radius: 999px; background: #94a3b8; animation: fs-as-dot 1.2s infinite ease-in-out; }
.fs-as-typing i:nth-child(2) { animation-delay: .15s; }
.fs-as-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes fs-as-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: 1; } }

.fs-as-cards { display: flex; flex-shrink: 0; gap: 8px; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; align-self: stretch; min-height: 210px; scroll-snap-type: x proximity; }
.fs-as-card { scroll-snap-align: start; flex: 0 0 150px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.fs-as-card img { width: 100%; height: 100px; object-fit: contain; border-radius: 8px; background: #fff; }
.fs-as-card a.fs-as-name { color: #0f172a; text-decoration: none; font-size: 12px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.fs-as-price { font-weight: 700; font-size: 13px; }
.fs-as-old { color: #94a3b8; text-decoration: line-through; font-size: 11px; margin-inline-start: 4px; font-weight: 400; }
.fs-as-off { color: #dc2626; font-size: 11px; }
.fs-as-out { color: #b91c1c; font-size: 12px; }
/* دور ۲۵: برچسب مشاور خرید روی کارت و دکمه‌های 👍/👎 زیر پاسخ */
.fs-as-note { align-self: flex-start; background: #ecfdf5; color: #047857; border-radius: 9999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.fs-as-fb { display: flex; align-items: center; gap: 6px; margin: -2px 6px 6px; color: #71717a; font-size: 11px; }
.fs-as-fb button { border: 1px solid #e4e4e7; background: #fff; border-radius: 9999px; padding: 0 8px; font-size: 13px; line-height: 22px; cursor: pointer; }
.fs-as-fb button:hover, .fs-as-fb button:focus-visible { border-color: #0ea5e9; outline: none; }
.fs-as-rate { flex-wrap: wrap; }
.fs-as-rate button { color: #f59e0b; }
.fs-as-add { border: 0; border-radius: 8px; background: var(--fs-as-color, #0f766e); color: #fff; font-size: 12px; padding: 6px; cursor: pointer; font-family: inherit; }

.fs-as-actions { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.fs-as-suggest { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 2px; background: #fff; flex-shrink: 0; scrollbar-width: none; }
.fs-as-suggest .fs-as-chip { white-space: nowrap; flex: 0 0 auto; }
.fs-as-chip { border: 1px solid #99f6e4; background: #f0fdfa; color: #115e59; border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; text-decoration: none; font-family: inherit; }
.fs-as-chip:hover { background: #ccfbf1; }

.fs-as-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #e2e8f0; background: #fff; }
.fs-as-form input { flex: 1; border: 1px solid #cbd5e1; border-radius: 10px; padding: 9px 12px; font-family: inherit; font-size: 14px; min-width: 0; }
.fs-as-form input:focus { outline: 2px solid var(--fs-as-color, #0f766e); border-color: transparent; }
.fs-as-form button { border: 0; border-radius: 10px; background: var(--fs-as-color, #0f766e); color: #fff; padding: 0 14px; cursor: pointer; font-family: inherit; }
.fs-as-form button:disabled { opacity: .5; cursor: default; }
.fs-as-spot { outline: 3px solid #f59e0b !important; outline-offset: 3px; border-radius: 10px; animation: fs-as-glow 1.2s ease-in-out 4; }
@keyframes fs-as-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .55); } 50% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); } }
.fs-as-tip {
  position: fixed; z-index: 47; max-width: 260px; background: var(--fs-as-color, #0f766e); color: #fff; font-size: 13px; line-height: 1.8; direction: rtl;
  padding: 8px 12px; border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .3); animation: fs-as-pop .3s ease-out; pointer-events: none;
}
.fs-as-note { font-size: 11px; color: #94a3b8; text-align: center; padding: 0 10px 8px; background: #fff; }

html.dark .fs-as-panel, html.dark .fs-as-form, html.dark .fs-as-note, html.dark .fs-as-suggest { background: #0f172a; color: #e2e8f0; }
html.dark .fs-as-tag, html.dark .fs-as-bubble { background: #1e293b; color: #e2e8f0; }
html.dark .fs-as-staff { background: #422006; border-color: #713f12; color: #fef3c7; }
html.dark .fs-as-badge { box-shadow: 0 0 0 2px #0f172a; }
html.dark .fs-as-log { background: #111827; }
html.dark .fs-as-bot, html.dark .fs-as-card { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark .fs-as-card a.fs-as-name { color: #e2e8f0; }
html.dark .fs-as-me { background: #134e4a; color: #f0fdfa; }
html.dark .fs-as-form input { background: #1e293b; color: #e2e8f0; border-color: #334155; }
html.dark .fs-as-chip { background: #134e4a; color: #ccfbf1; border-color: #0f766e; }

/* ── دور ۲۹: جای دکمه (انتخاب مدیر)، کشیدن، لوگو، رنگ، صدا ─────────────────
   fs-as-pos-br پایین راست (پیش‌فرض) · bl پایین چپ · mr وسط راست · ml وسط چپ.
   fs-as-free = جایی که مشتری با کشیدن انتخاب کرده (left/top از assistant.js با CSSOM). */
.fs-as-btn { touch-action: none; -webkit-user-select: none; user-select: none; }
.fs-as-launch.fs-as-pos-br, .fs-as-launch.fs-as-pos-mr { left: auto; right: 16px; flex-direction: row-reverse; }
.fs-as-launch.fs-as-pos-br .fs-as-bubble, .fs-as-launch.fs-as-pos-mr .fs-as-bubble { left: auto; right: 0; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.fs-as-launch.fs-as-pos-mr, .fs-as-launch.fs-as-pos-ml { bottom: 50% !important; transform: translateY(50%); }
.fs-as-panel.fs-as-pos-br, .fs-as-panel.fs-as-pos-mr { left: auto; right: 16px; }
.fs-as-launch.fs-as-free { right: auto !important; bottom: auto !important; transform: none !important; }
.fs-as-launch.fs-as-free .fs-as-tag { display: none; }
.fs-as-launch.fs-as-free .fs-as-bubble { bottom: 66px; }
.fs-as-launch.fs-as-dragging .fs-as-btn { cursor: grabbing; transform: scale(1.1); box-shadow: 0 14px 34px rgba(15, 23, 42, .35); transition: none; }
.fs-as-panel.fs-as-side-l { left: 16px; right: auto; }
.fs-as-panel.fs-as-side-r { right: 16px; left: auto; }
@media (max-width: 640px) { .fs-as-panel, .fs-as-panel.fs-as-pos-br, .fs-as-panel.fs-as-pos-mr, .fs-as-panel.fs-as-side-l, .fs-as-panel.fs-as-side-r { left: 0; right: 0; } }
.fs-as-logo { width: 100%; height: 100%; object-fit: cover; border-radius: 999px; pointer-events: none; }
.fs-as-btn .fs-as-logo { width: 46px; height: 46px; background: #fff; }
.fs-as-avatar .fs-as-logo { width: 32px; height: 32px; background: #fff; }
.fs-as-speak { background: rgba(255, 255, 255, .14); border: 0; color: #fff; cursor: pointer; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.fs-as-speak[hidden] { display: none; }
.fs-as-speak svg { fill: currentColor; }
.fs-as-speak[aria-pressed="true"] { background: rgba(255, 255, 255, .32); }
.fs-as-speak:disabled { opacity: .5; cursor: not-allowed; }
.fs-as-speak:focus-visible { outline: 2px solid #fbbf24; }
.fs-as-form .fs-as-mic { background: #f1f5f9; color: #334155; padding: 0 10px; display: flex; align-items: center; justify-content: center; }
.fs-as-form .fs-as-mic[hidden] { display: none; }
.fs-as-form .fs-as-mic svg { fill: currentColor; }
.fs-as-form .fs-as-mic.fs-as-listening { background: #dc2626; color: #fff; animation: fs-as-pulse 1.1s ease-in-out infinite; }
@keyframes fs-as-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .5); } 50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); } }
.fs-as-reset { display: block; margin: 4px auto 0; border: 0; background: transparent; color: #64748b; font-family: inherit; font-size: 11px; text-decoration: underline; cursor: pointer; }
.fs-as-reset[hidden] { display: none; }
html.dark .fs-as-form .fs-as-mic { background: #1e293b; color: #e2e8f0; }
@media (prefers-reduced-motion: reduce) { .fs-as-form .fs-as-mic.fs-as-listening { animation: none; } }
