/* =====================================================================
   ویجت پشتیبانی آنلاین
   ===================================================================== */
.bzs { --bzs-blue: #1463ff; --bzs-navy: #0b2170; position: fixed; z-index: 950; left: 20px; bottom: 20px; font-family: inherit; direction: rtl; }
.bzs [hidden] { display: none !important; }
.bzs-launch { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; font-size: 1.45rem;
    background: radial-gradient(circle at 30% 25%, #52b6ff, #1463ff 55%, #0b2170); box-shadow: 0 14px 30px -8px rgba(20, 99, 255, .6); transition: transform .2s ease; }
.bzs-launch:hover { transform: scale(1.06); }
.bzs.is-online .bzs-launch::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid rgba(82, 182, 255, .55); animation: bzsPulse 2.4s ease-out infinite; }
@keyframes bzsPulse { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.bzs-launch-ico, .bzs-launch-x { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .25s ease, opacity .25s ease; }
.bzs-launch-x { opacity: 0; transform: rotate(-90deg); }
.bzs.is-open .bzs-launch-ico { opacity: 0; transform: rotate(90deg); }
.bzs.is-open .bzs-launch-x { opacity: 1; transform: none; }
.bzs-badge { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #e5484d; color: #fff; font-size: .72rem; font-weight: 800; display: grid; place-items: center; border: 2px solid #fff; }

.bzs-panel { position: absolute; bottom: 76px; left: 0; width: 370px; height: min(600px, calc(100vh - 120px)); display: flex; flex-direction: column; overflow: hidden;
    background: #f4f7fc; border-radius: 22px; box-shadow: 0 30px 70px -20px rgba(6, 22, 74, .55), 0 0 0 1px rgba(15, 40, 110, .06); animation: bzsIn .25s cubic-bezier(.2, .8, .2, 1); transform-origin: bottom left; }
@keyframes bzsIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.bzs-head { display: flex; align-items: center; gap: .7rem; padding: .95rem 1rem; color: #fff; flex-shrink: 0;
    background: radial-gradient(260px 140px at 100% 0%, rgba(82, 182, 255, .45), transparent 70%), linear-gradient(120deg, #06164a, #0b2378 55%, #1453d8); }
.bzs-avatars span { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .15); border: 2px solid rgba(255, 255, 255, .35); font-size: 1.1rem; position: relative; }
.bzs.is-online .bzs-avatars span::after { content: ''; position: absolute; bottom: 0; left: 0; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #0b2378; }
.bzs-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bzs-title strong { font-size: .98rem; }
.bzs-status { display: flex; align-items: center; gap: .35rem; font-size: .72rem; opacity: .85; }
.bzs-status i { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; flex-shrink: 0; }
.bzs.is-online .bzs-status i { background: #22c55e; }
.bzs-icon { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: inherit; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; font-size: .9rem; }
.bzs-head .bzs-icon:hover { background: rgba(255, 255, 255, .22); }

.bzs-body { flex: 1; overflow-y: auto; padding: 1rem .9rem .5rem; scroll-behavior: smooth; overscroll-behavior: contain; }
.bzs-msgs { display: flex; flex-direction: column; gap: .5rem; }
.bzs-m { display: flex; flex-direction: column; max-width: 84%; animation: bzsMsg .22s ease; }
@keyframes bzsMsg { from { opacity: 0; transform: translateY(6px); } }
.bzs-visitor { align-self: flex-start; align-items: flex-start; }
.bzs-agent { align-self: flex-end; align-items: flex-end; }
.bzs-who { font-size: .68rem; color: #7b869c; margin: 0 .5rem .15rem; }
.bzs-bubble { padding: .55rem .8rem .35rem; border-radius: 18px; font-size: .88rem; line-height: 1.85; word-break: break-word; }
.bzs-visitor .bzs-bubble { background: linear-gradient(135deg, #2a72ff, #1463ff); color: #fff; border-bottom-right-radius: 6px; }
.bzs-agent .bzs-bubble { background: #fff; color: #0f1b3d; border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(15, 30, 70, .08); }
.bzs-bubble a { color: inherit; text-decoration: underline; }
.bzs-meta { display: block; font-size: .64rem; opacity: .7; margin-top: .1rem; text-align: left; }
.bzs-tick.is-read { color: #9fe0ff; opacity: 1; }
.bzs-system { align-self: center; max-width: 92%; text-align: center; }
.bzs-system .bzs-text { font-size: .76rem; color: #5b6478; background: #e8eef8; padding: .45rem .8rem; border-radius: 12px; line-height: 1.9; }
.bzs-img img { display: block; max-width: 220px; max-height: 220px; border-radius: 12px; margin-bottom: .3rem; }
.bzs-file { display: flex; align-items: center; gap: .55rem; padding: .4rem .2rem; text-decoration: none !important; }
.bzs-file i { font-size: 1.6rem; }
.bzs-file span { display: flex; flex-direction: column; font-size: .8rem; }
.bzs-file small { opacity: .7; font-size: .68rem; }
.bzs audio { width: 220px; height: 36px; display: block; }
.bzs-typing { display: inline-flex; gap: 4px; padding: .7rem .9rem; margin: .4rem 0 0 auto; width: fit-content; background: #fff; border-radius: 18px; box-shadow: 0 1px 2px rgba(15, 30, 70, .08); }
.bzs-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9aa6bd; animation: bzsDot 1.2s infinite; }
.bzs-typing span:nth-child(2) { animation-delay: .15s; } .bzs-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bzsDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* فرم شروع */
.bzs-start { flex: 1; overflow-y: auto; padding: 1.1rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.bzs-greet { margin: 0; padding: .8rem .9rem; border-radius: 16px; background: #fff; font-size: .86rem; line-height: 1.9; box-shadow: 0 1px 2px rgba(15, 30, 70, .06); }
.bzs-quick { display: flex; flex-wrap: wrap; gap: .35rem; }
.bzs-quick button { border: 1px solid #cfdcf5; background: #fff; color: var(--bzs-blue); border-radius: 999px; padding: .35rem .75rem; font-family: inherit; font-size: .76rem; font-weight: 600; cursor: pointer; }
.bzs-quick button:hover { background: #edf3ff; }
.bzs-f { display: block; }
.bzs input, .bzs textarea { width: 100%; box-sizing: border-box; font-family: inherit; font-size: .88rem; border: 1px solid #dfe6f1; border-radius: 12px; padding: .65rem .8rem; background: #fff; color: #0f1b3d; resize: none; outline: none; transition: border-color .15s ease, box-shadow .15s ease; }
.bzs input:focus, .bzs textarea:focus { border-color: var(--bzs-blue); box-shadow: 0 0 0 3px rgba(20, 99, 255, .12); }
.bzs-go { border: 0; border-radius: 12px; padding: .75rem; font-family: inherit; font-weight: 800; font-size: .9rem; color: #fff; cursor: pointer; background: linear-gradient(135deg, #2a72ff, #1463ff 60%, #6e5bff); box-shadow: 0 10px 20px -10px rgba(20, 99, 255, .7); }
.bzs-go:disabled { opacity: .6; }
.bzs-err { margin: 0; font-size: .76rem; color: #b42318; }

/* نوشتن پیام */
.bzs-compose { flex-shrink: 0; padding: .6rem .7rem .7rem; background: #fff; border-top: 1px solid #e6ecf5; }
.bzs-row { display: flex; align-items: flex-end; gap: .35rem; }
.bzs-row textarea { flex: 1; min-height: 42px; max-height: 120px; border-radius: 21px; padding: .6rem .9rem; }
.bzs-compose .bzs-icon { background: #f1f5fb; color: #5b6478; width: 42px; height: 42px; }
.bzs-compose .bzs-icon:hover { color: var(--bzs-blue); }
.bzs-send { width: 42px; height: 42px; border-radius: 50%; border: 0; color: #fff; cursor: pointer; flex-shrink: 0; background: linear-gradient(135deg, #2a72ff, #1463ff); transform: scaleX(-1); }
.bzs-compose.is-sending .bzs-send { opacity: .5; }
.bzs-rec { display: flex; align-items: center; gap: .6rem; padding: .3rem .2rem; }
.bzs-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: bzsBlink 1s infinite; }
@keyframes bzsBlink { 50% { opacity: .2; } }
.bzs-rec-t { flex: 1; font-size: .95rem; }
.bzs-rec button { border: 0; border-radius: 10px; padding: .5rem .8rem; font-family: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; }
.bzs-rec-cancel { background: #f1f5fb; color: #5b6478; }
.bzs-rec-send { background: var(--bzs-blue); color: #fff; }

/* امتیاز */
.bzs-rate { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; padding: 1.4rem; text-align: center; }
.bzs-stars { display: flex; flex-direction: row-reverse; gap: .2rem; direction: ltr; }
.bzs-stars button { border: 0; background: none; font-size: 2rem; color: #d5dcea; cursor: pointer; transition: transform .15s ease, color .15s ease; }
.bzs-stars button:hover { transform: scale(1.15); }
.bzs-stars button.on { color: #f5b301; }
.bzs-new { border: 0; background: none; color: var(--bzs-blue); font-family: inherit; font-weight: 700; cursor: pointer; font-size: .82rem; }

@media (max-width: 760px) {
    .bzs { left: 14px; bottom: calc(88px + env(safe-area-inset-bottom)); }
    body:has(.biz-mobilebar) .bzs { bottom: calc(160px + env(safe-area-inset-bottom)); }
    .bzs-launch { width: 54px; height: 54px; font-size: 1.3rem; }
    .bzs.is-open { inset: 0; left: 0; bottom: 0; }
    .bzs.is-open .bzs-launch { display: none; }
    .bzs-panel { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { .bzs *, .bzs *::before { animation: none !important; transition: none !important; } }
html[data-theme="dark"] .bzs-panel { background: #0b1430; }
html[data-theme="dark"] .bzs-agent .bzs-bubble, html[data-theme="dark"] .bzs-greet, html[data-theme="dark"] .bzs-typing { background: #16234a; color: #e6ecff; }
html[data-theme="dark"] .bzs-compose { background: #0e1938; border-color: #22305a; }
html[data-theme="dark"] .bzs input, html[data-theme="dark"] .bzs textarea { background: #16234a; border-color: #2a3866; color: #e6ecff; }

/* بیزی در گفتگو */
.bzs-avatars span.is-bizi { background: rgba(255, 255, 255, .95); padding: 3px; overflow: visible; }
.bzs-avatars .bizi-svg { width: 100%; height: 100%; }
.bzs-bot { align-self: flex-end; align-items: flex-end; }
.bzs-bot .bzs-bubble { background: linear-gradient(135deg, #f1f6ff, #fff); color: #0f1b3d; border: 1px solid #d6e3ff; border-bottom-left-radius: 6px; white-space: normal; }
.bzs-bot .bzs-who { display: flex; align-items: center; gap: .3rem; color: #1463ff; font-weight: 700; }
.bzs-bot-face { width: 20px; height: 20px; display: inline-block; }
.bzs-bot-face .bizi-svg { width: 100%; height: 100%; }
.bzs-link { display: inline-block; margin: .25rem 0; padding: .2rem .7rem; border-radius: 999px; background: #e8f0ff; color: #1463ff !important; text-decoration: none !important; font-size: .78rem; font-weight: 700; }
.bzs-visitor .bzs-link { background: rgba(255, 255, 255, .2); color: #fff !important; }
.bzs-link:hover { background: #1463ff; color: #fff !important; }
.bzs-suggest, .bzs-vote { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .35rem; max-width: 100%; }
.bzs-suggest small, .bzs-vote small { font-size: .7rem; color: #7b869c; width: 100%; }
.bzs-vote small { width: auto; }
.bzs-suggest button { border: 1px solid #cfdcf5; background: #fff; color: #1463ff; border-radius: 999px; padding: .3rem .7rem; font-family: inherit; font-size: .74rem; font-weight: 600; cursor: pointer; text-align: right; }
.bzs-suggest button:hover { background: #1463ff; color: #fff; }
.bzs-suggest button:disabled { opacity: .5; }
.bzs-vote button { border: 1px solid #e3e9f3; background: #fff; border-radius: 999px; width: 32px; height: 28px; cursor: pointer; font-size: .85rem; }
.bzs-vote button:hover { background: #f1f5fb; transform: scale(1.08); }

/* لانچر با چهره بیزی: بیزی از دکمه بیرون سرک می‌کشد */
.bzs.has-mascot .bzs-launch { background: radial-gradient(circle at 50% 30%, #fff, #eef4ff); border: 2px solid #cfdcf5; box-shadow: 0 14px 30px -10px rgba(20, 99, 255, .5); overflow: visible; }
.bzs.has-mascot .bzs-launch-ico .bizi-svg { width: 62px; height: 62px; transform: translateY(-14px); filter: drop-shadow(0 6px 10px rgba(20, 99, 255, .35)); transition: transform .25s ease; }
.bzs.has-mascot .bzs-launch:hover .bzs-launch-ico .bizi-svg { transform: translateY(-18px) scale(1.06); }
.bzs.has-mascot.is-open .bzs-launch { background: linear-gradient(135deg, #2a72ff, #1463ff); border-color: transparent; color: #fff; }
.bzs-hint { position: absolute; bottom: 70px; left: 50%; transform: translateX(-30%); white-space: nowrap; font-size: .76rem; font-weight: 700; color: #0f1b3d; background: #fff; padding: .35rem .7rem; border-radius: 12px 12px 12px 4px;
    box-shadow: 0 10px 24px -10px rgba(6, 22, 74, .4); border: 1px solid #dbe6ff; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.bzs.has-mascot:not(.is-open) .bzs-launch:hover + .bzs-hint, .bzs-hint.is-show { opacity: 1; transform: translateX(-30%) translateY(-4px); }
.bzs-avatars span.is-bizi { background: radial-gradient(circle at 50% 30%, #fff, #eef4ff); padding: 2px; }
.bzs-avatars span.is-bizi .bizi-svg { transform: translateY(-3px); }
@media (max-width: 760px) { .bzs-hint { display: none; } }
/* حباب معرفی از کنار دکمه به سمت داخل صفحه باز می‌شود (لانچر در لبه چپ است) */
.bzs-hint { left: 0; transform: none; border-radius: 12px 12px 12px 4px; }
.bzs.has-mascot:not(.is-open) .bzs-launch:hover + .bzs-hint, .bzs-hint.is-show { transform: translateY(-4px); }
