/* ==========================================================================
   Easy Hishabbook Assistant — the floating robot (scripts/assistant.js) and the
   Setting ▸ Assistant page (Pages/Assistant.razor).
   Everything is prefixed sba- so nothing here can collide with a page's own classes.
   ========================================================================== */

/* ---------- the robot ----------
   Bottom-left of the WORK AREA, not of the window: the sidebar is fixed down the left edge,
   so the robot sits just right of it and follows it when it collapses. Pages without a
   sidebar get the plain window corner. */
.sba-bot {
    position: fixed;
    left: 24px;
    bottom: 24px;
    /* Under Blazored modals (100) so a popup always covers it, over the page content. */
    z-index: 90;
    width: 76px;
    height: 56px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: transparent;
    display: grid;
    place-items: center;
    animation: sba-float 3.2s ease-in-out infinite;
    transition: left 0.25s ease;
}

/* Set by assistant.js (placeBeside) from SidebarLayout's .side-bar or the company list's
   .company-side-bar - same widths. Not body:has(.side-bar.collapsed): Chrome matched it but
   did not restyle the robot when the menu collapsed, so it stayed where it was. */
.sba-bot.beside-sidebar { left: calc(13.5rem + 16px); }
.sba-bot.beside-collapsed { left: calc(4.5rem + 16px); }

.sba-bot:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; border-radius: 12px; }

.sba-bot svg {
    width: 72px;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 6px 10px rgba(2, 132, 199, .35));
    transition: transform .25s ease-out, filter .2s;
}
.sba-bot:hover svg { filter: drop-shadow(0 8px 14px rgba(2, 132, 199, .55)); }

@keyframes sba-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

/* red badge: a support request has an update the user has not opened yet */
.sba-badge {
    position: absolute;
    top: -2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 99px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
    display: none;
}
.sba-bot.has-update .sba-badge { display: block; animation: sba-pulse 1.4s ease-in-out infinite; }
@keyframes sba-pulse { 50% { transform: scale(1.18); } }

.sba-eyes { transition: transform .12s ease-out; }
.sba-eye { transform-box: fill-box; transform-origin: center; transition: transform .09s ease-in; }
.sba-bot.blink .sba-eye { transform: scaleY(.1); }

/* happy reaction (click) */
.sba-happy-eyes, .sba-blush { opacity: 0; transition: opacity .15s; }
.sba-bot.happy .sba-eye { transform: scaleY(0); }
.sba-bot.happy .sba-happy-eyes { opacity: 1; }
.sba-bot.happy .sba-blush { opacity: .75; }
.sba-bot.happy { animation: sba-hop .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes sba-hop {
    0%   { transform: translateY(0) scale(1, 1); }
    20%  { transform: translateY(2px) scale(1.12, .86); }
    50%  { transform: translateY(-22px) scale(.92, 1.1); }
    75%  { transform: translateY(0) scale(1.06, .94); }
    100% { transform: translateY(0) scale(1, 1); }
}
.sba-bot.happy .sba-antenna-tip { animation: sba-glow .18s ease-in-out infinite alternate; }

.sba-spark {
    position: fixed;
    z-index: 91;
    pointer-events: none;
    font-size: 18px;
    line-height: 1;
    animation: sba-spark .9s ease-out forwards;
}
@keyframes sba-spark {
    0%   { transform: translate(0, 0) scale(.3); opacity: 0; }
    20%  { opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(var(--rot)); opacity: 0; }
}

.sba-antenna-tip { animation: sba-glow 1.6s ease-in-out infinite alternate; }
.sba-antenna-tip.right { animation-delay: .8s; }
@keyframes sba-glow {
    from { fill: #0284c7; }
    to   { fill: #a5f3fc; }
}

/* ---------- chat panel ---------- */
.sba-panel {
    --sba-accent: #0284c7;
    position: fixed;
    left: 24px;
    bottom: 92px;
    z-index: 89;
    width: min(370px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 120px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    transform: scale(.85) translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .2s ease, opacity .2s ease, left .25s ease;
    font-family: inherit;
    font-size: 14px;
    color: #1e293b;
    text-align: left;
}
.sba-panel.beside-sidebar { left: calc(13.5rem + 16px); }
.sba-panel.beside-collapsed { left: calc(4.5rem + 16px); }
.sba-panel.open { transform: none; opacity: 1; pointer-events: auto; }

.sba-head {
    background: linear-gradient(135deg, #0284c7, #0c4a6e);
    color: #fff;
    padding: 12px 14px 0;
}
.sba-head-top { display: flex; justify-content: space-between; align-items: center; }
.sba-head-top b { font-size: 15px; }
.sba-head-top small { display: block; opacity: .8; font-size: 12px; }
.sba-head-top button { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }
.sba-head-actions { display: flex; align-items: center; gap: 10px; }

/* EN / हिंदी switch */
.sba-lang { display: inline-flex; border: 1px solid rgba(255, 255, 255, .45); border-radius: 99px; overflow: hidden; }
.sba-head-top .sba-lang button {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 9px;
    color: rgba(255, 255, 255, .85);
    line-height: 1.4;
}
.sba-head-top .sba-lang button.on { background: #fff; color: #0369a1; }

/* Devanagari needs a little more line height to stay readable at this size. */
.sba-panel[lang="hi"] .sba-msg,
.sba-panel[lang="hi"] .sba-chip { line-height: 1.6; }

.sba-tabs { display: flex; gap: 4px; margin-top: 10px; }
.sba-tabs button {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: rgba(255, 255, 255, .75);
    padding: 8px 0 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    position: relative;
}
.sba-tabs button.on { color: #fff; border-bottom-color: #a5f3fc; }
.sba-dot {
    display: none;
    position: absolute;
    top: 6px;
    margin-left: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f87171;
}
.sba-dot.show { display: inline-block; }

.sba-view { flex: 1; overflow-y: auto; display: none; }
.sba-view.on { display: flex; flex-direction: column; }

.sba-msgs { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sba-msg { max-width: 86%; padding: 9px 12px; border-radius: 12px; line-height: 1.45; word-wrap: break-word; }
.sba-msg.bot { background: #f0f9ff; border: 1px solid #e0f2fe; align-self: flex-start; border-bottom-left-radius: 4px; }
.sba-msg.me { background: var(--sba-accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.sba-msg h4 { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: #0c4a6e; }
.sba-msg ol { margin: 4px 0; padding-left: 20px; }
.sba-msg li { margin: 2px 0; }
.sba-msg .tip { margin-top: 6px; font-size: 13px; color: #475569; }
.sba-msg a.video {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: #dc2626;
    font-weight: 600;
    text-decoration: none;
    font-size: 13px;
}
.sba-msg a.video:hover { text-decoration: underline; }

.sba-chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 100%; }
.sba-chip {
    border: 1px solid #bae6fd;
    background: #fff;
    color: #0369a1;
    border-radius: 99px;
    padding: 5px 11px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
}
.sba-chip:hover { background: #f0f9ff; }
.sba-chip.support { border-color: #fecaca; color: #b91c1c; }
.sba-chip.support:hover { background: #fef2f2; }
.sba-chip:disabled { opacity: .5; cursor: default; }

.sba-typing { display: inline-flex; gap: 4px; }
.sba-typing i { width: 6px; height: 6px; border-radius: 50%; background: #7dd3fc; animation: sba-dots 1s infinite; }
.sba-typing i:nth-child(2) { animation-delay: .15s; }
.sba-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes sba-dots { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* support form, inside the chat */
.sba-form { align-self: stretch; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; background: #fff; }
.sba-form h4 { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.sba-form dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0 0 10px; font-size: 13px; }
.sba-form dt { color: #64748b; font-weight: 400; }
.sba-form dd { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sba-form label { font-size: 13px; color: #475569; display: block; margin: 0; }
.sba-form textarea {
    width: 100%;
    box-sizing: border-box;
    margin-top: 4px;
    min-height: 76px;
    resize: vertical;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px;
    font: inherit;
}
.sba-form .note { font-size: 12px; color: #64748b; margin: 6px 0 10px; }
.sba-form .btns { display: flex; gap: 8px; justify-content: flex-end; }
.sba-form .btns button { border-radius: 8px; padding: 7px 14px; cursor: pointer; font: inherit; font-size: 13px; }
.sba-form .cancel { background: #fff; border: 1px solid #cbd5e1; }
.sba-form .send { background: var(--sba-accent); color: #fff; border: none; font-weight: 600; }
.sba-form .send:disabled { opacity: .6; cursor: default; }
.sba-form .err { color: #dc2626; font-size: 12px; margin-top: 4px; display: none; }

.sba-input { display: flex; border-top: 1px solid #e2e8f0; margin: 0; }
.sba-input input { flex: 1; min-width: 0; border: none; padding: 13px 14px; font: inherit; outline: none; }
.sba-input button { border: none; background: var(--sba-accent); color: #fff; padding: 0 16px; cursor: pointer; font: inherit; font-weight: 600; }

/* My Requests */
.sba-reqs { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.sba-reqs .empty { color: #94a3b8; text-align: center; margin-top: 40px; line-height: 1.6; }
.sba-req { border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; }
.sba-req.fresh { border-color: #fca5a5; box-shadow: 0 0 0 3px #fee2e2; }
.sba-req .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sba-req .id { font-weight: 700; }
.sba-req .date { color: #94a3b8; font-size: 12px; }
.sba-req .problem { color: #334155; margin: 6px 0 10px; line-height: 1.4; white-space: pre-wrap; }
.sba-req .reply {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 10px;
    font-size: 13px;
    white-space: pre-wrap;
}
.sba-req .reply b { color: #15803d; display: block; margin-bottom: 2px; font-size: 12px; }

/* The conversation under a request: user and team, until it is Resolved. */
.sba-thread {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    max-height: 260px;
    overflow-y: auto;
}
.sba-tmsg { max-width: 88%; border-radius: 10px; padding: 6px 10px; font-size: 13px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.sba-tmsg b { display: block; font-size: 11px; margin-bottom: 2px; }
.sba-tmsg.team { align-self: flex-start; background: #f0fdf4; border: 1px solid #bbf7d0; }
.sba-tmsg.team b { color: #15803d; }
.sba-tmsg.me { align-self: flex-end; background: #e0f2fe; border: 1px solid #bae6fd; }
.sba-tmsg.me b { color: #0369a1; }
.sba-rbox { display: flex; gap: 6px; align-items: flex-end; margin-top: 10px; }
.sba-rbox textarea {
    flex: 1;
    min-width: 0;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 9px;
    font: inherit;
    font-size: 13px;
    line-height: 1.35;
    outline: none;
    box-sizing: border-box;
}
.sba-rbox textarea:focus { border-color: var(--sba-accent); }
.sba-rbox button { border: none; border-radius: 8px; background: var(--sba-accent); color: #fff; padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.sba-rbox button:disabled { opacity: .6; cursor: default; }
.sba-rerr { color: #dc2626; font-size: 12px; margin-top: 4px; display: none; }
.sba-closed { margin-top: 10px; font-size: 12px; color: #64748b; background: #f8fafc; border-radius: 8px; padding: 6px 10px; }

.sba-steps { display: flex; align-items: flex-start; }
.sba-step { flex: 1; text-align: center; position: relative; font-size: 11px; color: #94a3b8; }
.sba-step::before {                   /* line to the previous step */
    content: "";
    position: absolute;
    top: 7px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: #e2e8f0;
}
.sba-step:first-child::before { display: none; }
.sba-step i {
    position: relative;
    z-index: 1;
    display: block;
    width: 16px;
    height: 16px;
    margin: 0 auto 4px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #cbd5e1;
    box-sizing: border-box;
}
.sba-step.done { color: #0369a1; }
.sba-step.done::before { background: #0284c7; }
.sba-step.done i { background: #0284c7; border-color: #0284c7; }
.sba-step.now i { box-shadow: 0 0 0 4px #bae6fd; }
.sba-step.now { font-weight: 700; }
.sba-step.resolved i { background: #16a34a; border-color: #16a34a; box-shadow: 0 0 0 4px #bbf7d0; }
.sba-step.resolved { color: #15803d; }

/* Below 700px the sidebar becomes an off-canvas drawer (SidebarLayout.razor.css), so the
   robot goes back to the window corner. */
@media (max-width: 700px) {
    .sba-bot,
    .sba-bot.beside-sidebar,
    .sba-bot.beside-collapsed { left: 16px; bottom: 16px; }

    .sba-panel,
    .sba-panel.beside-sidebar,
    .sba-panel.beside-collapsed { left: 16px; bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
    .sba-bot, .sba-antenna-tip, .sba-bot.has-update .sba-badge { animation: none; }
}

/* ==========================================================================
   Setting ▸ Assistant page
   ========================================================================== */
.assistant-container {
    position: fixed;
    top: 4rem;
    bottom: 4rem;
    left: 14rem;
    right: 0;
    transition: left 0.2s ease;
    overflow-y: auto;
    padding: 0 10px 10px;
    box-sizing: border-box;
}
.assistant-container.sidebar-collapsed { left: 5rem; }

.assistant-card {
    background: #fff;
    border: 1px solid #e3e9f0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    max-width: 760px;
    padding: 18px 22px 20px;
    color: #1e293b;
}
.assistant-card h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: #0c4a6e; }
.assistant-card h3 { margin: 18px 0 6px; font-size: 15px; font-weight: 700; color: #0c4a6e; }
.assistant-card p { margin: 0; color: #475569; }
.assistant-card ul { margin: 0; padding-left: 20px; }
.assistant-card li { color: #475569; line-height: 1.6; font-size: 14px; margin: 2px 0; }
.assistant-open-btn {
    margin-top: 14px;
    border: none;
    border-radius: 8px;
    background: #0284c7;
    color: #fff;
    padding: 8px 16px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.assistant-open-btn:hover { background: #0369a1; }

@media (max-width: 700px) {
    .assistant-container,
    .assistant-container.sidebar-collapsed { left: 0; top: 5rem; }
}
