/* ==========================================================================
   ذهن برتر AI — دستیار هوشمند فروشگاه (v6)
   چیدمان تمام‌صفحه به سبک صفحه‌ی چت ابزارهای هوش مصنوعی
   ریل کنار + ستون مکالمه‌ی وسط‌چین + داک ورودی  |  راست‌چین
   ========================================================================== */

.zbai-root {
    --zbai-purple: var(--accent-purple, #6d28d9);
    --zbai-purple-2: #8b5cf6;
    --zbai-gold: var(--accent-gold, #f59e0b);
    --zbai-ink: #14121a;
    --zbai-muted: #6b7280;
    --zbai-line: #ecebf2;
    --zbai-line-strong: #dedae8;
    --zbai-canvas: #ffffff;
    --zbai-rail: #f7f5fc;
    font-family: inherit;
    position: relative;
    z-index: 1000000;
}

.zbai-root *,
.zbai-root *::before,
.zbai-root *::after { box-sizing: border-box; }

/* ==========================================================================
   دکمه شناور — کره‌ی گرادیانی با حلقه‌ی چرخان
   ========================================================================== */
.zbai-fab {
    position: fixed;
    left: 24px;
    bottom: 96px; /* بالاتر از دکمه اسکرول به بالا */
    z-index: 1000001;
    display: inline-flex;
    align-items: center;
    height: 60px;
    padding: 0 6px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    color: #fff;
    background:
        radial-gradient(120% 140% at 20% 12%, rgba(255, 255, 255, .42), transparent 46%),
        linear-gradient(135deg, #4c1d95 0%, #6d28d9 46%, #8b5cf6 100%);
    box-shadow:
        0 18px 40px -16px rgba(76, 29, 149, .85),
        0 6px 16px -8px rgba(76, 29, 149, .55),
        inset 0 1px 0 rgba(255, 255, 255, .35);
    transition: width .34s cubic-bezier(.2, .9, .3, 1.1), box-shadow .24s ease, transform .24s ease, opacity .2s ease;
    isolation: isolate;
    overflow: hidden;
}

.zbai-fab::before {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: -1;
    border-radius: inherit;
    background: conic-gradient(from 0deg,
        rgba(245, 158, 11, .95),
        rgba(167, 139, 250, .95),
        rgba(109, 40, 217, .95),
        rgba(245, 158, 11, .95));
    filter: blur(9px);
    opacity: .75;
    animation: zbai-ring 7s linear infinite;
}

.zbai-fab::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 42%;
    left: -60%;
    background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: skewX(-18deg);
    animation: zbai-shine 5.4s ease-in-out infinite;
    pointer-events: none;
}

.zbai-fab:hover {
    transform: translateY(-3px);
    box-shadow:
        0 24px 50px -16px rgba(76, 29, 149, .9),
        0 8px 20px -8px rgba(76, 29, 149, .6),
        inset 0 1px 0 rgba(255, 255, 255, .4);
}
.zbai-fab:active { transform: translateY(-1px) scale(.985); }
.zbai-fab:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, .95),
        0 0 0 6px rgba(109, 40, 217, .55),
        0 18px 40px -16px rgba(76, 29, 149, .85);
}

.zbai-fab-glow {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(60% 120% at 78% 18%, rgba(245, 158, 11, .5), transparent 62%);
    opacity: .9;
    pointer-events: none;
    animation: zbai-halo 4.6s ease-in-out infinite;
}

.zbai-fab-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 50%;
    background: linear-gradient(150deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .08));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .34);
    z-index: 1;
}
.zbai-fab-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.8;
    filter: drop-shadow(0 2px 3px rgba(40, 10, 80, .45));
    animation: zbai-sparkle 3.6s ease-in-out infinite;
}
.zbai-fab-icon::after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 2.5px #5b21b6, 0 0 10px rgba(52, 211, 153, .9);
    animation: zbai-live 2.6s ease-in-out infinite;
}

.zbai-fab-text {
    display: block;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: .2px;
    opacity: 0;
    transition: max-width .34s cubic-bezier(.2, .9, .3, 1.1), opacity .22s ease, padding .3s ease;
    z-index: 1;
}
.zbai-fab-text b { font-weight: 900; color: #fde68a; }
.zbai-fab:hover .zbai-fab-text,
.zbai-fab:focus-visible .zbai-fab-text {
    max-width: 165px;
    opacity: 1;
    padding: 0 16px 0 4px;
}

@keyframes zbai-ring { to { transform: rotate(360deg); } }
@keyframes zbai-shine {
    0%, 62%   { left: -60%; }
    92%, 100% { left: 130%; }
}
@keyframes zbai-halo {
    0%, 100% { opacity: .55; }
    50%      { opacity: 1; }
}
@keyframes zbai-sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    45%      { transform: scale(1.08) rotate(-6deg); }
}
@keyframes zbai-live {
    0%, 100% { box-shadow: 0 0 0 2.5px #5b21b6, 0 0 6px rgba(52, 211, 153, .6); }
    50%      { box-shadow: 0 0 0 2.5px #5b21b6, 0 0 14px rgba(52, 211, 153, 1); }
}

html.zbai-open .zbai-fab {
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px) scale(.84);
}

/* ==========================================================================
   پس‌زمینه
   ========================================================================== */
.zbai-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    background: rgba(16, 11, 30, .45);
    -webkit-backdrop-filter: blur(5px) saturate(115%);
            backdrop-filter: blur(5px) saturate(115%);
    opacity: 0;
    transition: opacity .2s ease;
}
.zbai-backdrop[hidden] { display: none; }
.zbai-backdrop.is-on { opacity: 1; }

/* ==========================================================================
   کادر تمام‌صفحه
   ========================================================================== */
.zbai-panel {
    position: fixed;
    inset: 12px;
    z-index: 1000002;
    display: flex;
    flex-direction: row;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 22px;
    box-shadow:
        0 40px 90px -40px rgba(16, 11, 30, .6),
        0 12px 34px -24px rgba(16, 11, 30, .35),
        0 0 0 1px rgba(16, 11, 30, .06);
    overflow: hidden;
    animation: zbai-pop .24s cubic-bezier(.2, .95, .3, 1.08);
}
.zbai-panel[hidden] { display: none; }
@keyframes zbai-pop {
    from { opacity: 0; transform: scale(.994); }
    to   { opacity: 1; transform: none; }
}

/* ------------------------------- ریل کنار ------------------------------- */
.zbai-rail {
    flex: 0 0 64px;
    width: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 0 16px;
    background: linear-gradient(180deg, #faf8ff, var(--zbai-rail));
    border-inline-end: 1px solid var(--zbai-line);
}

.zbai-rail-logo {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: #fff;
    background:
        radial-gradient(120% 130% at 22% 14%, rgba(255, 255, 255, .45), transparent 48%),
        linear-gradient(140deg, #4c1d95, #7c3aed 62%, #a78bfa);
    box-shadow: 0 8px 18px -10px rgba(76, 29, 149, .9), inset 0 1px 0 rgba(255, 255, 255, .4);
    margin-bottom: 4px;
}
.zbai-rail-logo svg { width: 20px; height: 20px; }

.zbai-rail-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--zbai-line-strong);
    border-radius: 12px;
    background: #fff;
    color: #554f63;
    cursor: pointer;
    text-decoration: none;
    transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.zbai-rail-btn svg { width: 19px; height: 19px; }
.zbai-rail-btn:hover {
    background: #f3eeff;
    border-color: rgba(109, 40, 217, .4);
    color: var(--zbai-purple);
    transform: translateY(-1px);
}
.zbai-rail-sep {
    width: 26px;
    height: 1px;
    background: var(--zbai-line-strong);
    margin: 2px 0;
}
.zbai-rail-spacer { flex: 1 1 auto; }

/* ------------------------------- ستون اصلی ------------------------------- */
.zbai-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* هدر */
.zbai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--zbai-line);
    flex: 0 0 auto;
}

.zbai-head-id { display: flex; align-items: center; gap: 11px; min-width: 0; }

.zbai-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 12px;
    color: #fff;
    background:
        radial-gradient(120% 130% at 22% 14%, rgba(255, 255, 255, .45), transparent 48%),
        linear-gradient(140deg, #4c1d95, #7c3aed 62%, #a78bfa);
    box-shadow: 0 8px 18px -10px rgba(76, 29, 149, .9), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.zbai-avatar svg { width: 20px; height: 20px; }

.zbai-head strong {
    display: block;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.5;
    color: var(--zbai-ink);
}
.zbai-head small {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--zbai-muted);
}
.zbai-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, .18);
    display: inline-block;
    animation: zbai-live 2.8s ease-in-out infinite;
}

.zbai-head-actions { display: flex; align-items: center; gap: 8px; }

/* کلید «فقط چت» */
.zbai-switch {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 36px;
    padding: 0 12px 0 5px;
    border: 1px solid var(--zbai-line-strong);
    border-radius: 999px;
    background: #fff;
    color: #4b4658;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.zbai-switch .track {
    position: relative;
    width: 34px;
    height: 19px;
    border-radius: 999px;
    background: #d9d5e4;
    transition: background .2s ease;
    flex: 0 0 34px;
}
.zbai-switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    right: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(20, 18, 26, .28);
    transition: transform .22s cubic-bezier(.2, .9, .3, 1.2);
}
.zbai-switch[aria-pressed="true"] {
    background: rgba(109, 40, 217, .07);
    border-color: rgba(109, 40, 217, .45);
    color: var(--zbai-purple);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, .08);
}
.zbai-switch[aria-pressed="true"] .track { background: linear-gradient(135deg, var(--zbai-purple), #8b5cf6); }
.zbai-switch[aria-pressed="true"] .track::after { transform: translateX(-15px); }

.zbai-iconbtn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--zbai-line);
    border-radius: 11px;
    background: #fff;
    color: #5c5568;
    cursor: pointer;
    transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.zbai-iconbtn:hover {
    background: #f5f2ff;
    border-color: rgba(109, 40, 217, .35);
    color: var(--zbai-purple);
    transform: translateY(-1px);
}
.zbai-iconbtn svg { width: 17px; height: 17px; }

/* نوار وضعیت فقط‌چت */
.zbai-focusbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 20px;
    font-size: 11.5px;
    font-weight: 700;
    color: #4c1d95;
    background: linear-gradient(90deg, #f5f0ff, #fbf7ff 55%, #fdf5e6);
    border-bottom: 1px solid rgba(109, 40, 217, .13);
    flex: 0 0 auto;
}
html.zbai-focus .zbai-focusbar { display: flex; }
.zbai-viewbtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: 999px;
    padding: 6px 14px;
    font: inherit;
    font-size: 11.5px;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, var(--zbai-purple), #7c3aed);
    cursor: pointer;
    box-shadow: 0 8px 18px -12px rgba(76, 29, 149, .95);
    transition: transform .16s ease, filter .16s ease;
}
.zbai-viewbtn:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* ------------------------------- جریان گفتگو ------------------------------- */
.zbai-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 26px 24px 8px;
    background:
        radial-gradient(1100px 320px at 50% -10%, rgba(109, 40, 217, .045), transparent 70%),
        #fff;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scrollbar-width: thin;
    scrollbar-color: #ddd8e8 transparent;
}
.zbai-body::-webkit-scrollbar { width: 10px; }
.zbai-body::-webkit-scrollbar-thumb {
    background: #ddd8e8;
    border-radius: 9px;
    border: 3px solid #fff;
}
/* ستون وسط‌چین برای همه‌ی فرزندان جریان */
.zbai-body > * {
    width: 100%;
    max-width: 824px;
    margin-inline: auto;
    flex: 0 0 auto;
}

/* حالت خالی / خوش‌آمد */
.zbai-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    padding: 26px 0 4px;
    animation: zbai-fade .3s ease;
}
.zbai-hero-mark {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 10px;
    border-radius: 18px;
    color: #fff;
    background:
        radial-gradient(120% 130% at 22% 14%, rgba(255, 255, 255, .48), transparent 48%),
        linear-gradient(140deg, #4c1d95, #7c3aed 62%, #a78bfa);
    box-shadow: 0 18px 34px -20px rgba(76, 29, 149, .95), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.zbai-hero-mark svg { width: 27px; height: 27px; }
.zbai-hero h3 {
    margin: 0;
    font-size: clamp(19px, 2.1vw, 25px);
    font-weight: 900;
    letter-spacing: -.3px;
    color: var(--zbai-ink);
}
.zbai-hero p {
    margin: 0;
    max-width: 520px;
    font-size: 13px;
    line-height: 2;
    color: var(--zbai-muted);
}
.zbai-hero-cards {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    margin-top: 20px;
}
.zbai-hero-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
    border: 1px solid var(--zbai-line-strong);
    border-radius: 15px;
    background: #fff;
    text-align: start;
    font: inherit;
    cursor: pointer;
    transition: border-color .17s ease, box-shadow .17s ease, transform .17s ease, background .17s ease;
}
.zbai-hero-card:hover {
    transform: translateY(-2px);
    border-color: rgba(109, 40, 217, .4);
    background: linear-gradient(140deg, rgba(109, 40, 217, .045), rgba(245, 158, 11, .05));
    box-shadow: 0 16px 28px -24px rgba(24, 15, 46, .8);
}
.zbai-hero-card i {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
    background: rgba(109, 40, 217, .1);
    color: var(--zbai-purple);
    font-style: normal;
    font-size: 15px;
}
.zbai-hero-card b {
    display: block;
    font-size: 12.8px;
    font-weight: 800;
    color: var(--zbai-ink);
    margin-bottom: 2px;
}
.zbai-hero-card span {
    display: block;
    font-size: 11px;
    line-height: 1.85;
    color: var(--zbai-muted);
}

/* پیام‌ها */
.zbai-msg { display: flex; align-items: flex-start; gap: 10px; animation: zbai-fade .22s ease; }
@keyframes zbai-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.zbai-msg.bot { justify-content: flex-start; }
.zbai-msg.user { justify-content: flex-end; }

.zbai-msg-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    margin-top: 2px;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(140deg, #5b21b6, #8b5cf6);
    box-shadow: 0 6px 14px -9px rgba(76, 29, 149, .95);
}
.zbai-msg-avatar svg { width: 16px; height: 16px; }

.zbai-bubble {
    max-width: min(78%, 660px);
    font-size: 14px;
    line-height: 2.05;
    white-space: pre-line;
    word-break: break-word;
}
.zbai-msg.bot .zbai-bubble {
    background: #fff;
    color: var(--zbai-ink);
    border: 1px solid var(--zbai-line);
    border-radius: 16px;
    border-start-start-radius: 6px;
    padding: 13px 16px;
    box-shadow: 0 4px 14px -12px rgba(24, 15, 46, .4);
}
.zbai-msg.user .zbai-bubble {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
    border-radius: 16px;
    border-start-end-radius: 6px;
    padding: 12px 16px;
    box-shadow: 0 12px 24px -18px rgba(76, 29, 149, .95);
}

/* کارت محصول */
.zbai-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
    gap: 10px;
    padding-inline-start: 40px;
}
.zbai-card {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--zbai-line);
    border-radius: 15px;
    text-decoration: none;
    color: inherit;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.zbai-card:hover {
    border-color: rgba(109, 40, 217, .42);
    transform: translateY(-2px);
    box-shadow: 0 16px 30px -24px rgba(24, 15, 46, .8);
}
.zbai-card-img {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    border-radius: 11px;
    background: #f4f2f9 center/cover no-repeat;
    border: 1px solid var(--zbai-line);
}
.zbai-card-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.zbai-card-title {
    font-size: 12.8px;
    font-weight: 800;
    line-height: 1.65;
    color: var(--zbai-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.zbai-card-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.zbai-price { font-size: 12.5px; font-weight: 900; color: var(--zbai-purple); }
.zbai-tag {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f3f1f7;
    color: var(--zbai-muted);
}
.zbai-tag.sale { background: rgba(245, 158, 11, .18); color: #b45309; }
.zbai-tag.out { background: rgba(239, 68, 68, .12); color: #b91c1c; }

/* ------------------------------- داک ورودی ------------------------------- */
.zbai-dock {
    flex: 0 0 auto;
    padding: 6px 24px 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 34%);
}
.zbai-dock-inner {
    width: 100%;
    max-width: 824px;
    margin-inline: auto;
}

.zbai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 10px;
}
.zbai-chips:empty { display: none; }
.zbai-chip {
    flex: 0 0 auto;
    padding: 8px 13px;
    border-radius: 11px;
    border: 1px solid var(--zbai-line-strong);
    background: #fff;
    color: #4b4658;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.zbai-chip:hover {
    background: linear-gradient(135deg, rgba(109, 40, 217, .09), rgba(245, 158, 11, .09));
    border-color: rgba(109, 40, 217, .45);
    color: var(--zbai-purple);
    transform: translateY(-1px);
}

.zbai-composer {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 9px 9px 9px 16px;
    background: #fff;
    border: 1px solid var(--zbai-line-strong);
    border-radius: 20px;
    box-shadow:
        0 18px 36px -28px rgba(24, 15, 46, .95),
        0 2px 8px -6px rgba(24, 15, 46, .22);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.zbai-composer:focus-within {
    border-color: rgba(109, 40, 217, .5);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, .09), 0 18px 36px -28px rgba(24, 15, 46, .95);
}
.zbai-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 6px;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13.5px;
    line-height: 44px;
    color: var(--zbai-ink);
    outline: none;
}
.zbai-input::placeholder { color: #a09aae; }

.zbai-send {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #4c1d95, #7c3aed 70%, #a78bfa);
    box-shadow: 0 10px 20px -12px rgba(76, 29, 149, .95);
    transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}
.zbai-send svg { width: 19px; height: 19px; }
.zbai-send:hover { transform: translateY(-1px) scale(1.03); filter: brightness(1.06); }
.zbai-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.zbai-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 9px 4px 0;
    font-size: 10.5px;
    font-weight: 600;
    color: #9c97aa;
}
.zbai-foot a { color: var(--zbai-purple); text-decoration: none; font-weight: 800; }
.zbai-foot a:hover { text-decoration: underline; }

/* تایپینگ */
.zbai-typing { display: inline-flex; gap: 5px; align-items: center; padding: 6px 2px; }
.zbai-typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--zbai-purple-2);
    opacity: .4;
    animation: zbai-bounce 1.1s infinite;
}
.zbai-typing i:nth-child(2) { animation-delay: .15s; }
.zbai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes zbai-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* ==========================================================================
   حالت «اجرای سایت فقط با چت»
   ========================================================================== */
html.zbai-focus { background: #0f0a1e !important; }
html.zbai-focus body > *:not(#zbai-root) { display: none !important; }
html.zbai-focus #zbai-root { position: relative; z-index: 2147483000; }
html.zbai-focus body {
    background:
        radial-gradient(1000px 600px at 12% 8%, rgba(139, 92, 246, .32), transparent 62%),
        radial-gradient(900px 520px at 88% 92%, rgba(245, 158, 11, .22), transparent 60%),
        #0f0a1e !important;
    min-height: 100vh;
}
html.zbai-focus .zbai-fab { display: none !important; }
html.zbai-focus .zbai-backdrop {
    background:
        radial-gradient(900px 520px at 20% 10%, rgba(139, 92, 246, .4), transparent 62%),
        radial-gradient(760px 480px at 82% 90%, rgba(245, 158, 11, .28), transparent 60%),
        #0f0a1e;
    -webkit-backdrop-filter: none;
            backdrop-filter: none;
    opacity: 1;
}
html.zbai-focus .zbai-panel {
    border-color: rgba(255, 255, 255, .16);
    box-shadow: 0 50px 120px -50px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .08);
}

/* در حالت فقط‌چت، بستنِ کادر معنا ندارد؛ خروج فقط با «مشاهده سایت» */
html.zbai-focus .zbai-close { display: none !important; }
html.zbai-focus .zbai-focusbar { background: linear-gradient(90deg, #f3ecff, #faf5ff 55%, #fdf3e2); }

.zbai-switch:disabled { opacity: .6; cursor: progress; }
/* جلوگیری از پرش سایت قبل از بارگذاری جاوااسکریپت */
html.zbai-focus body { overflow: hidden; }

/* ==========================================================================
   موبایل
   ========================================================================== */
@media (max-width: 860px) {
    .zbai-rail { display: none; }
    .zbai-panel { inset: 8px; border-radius: 16px; }
    .zbai-head { padding: 10px 13px; }
    .zbai-switch span.label { display: none; }
    .zbai-switch { padding: 0 8px 0 5px; }
    .zbai-body { padding: 18px 14px 6px; gap: 14px; }
    .zbai-bubble { max-width: 86%; font-size: 13.5px; }
    .zbai-products { grid-template-columns: 1fr; padding-inline-start: 0; }
    .zbai-dock { padding: 4px 14px 10px; }
    .zbai-foot { display: none; }
    .zbai-hero-cards { grid-template-columns: 1fr; }
    .zbai-fab { left: 16px; bottom: 88px; height: 54px; }
    .zbai-fab-icon { width: 42px; height: 42px; flex-basis: 42px; }
    .zbai-fab-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .zbai-fab::before,
    .zbai-fab::after,
    .zbai-fab-glow,
    .zbai-fab-icon svg,
    .zbai-fab-icon::after,
    .zbai-dot,
    .zbai-panel,
    .zbai-msg,
    .zbai-hero,
    .zbai-typing i { animation: none !important; }
}

/* ==========================================================================
   تم تاریک — هماهنگ با پالت خود سایت
   --bg-primary #0a0a0f | --bg-secondary #12121a | --bg-card #1a1a28
   --bg-elevated #252540 | --border-color #2a2a45
   --accent-purple #8b5cf6 | --accent-gold #f59e0b
   ========================================================================== */
.zbai-root {
    --zbai-purple: var(--accent-purple, #8b5cf6);
    --zbai-purple-2: var(--accent-purple-light, #a78bfa);
    --zbai-gold: var(--accent-gold, #f59e0b);
    --zbai-ink: var(--text-primary, #ffffff);
    --zbai-muted: var(--text-muted, #a0a0b8);
    --zbai-line: var(--border-color, #2a2a45);
    --zbai-line-strong: #34344f;
    --zbai-canvas: #0d0d14;
    --zbai-rail: #0f0f16;
    --zbai-card: var(--bg-card, #1a1a28);
}

/* کادر */
.zbai-panel {
    background: var(--bg-secondary, #12121a);
    border-color: rgba(139, 92, 246, .18);
    box-shadow:
        0 40px 100px -40px rgba(0, 0, 0, .9),
        0 14px 40px -26px rgba(0, 0, 0, .8),
        0 0 0 1px rgba(139, 92, 246, .12);
}

/* ریل */
.zbai-rail {
    background: linear-gradient(180deg, #13131d, var(--zbai-rail));
    border-inline-end-color: var(--zbai-line);
}
.zbai-rail-btn {
    background: var(--bg-card, #1a1a28);
    border-color: var(--zbai-line);
    color: var(--text-secondary, #c0c0d0);
}
.zbai-rail-btn:hover {
    background: var(--bg-card-hover, #222236);
    border-color: rgba(139, 92, 246, .5);
    color: var(--accent-purple-light, #a78bfa);
}
.zbai-rail-sep { background: var(--zbai-line); }

/* ستون اصلی و هدر */
.zbai-main { background: var(--bg-secondary, #12121a); }
.zbai-head {
    background: var(--bg-secondary, #12121a);
    border-bottom-color: var(--zbai-line);
}
.zbai-head strong { color: var(--zbai-ink); }
.zbai-head small { color: var(--zbai-muted); }

.zbai-iconbtn {
    background: var(--bg-card, #1a1a28);
    border-color: var(--zbai-line);
    color: var(--text-secondary, #c0c0d0);
}
.zbai-iconbtn:hover {
    background: var(--bg-card-hover, #222236);
    border-color: rgba(139, 92, 246, .55);
    color: var(--accent-purple-light, #a78bfa);
}

.zbai-switch {
    background: var(--bg-card, #1a1a28);
    border-color: var(--zbai-line);
    color: var(--text-secondary, #c0c0d0);
}
.zbai-switch .track { background: #3a3a57; }
.zbai-switch .track::after { background: #e7e7f2; }
.zbai-switch[aria-pressed="true"] {
    background: rgba(139, 92, 246, .16);
    border-color: rgba(139, 92, 246, .6);
    color: var(--accent-purple-light, #a78bfa);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .12);
}
.zbai-switch[aria-pressed="true"] .track {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}

.zbai-focusbar {
    background: linear-gradient(90deg, #1b1630, #171724 58%, #221a1a);
    color: #c4b5fd;
    border-bottom-color: var(--zbai-line);
}

/* جریان گفتگو */
.zbai-body {
    background:
        radial-gradient(1100px 340px at 50% -12%, rgba(139, 92, 246, .16), transparent 70%),
        radial-gradient(700px 260px at 100% 100%, rgba(245, 158, 11, .07), transparent 70%),
        var(--zbai-canvas);
    scrollbar-color: #34344f transparent;
}
.zbai-body::-webkit-scrollbar-thumb { background: #34344f; border-color: var(--zbai-canvas); }

/* خوش‌آمد */
.zbai-hero h3 { color: var(--zbai-ink); }
.zbai-hero p { color: var(--zbai-muted); }
.zbai-hero-card {
    background: var(--bg-card, #1a1a28);
    border-color: var(--zbai-line);
}
.zbai-hero-card:hover {
    background: var(--bg-card-hover, #222236);
    border-color: rgba(139, 92, 246, .55);
    box-shadow: 0 18px 34px -26px rgba(0, 0, 0, .95);
}
.zbai-hero-card b { color: var(--zbai-ink); }
.zbai-hero-card span { color: var(--zbai-muted); }
.zbai-hero-card i {
    background: rgba(139, 92, 246, .16);
    color: var(--accent-purple-light, #a78bfa);
}

/* پیام‌ها */
.zbai-msg.bot .zbai-bubble {
    background: var(--bg-card, #1a1a28);
    border-color: var(--zbai-line);
    color: #e9e9f3;
    box-shadow: 0 6px 18px -16px rgba(0, 0, 0, 1);
}
.zbai-msg.user .zbai-bubble {
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    box-shadow: 0 14px 28px -20px rgba(139, 92, 246, .9);
}
.zbai-msg-avatar { box-shadow: 0 6px 14px -8px rgba(139, 92, 246, .8); }

/* کارت محصول */
.zbai-card {
    background: var(--bg-card, #1a1a28);
    border-color: var(--zbai-line);
}
.zbai-card:hover {
    background: var(--bg-card-hover, #222236);
    border-color: rgba(139, 92, 246, .55);
    box-shadow: 0 18px 34px -26px rgba(0, 0, 0, .95);
}
.zbai-card-img { background-color: #252540; border-color: var(--zbai-line); }
.zbai-card-title { color: var(--zbai-ink); }
.zbai-price { color: var(--accent-gold-light, #fbbf24); }
.zbai-tag { background: #252540; color: var(--text-muted, #a0a0b8); }
.zbai-tag.sale { background: rgba(245, 158, 11, .16); color: var(--accent-gold-light, #fbbf24); }
.zbai-tag.out { background: rgba(244, 63, 94, .16); color: #fb7185; }

/* داک ورودی */
.zbai-dock {
    background: linear-gradient(180deg, rgba(13, 13, 20, 0), var(--zbai-canvas) 36%);
}
.zbai-chip {
    background: var(--bg-card, #1a1a28);
    border-color: var(--zbai-line);
    color: var(--text-secondary, #c0c0d0);
}
.zbai-chip:hover {
    background: rgba(139, 92, 246, .16);
    border-color: rgba(139, 92, 246, .55);
    color: #ddd6fe;
}
.zbai-composer {
    background: var(--bg-card, #1a1a28);
    border-color: var(--zbai-line);
    box-shadow: 0 20px 40px -30px rgba(0, 0, 0, 1), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.zbai-composer:focus-within {
    border-color: rgba(139, 92, 246, .6);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, .14), 0 20px 40px -30px rgba(0, 0, 0, 1);
}
.zbai-input { color: var(--zbai-ink); }
.zbai-input::placeholder { color: #6f7089; }
.zbai-send {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6 62%, var(--accent-gold, #f59e0b));
    box-shadow: 0 12px 24px -14px rgba(139, 92, 246, .95);
}
.zbai-foot { color: #74748d; }
.zbai-foot a { color: var(--accent-purple-light, #a78bfa); }

/* پس‌زمینه و حالت فقط‌چت */
.zbai-backdrop {
    background: rgba(5, 5, 9, .74);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
            backdrop-filter: blur(6px) saturate(120%);
}
html.zbai-focus { background: #0a0a0f !important; }
html.zbai-focus body {
    background:
        radial-gradient(1000px 600px at 12% 8%, rgba(139, 92, 246, .22), transparent 62%),
        radial-gradient(900px 520px at 88% 92%, rgba(245, 158, 11, .16), transparent 60%),
        var(--bg-primary, #0a0a0f) !important;
}
html.zbai-focus .zbai-backdrop {
    background:
        radial-gradient(900px 520px at 20% 10%, rgba(139, 92, 246, .3), transparent 62%),
        radial-gradient(760px 480px at 82% 90%, rgba(245, 158, 11, .2), transparent 60%),
        var(--bg-primary, #0a0a0f);
}
html.zbai-focus .zbai-panel {
    border-color: rgba(139, 92, 246, .28);
    box-shadow:
        0 60px 130px -50px rgba(0, 0, 0, .95),
        0 0 0 1px rgba(139, 92, 246, .16),
        0 0 90px -40px rgba(139, 92, 246, .55);
}

/* دکمه شناور — همان تم، کمی عمیق‌تر */
.zbai-fab {
    background:
        radial-gradient(120% 140% at 20% 12%, rgba(255, 255, 255, .34), transparent 46%),
        linear-gradient(135deg, #5b21b6 0%, #7c3aed 48%, #8b5cf6 100%);
    box-shadow:
        0 18px 42px -16px rgba(0, 0, 0, .95),
        0 0 0 1px rgba(139, 92, 246, .35),
        inset 0 1px 0 rgba(255, 255, 255, .3);
}
/* نوار «حالت چت‌محور» در حالت فوکوس (اولویت بالاتر از قاعده‌ی روشن قبلی) */
html.zbai-focus .zbai-focusbar {
    background: linear-gradient(90deg, #1b1630, #171724 58%, #221a1a);
    color: #c4b5fd;
}
html.zbai-focus .zbai-focusbar a,
html.zbai-focus .zbai-focusbar strong { color: #ddd6fe; }

/* ریل و هدر در حالت تمام‌صفحه کمی عمیق‌تر */
html.zbai-focus .zbai-rail { background: linear-gradient(180deg, #12121b, #0c0c13); }
html.zbai-focus .zbai-head { background: #12121a; }

/* جداکننده و اسکرول‌بار */
.zbai-body { scrollbar-width: thin; }
.zbai-msg-avatar { border: 1px solid rgba(139, 92, 246, .35); }

/* متن‌های کم‌رنگ */
.zbai-bubble a { color: var(--accent-purple-light, #a78bfa); }
.zbai-time, .zbai-meta { color: #74748d; }

/* حالت خالی/تایپینگ */
.zbai-typing span { background: #6d6d8c; }
/* ==========================================================================
   v5.1 — اصلاح ایرادهای چیدمان (بدون تغییر هویت بصری)
   ۱) حذف فضای خالی بزرگ دسکتاپ: بلوک خوش‌آمد در ارتفاع بدنه پخش و وسط‌چین شود
   ۲) هم‌ترازی گرید کارت‌ها با عرض نوار ورودی
   ۳) دکمه «مشاهده سایت» در یک خط بماند؛ متن وضعیت کوتاه شود
   ۴) حذف کنترل‌های تکراری (گفتگوی جدید در هدر، آیکن خانه در ریل هنگام حالت چت)
   ۵) موبایل: فاصله‌های تنگ‌تر و متن کارت حداکثر دو خط
   ========================================================================== */

/* ۱) بلوک خوش‌آمد کل ارتفاع باقیمانده را بگیرد تا محتوا عمودی وسط بنشیند */
.zbai-body > .zbai-hero:last-child {
    flex: 1 1 auto;
    justify-content: center;
    padding-bottom: 18px;
}

/* ۲) عرض کارت‌های پیشنهادی هم‌تراز با نوار ورودی (max-width: 824px) */
.zbai-hero {
    width: 100%;
    max-width: 824px;
    margin-inline: auto;
}

/* ۳) نوار وضعیت: دکمه یک‌خطی، متن با «…» کوتاه شود */
.zbai-focusbar { gap: 12px; }
.zbai-focusbar > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.zbai-viewbtn {
    white-space: nowrap;
    flex: 0 0 auto;
}

/* ۴) کنترل‌های تکراری */
@media (min-width: 861px) {
    /* روی دسکتاپ ریل «گفتگوی جدید» دارد، پس + داخل هدر حذف می‌شود */
    .zbai-head .zbai-newchat { display: none; }
}
/* در حالت چت‌محور، نوار وضعیت دکمه «مشاهده سایت» دارد؛ آیکن خانه در ریل تکراری است */
html.zbai-focus .zbai-rail #zbai-rail-site { display: none; }

/* ۵) موبایل */
@media (max-width: 860px) {
    .zbai-hero { padding-top: 12px; gap: 8px; }
    .zbai-hero-cards { margin-top: 14px; gap: 8px; }
    .zbai-hero-card span {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
    }
    .zbai-dock { padding-bottom: 8px; }
    .zbai-chips { gap: 6px; padding-bottom: 8px; }
    .zbai-focusbar { padding: 7px 12px; gap: 8px; font-size: 11px; }
    .zbai-viewbtn { padding: 5px 12px; font-size: 11px; }
}
