/* =====================================================================
   BizSense — AI Business Consultant panel ("תובנות AI")
   Distinctive, production-grade UI for the business-overview insights strip.
   Scoped under .bz-ai-panel so it never leaks into the rest of the app and
   coexists with the Theme Engine. RTL-first.
   ===================================================================== */

.bz-ai-panel {
    --ai-ink:        #0e1230;            /* near-black indigo for text          */
    --ai-violet:     #6d5efc;            /* primary brand accent                */
    --ai-violet-2:   #b14bf4;            /* secondary brand accent              */
    --ai-cyan:       #22d3ee;            /* spark / highlight                   */
    --ai-surface:    #ffffff;
    --ai-line:       rgba(16, 22, 60, .08);
    --ai-radius:     16px;

    position: relative;
    margin: 4px 0 22px;
    padding: 0;
    border-radius: var(--ai-radius);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(177,75,244,.10), transparent 55%),
        radial-gradient(120% 160% at 0% 0%, rgba(109,94,252,.12), transparent 55%),
        linear-gradient(180deg, #fbfbff 0%, #f5f6ff 100%);
    border: 1px solid var(--ai-line);
    box-shadow:
        0 1px 0 rgba(255,255,255,.7) inset,
        0 18px 40px -28px rgba(40,30,120,.55);
    overflow: hidden;
    font-family: 'Assistant','Heebo','Segoe UI',sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* faint grid texture for depth */
.bz-ai-panel::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(109,94,252,.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(109,94,252,.045) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(120% 100% at 100% 0%, #000 10%, transparent 70%);
            mask-image: radial-gradient(120% 100% at 100% 0%, #000 10%, transparent 70%);
    pointer-events: none;
}

/* ---------- header ---------- */
.bz-ai-panel__head {
    position: relative;
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--ai-line);
}
.bz-ai-panel__brand { display: flex; align-items: center; gap: 13px; }
.bz-ai-panel__titles { line-height: 1.15; }
.bz-ai-panel__title {
    font-size: 18px; font-weight: 800; letter-spacing: -.2px;
    color: var(--ai-ink);
    display: flex; align-items: center; gap: 8px;
}
.bz-ai-panel__sub { font-size: 12.5px; color: #6b7194; margin-top: 2px; }

/* BOT AI identity badge */
.bz-ai-badge {
    font-size: 9.5px; font-weight: 800; letter-spacing: .5px;
    padding: 2px 7px; border-radius: 999px; color: #fff;
    background: linear-gradient(120deg, var(--ai-violet), var(--ai-cyan));
    box-shadow: 0 3px 10px -4px rgba(34,211,238,.9);
    text-transform: uppercase; white-space: nowrap;
}

/* proactive greeting bubble from ביזי */
.bz-ai-greeting {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 14px 18px 2px;
}
.bz-ai-orb--sm { width: 28px; height: 28px; flex: 0 0 auto; animation-duration: 9s; }
.bz-ai-orb--sm .bz-ai-orb__core { width: 10px; height: 10px; }
.bz-ai-greeting__bubble {
    position: relative;
    background: linear-gradient(180deg, rgba(109,94,252,.10), rgba(177,75,244,.06));
    border: 1px solid rgba(109,94,252,.22);
    border-radius: 4px 14px 14px 14px;   /* tail on the right for RTL */
    padding: 10px 13px; font-size: 13px; line-height: 1.55; color: var(--ai-ink);
    max-width: 720px;
}
.bz-ai-greeting__bubble b { color: var(--ai-violet); }

/* glowing orb */
.bz-ai-orb {
    position: relative; flex: 0 0 auto;
    width: 40px; height: 40px; border-radius: 50%;
    background: conic-gradient(from 140deg, var(--ai-violet), var(--ai-violet-2), var(--ai-cyan), var(--ai-violet));
    box-shadow: 0 6px 18px -6px rgba(109,94,252,.8);
    display: grid; place-items: center;
    animation: bz-ai-spin 7s linear infinite;
}
.bz-ai-orb__core {
    width: 15px; height: 15px; border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255,255,255,.35), 0 0 14px rgba(34,211,238,.9) inset;
}
@keyframes bz-ai-spin { to { transform: rotate(360deg); } }

/* refresh button */
.bz-ai-refresh {
    display: inline-flex; align-items: center; gap: 7px;
    border: 0; cursor: pointer;
    padding: 8px 15px; border-radius: 999px;
    font-size: 13px; font-weight: 700; color: #fff;
    background: linear-gradient(120deg, var(--ai-violet), var(--ai-violet-2));
    box-shadow: 0 8px 20px -10px rgba(109,94,252,.9);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.bz-ai-refresh:hover { transform: translateY(-1px); filter: brightness(1.05); }
.bz-ai-refresh:active { transform: translateY(0); }
.bz-ai-refresh[disabled] { opacity: .6; cursor: default; filter: grayscale(.3); }
.bz-ai-refresh.is-spinning i { animation: bz-ai-spin 1s linear infinite; }

/* ---------- body ---------- */
.bz-ai-panel__body { position: relative; padding: 16px 18px 18px; }

/* states */
.bz-ai-state {
    display: flex; align-items: center; gap: 12px;
    color: #5b6184; font-size: 13.5px; padding: 6px 2px;
}
.bz-ai-spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2.5px solid rgba(109,94,252,.25);
    border-top-color: var(--ai-violet);
    animation: bz-ai-spin .8s linear infinite;
    flex: 0 0 auto;
}
.bz-ai-typing { display: inline-flex; gap: 4px; align-items: center; }
.bz-ai-typing i {
    width: 6px; height: 6px; border-radius: 50%; background: var(--ai-violet);
    animation: bz-ai-bounce 1.2s infinite ease-in-out;
}
.bz-ai-typing i:nth-child(2) { animation-delay: .15s; background: var(--ai-violet-2); }
.bz-ai-typing i:nth-child(3) { animation-delay: .3s;  background: var(--ai-cyan); }
@keyframes bz-ai-bounce { 0%,80%,100% { transform: translateY(0); opacity:.5 } 40% { transform: translateY(-5px); opacity:1 } }

/* insight grid */
.bz-ai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

/* insight card */
.bz-ai-card {
    position: relative;
    background: var(--ai-surface);
    border: 1px solid var(--ai-line);
    border-radius: 12px;
    padding: 13px 15px 13px 13px;
    box-shadow: 0 10px 26px -22px rgba(30,25,90,.6);
    overflow: hidden;
    opacity: 0; transform: translateY(8px);
    animation: bz-ai-rise .42s cubic-bezier(.22,1,.36,1) forwards;
}
@keyframes bz-ai-rise { to { opacity: 1; transform: none; } }
/* severity accent rail (right side for RTL) */
.bz-ai-card::before {
    content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 4px;
    background: var(--rail, var(--ai-violet));
}
.bz-ai-card[data-sev="high"] { --rail: #ef4444; }
.bz-ai-card[data-sev="med"]  { --rail: #f59e0b; }
.bz-ai-card[data-sev="low"]  { --rail: #10b981; }

.bz-ai-card__top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bz-ai-chip {
    font-size: 10.5px; font-weight: 800; letter-spacing: .3px;
    padding: 2px 8px; border-radius: 999px; color: #fff; white-space: nowrap;
    background: var(--rail, var(--ai-violet));
}
.bz-ai-card__title {
    font-size: 14.5px; font-weight: 800; color: var(--ai-ink);
    line-height: 1.25; margin: 0;
}
.bz-ai-card__finding {
    font-size: 12.8px; color: #4b5170; line-height: 1.5; margin: 6px 0 0;
}
.bz-ai-card__rec {
    font-size: 12.8px; color: var(--ai-ink); line-height: 1.5;
    margin: 9px 0 0; padding: 8px 10px;
    background: linear-gradient(180deg, rgba(109,94,252,.07), rgba(177,75,244,.05));
    border-radius: 9px;
    border: 1px dashed rgba(109,94,252,.28);
}
.bz-ai-card__rec b { color: var(--ai-violet); }

.bz-ai-card__cta {
    margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700; cursor: pointer;
    color: var(--ai-violet); background: none; border: 0; padding: 0;
}
.bz-ai-card__cta:hover { text-decoration: underline; }
.bz-ai-card__cta--soon { color: #9aa0bd; cursor: default; }
.bz-ai-card__cta--soon:hover { text-decoration: none; }
.bz-ai-card__cta--soon em { font-style: normal; font-size: 10.5px; opacity: .8; }

.bz-ai-empty {
    text-align: center; color: #8086a6; font-size: 13px; padding: 14px;
}
.bz-ai-error { color: #c0392b; font-size: 13px; }
.bz-ai-meta { margin-top: 12px; font-size: 11px; color: #9aa0bd; text-align: left; }

/* ---------- dark themes: lighten text on the panel ---------- */
body.bz-themed .bz-ai-panel {
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(177,75,244,.14), transparent 55%),
        linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
}

/* =====================================================================
   Personalized quick-actions strip ("בשימוש תכוף שלך") — Phase 3
   ===================================================================== */
.bz-qa-strip {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin: 0 0 18px; padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f7f8ff);
    border: 1px solid rgba(16,22,60,.07);
    box-shadow: 0 10px 26px -22px rgba(30,25,90,.5);
    font-family: 'Assistant','Heebo','Segoe UI',sans-serif;
}
.bz-qa-strip__title { font-size: 12.5px; font-weight: 800; color: #6d5efc; white-space: nowrap; }
.bz-qa-strip__title i { color: #f5b301; margin-left: 4px; }
.bz-qa-strip__items { display: flex; gap: 8px; flex-wrap: wrap; }
.bz-qa-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 13px; border-radius: 999px; cursor: pointer;
    font-size: 12.5px; font-weight: 700; color: #2e2f45;
    background: #fff; border: 1px solid rgba(109,94,252,.22);
    transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.bz-qa-chip:hover {
    transform: translateY(-1px);
    background: linear-gradient(120deg, rgba(109,94,252,.10), rgba(34,211,238,.10));
    box-shadow: 0 6px 16px -8px rgba(109,94,252,.7);
}
.bz-qa-chip i { color: #6d5efc; font-size: 13px; }
.bz-qa-chip .bz-qa-count { font-size: 10px; color: #9aa0bd; font-weight: 600; }
