/* ============================================================
   ibv-inno.css — Inno agent chat drawer (left, v0.5)
   Design source: www/design-preview/inno-chat-panel.html (v2,
   user-approved iteration). Mechanism mirrors .ibv-sidebar's
   fixed + translateX slide-in, but WITHOUT the dark overlay —
   it covers the page on top instead of pushing content aside
   (reverted 2026-07-16: the initial page-push behavior was
   rejected after seeing it live).
   Design tokens: ibv-tokens.css
   ============================================================ */

/* ── Drawer ────────────────────────────────────────────────── */
.ibv-inno {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 48; /* below nav sidebar (50) so the nav drawer wins if both open */
    width: 400px;
    max-width: 96vw;
    display: flex;
    flex-direction: column;
    background: var(--ibv-card);
    border-right: 1px solid var(--ibv-border);
    box-shadow: 0 16px 50px rgba(44,24,16,.12);
    transform: translateX(-100%);
    transition: transform .24s cubic-bezier(.4,0,.2,1);
}
.ibv-inno-open .ibv-inno {
    transform: translateX(0);
}

/* ── Edge tab (sole entry point) ─────────────────────────────
   Fixed to the viewport's left edge, vertically centered — deliberately
   NOT inside the compose card (the previous iteration's toggle sat
   directly above the provider/model selector there; moved out per
   explicit direction). z-index sits below the open drawer (48) so the
   drawer simply covers it while open — no separate hide/close wiring
   needed for this element. */
.ibv-inno-edge-tab {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 40px;
    z-index: 45;
    border: none;
    border-radius: 0 8px 8px 0;
    background: linear-gradient(180deg, var(--ibv-accent), var(--ibv-accent-2));
    box-shadow: 2px 0 10px rgba(44,24,16,.18);
    cursor: pointer;
    padding: 0;
    transition: width .15s ease, box-shadow .15s ease;
}
.ibv-inno-edge-tab:hover,
.ibv-inno-edge-tab:focus-visible {
    width: 14px;
    box-shadow: 3px 0 14px rgba(44,24,16,.28);
}

/* ── Shared round mark (avatar) ────────────────────────────── */
.ibv-inno-mark {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ibv-ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Head ──────────────────────────────────────────────────── */
.ibv-inno-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--ibv-border);
    flex-shrink: 0;
}
.ibv-inno-head-text { flex: 1; min-width: 0; }
.ibv-inno-name-row { display: flex; align-items: baseline; gap: 6px; }
.ibv-inno-name { font-size: .9rem; font-weight: 700; color: var(--ibv-ink); }
.ibv-inno-role { font-size: .66rem; color: var(--ibv-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ibv-inno-status { font-size: .68rem; color: var(--ibv-success); display: flex; align-items: center; gap: 4px; margin-top: 1px; }
.ibv-inno-status .ibv-inno-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ibv-success); }
.ibv-inno-status.ibv-inno-off { color: var(--ibv-muted); }
.ibv-inno-status.ibv-inno-off .ibv-inno-dot { background: var(--ibv-muted); }
.ibv-inno-head-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ibv-inno-head-actions .ibv-btn { font-size: .72rem; padding: 5px 10px; }

/* ── Stream ────────────────────────────────────────────────── */
.ibv-inno-stream {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}
.ibv-inno-stream::-webkit-scrollbar { width: 4px; }
.ibv-inno-stream::-webkit-scrollbar-thumb { background: var(--ibv-border-strong); border-radius: 2px; }

/* A: user message — neutral light bubble, right-aligned */
.ibv-inno-msg-user {
    align-self: flex-end;
    max-width: 82%;
    background: var(--ibv-bg-soft);
    border: 1px solid var(--ibv-border);
    color: var(--ibv-text);
    padding: 9px 13px;
    border-radius: 14px 14px 4px 14px;
    font-size: .85rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

/* B: agent reply — left, avatar + bubble */
.ibv-inno-msg-agent {
    align-self: flex-start;
    max-width: 90%;
    display: flex;
    gap: 8px;
}
.ibv-inno-msg-agent .ibv-inno-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--ibv-ink);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.ibv-inno-msg-agent .ibv-inno-bubble {
    background: var(--ibv-card-elevated);
    border: 1px solid var(--ibv-border);
    padding: 10px 13px;
    border-radius: 4px 14px 14px 14px;
    font-size: .85rem;
    line-height: 1.65;
    color: var(--ibv-text);
    white-space: pre-wrap;
    word-break: break-word;
    min-width: 0;
}
.ibv-inno-prompt-block {
    display: block;
    margin: 7px 0 2px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--ibv-accent-soft);
    border: 1px dashed color-mix(in srgb, var(--ibv-accent) 45%, transparent);
    font-size: .82rem;
    line-height: 1.6;
}
.ibv-inno-actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.ibv-inno-actions .ibv-btn { font-size: .72rem; padding: 4px 10px; }

/* C: minor log — small gray, stays in stream */
.ibv-inno-log {
    align-self: center;
    max-width: 96%;
    font-size: .68rem;
    color: var(--ibv-muted);
    opacity: .85;
    display: flex;
    align-items: baseline;
    gap: 5px;
    padding: 1px 4px;
    text-align: center;
}
.ibv-inno-log .ibv-inno-t { font-family: var(--ibv-font-mono); font-size: .62rem; flex-shrink: 0; }
/* 2026-07-30: recent-activity summary (see addLog() call sites in
   ibv-inno.js) is one multi-line block under a single timestamp, not one
   addLog() per row — without this the block's own newlines would just
   collapse to spaces. */
.ibv-inno-log > span:last-child { white-space: pre-line; text-align: left; }

/* D: transient toast — smaller gray, auto-fades after 10s */
.ibv-inno-toast {
    align-self: center;
    max-width: 92%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--ibv-bg-soft);
    border: 1px solid var(--ibv-border);
    color: var(--ibv-muted);
    font-size: .7rem;
    line-height: 1.5;
    transition: opacity .5s ease;
}
.ibv-inno-toast.ibv-inno-fading { opacity: 0; }

/* E: confirm card (/op write step) */
.ibv-inno-confirm {
    align-self: stretch;
    border: 1px solid var(--ibv-border-strong);
    border-radius: 10px;
    background: var(--ibv-card-elevated);
    padding: 10px 12px;
    font-size: .8rem;
    line-height: 1.6;
    color: var(--ibv-text);
}
.ibv-inno-confirm .ibv-inno-confirm-title { font-weight: 700; color: var(--ibv-ink); margin-bottom: 4px; }
.ibv-inno-confirm code {
    font-family: var(--ibv-font-mono);
    font-size: .74rem;
    background: var(--ibv-bg-soft);
    border-radius: 4px;
    padding: 1px 5px;
}
.ibv-inno-confirm .ibv-inno-actions { margin-top: 8px; }

/* typing indicator */
.ibv-inno-typing { display: inline-flex; gap: 3px; align-items: center; padding: 2px 0; }
.ibv-inno-typing span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--ibv-muted);
    animation: ibv-inno-blink 1.2s infinite ease-in-out;
}
.ibv-inno-typing span:nth-child(2) { animation-delay: .18s; }
.ibv-inno-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes ibv-inno-blink { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }

/* ── Composer ──────────────────────────────────────────────── */
.ibv-inno-composer {
    flex-shrink: 0;
    border-top: 1px solid var(--ibv-border);
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    position: relative;
}
.ibv-inno-composer textarea {
    flex: 1;
    min-height: 38px;
    max-height: 100px;
    resize: none;
    font-size: .82rem;
    padding: 8px 11px;
    border: 1px solid var(--ibv-border);
    border-radius: var(--ibv-radius);
    background: var(--ibv-bg);
    color: var(--ibv-text);
    font-family: var(--ibv-font-sans);
}
.ibv-inno-mic {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--ibv-border-strong);
    background: var(--ibv-card);
    color: var(--ibv-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, transform .1s, color .15s;
    user-select: none;
    -webkit-user-select: none;
}
.ibv-inno-mic.ibv-inno-recording {
    background: var(--ibv-danger);
    border-color: var(--ibv-danger);
    color: #fff;
    transform: scale(1.1);
}
.ibv-inno-mic-hint {
    position: absolute;
    bottom: 54px;
    right: 60px;
    font-size: .68rem;
    color: var(--ibv-muted);
    background: var(--ibv-card-elevated);
    border: 1px solid var(--ibv-border);
    padding: 3px 9px;
    border-radius: 8px;
    display: none;
    z-index: 2;
}
.ibv-inno-mic-hint.ibv-inno-show { display: block; }

/* slash suggestions */
.ibv-inno-slash-menu {
    position: absolute;
    bottom: 58px;
    left: 12px;
    right: 12px;
    background: var(--ibv-card);
    border: 1px solid var(--ibv-border-strong);
    border-radius: 10px;
    box-shadow: var(--ibv-shadow);
    padding: 4px;
    display: none;
    flex-direction: column;
    z-index: 3;
}
.ibv-inno-slash-menu.ibv-inno-show { display: flex; }
.ibv-inno-slash-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 9px;
    border: none;
    background: transparent;
    border-radius: 7px;
    cursor: pointer;
    text-align: left;
    font-family: var(--ibv-font-sans);
}
.ibv-inno-slash-item:hover, .ibv-inno-slash-item.ibv-inno-active { background: var(--ibv-accent-soft); }
.ibv-inno-slash-item code { font-family: var(--ibv-font-mono); font-size: .76rem; color: var(--ibv-accent); }
.ibv-inno-slash-item span { font-size: .72rem; color: var(--ibv-muted); }

/* ── Rules overlay ─────────────────────────────────────────── */
.ibv-inno-rules-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44,24,16,.32);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 60;
}
.ibv-inno-rules-overlay.ibv-inno-show { display: flex; }
.ibv-inno-rules-panel {
    width: 420px;
    max-width: 92vw;
    max-height: 86vh;
    overflow-y: auto;
    background: var(--ibv-card);
    border-radius: var(--ibv-radius-lg);
    box-shadow: 0 24px 60px rgba(0,0,0,.24);
    padding: 22px;
}
.ibv-inno-rules-panel h3 { margin: 0 0 10px; font-size: 1.02rem; color: var(--ibv-ink); font-family: var(--ibv-font-sans); }
.ibv-inno-rule-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ibv-border);
}
.ibv-inno-rule-row:last-of-type { border-bottom: none; }
.ibv-inno-rule-text strong { display: block; font-size: .84rem; color: var(--ibv-ink); font-weight: 600; }
.ibv-inno-rule-text span { font-size: .72rem; color: var(--ibv-muted); }
.ibv-inno-rule-row.ibv-inno-disabled { opacity: .5; }
.ibv-inno-switch {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: var(--ibv-border-strong);
    flex-shrink: 0;
    cursor: pointer;
    transition: background .15s;
    border: none;
    padding: 0;
}
.ibv-inno-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
    transition: left .15s;
}
.ibv-inno-switch.ibv-inno-on { background: var(--ibv-success); }
.ibv-inno-switch.ibv-inno-on::after { left: 18px; }
.ibv-inno-switch.ibv-inno-locked { cursor: not-allowed; }
.ibv-inno-rules-note {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--ibv-bg-soft);
    font-size: .72rem;
    color: var(--ibv-muted);
    line-height: 1.7;
}
.ibv-inno-rules-close-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
