/* SiteOps Investigate AI - Sidebar Panel */
:root {
    --inv-width: 380px;
    --inv-bg: linear-gradient(180deg, #0e1828, #090f1c);
    --inv-border: rgba(64, 224, 208, 0.18);
    --inv-text: #e6f0ff;
    --inv-muted: #7a9ab8;
    --inv-ok: #14c97b;
    --inv-warn: #e6a93c;
    --inv-err: #f05d6a;
    --inv-input-bg: #0a1220;
    --inv-input-border: #1e3a5f;
    --inv-radius: 16px;
}

/* ── Toggle button ─────────────────────────────────────────────── */
.inv-toggle-btn {
    position: fixed;
    right: 20px;
    bottom: 80px;
    z-index: 1800;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1b3d8a, #0e2050);
    border: 1px solid rgba(64, 224, 208, 0.35);
    color: #a8d4ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(64, 224, 208, 0.1) inset;
    transition: all 200ms ease;
}
.inv-toggle-btn:hover {
    background: linear-gradient(135deg, #244faa, #1b3d8a);
    border-color: rgba(64, 224, 208, 0.55);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(64, 224, 208, 0.15);
    transform: translateY(-2px);
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.inv-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--inv-width);
    height: 100vh;
    z-index: 1900;
    background: var(--inv-bg);
    border-left: 1px solid var(--inv-border);
    box-shadow: -12px 0 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}
.inv-sidebar.inv-sidebar-open {
    transform: translateX(0);
}

/* Push main content when sidebar is open */
body.inv-sidebar-active .dashboard-container,
body.inv-sidebar-active .app-shell,
body.inv-sidebar-active .wrap {
    transition: padding-right 280ms cubic-bezier(0.22, 1, 0.36, 1);
    padding-right: var(--inv-width);
}

.inv-sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Header ────────────────────────────────────────────────────── */
.inv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--inv-border);
    flex-shrink: 0;
    gap: 12px;
}
.inv-header-info { flex: 1; min-width: 0; }
.inv-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--inv-text);
    letter-spacing: 0.01em;
}
.inv-header-sub {
    font-size: 11px;
    color: var(--inv-muted);
    margin-top: 2px;
}
.inv-header-actions { display: flex; align-items: center; gap: 8px; }

.inv-clear-btn {
    appearance: none;
    background: transparent;
    color: var(--inv-muted);
    border: 1px solid rgba(64, 224, 208, 0.15);
    border-radius: 7px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 160ms ease;
}
.inv-clear-btn:hover {
    color: var(--inv-text);
    border-color: rgba(64, 224, 208, 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.inv-close-btn {
    appearance: none;
    background: transparent;
    color: var(--inv-muted);
    border: 1px solid rgba(64, 224, 208, 0.15);
    border-radius: 8px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: all 160ms ease;
}
.inv-close-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--inv-text);
    border-color: rgba(64, 224, 208, 0.35);
}

/* ── Meta bar ──────────────────────────────────────────────────── */
.inv-meta {
    padding: 8px 18px;
    font-size: 11.5px;
    color: var(--inv-muted);
    border-bottom: 1px solid rgba(64, 224, 208, 0.08);
    min-height: 32px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.inv-meta.inv-meta-ok   { color: var(--inv-ok); }
.inv-meta.inv-meta-warn { color: var(--inv-warn); }
.inv-meta.inv-meta-err  { color: var(--inv-err); }

/* ── Messages ──────────────────────────────────────────────────── */
.inv-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.inv-messages:empty::before {
    content: "Ask anything about the current dashboard. AI will see exactly what you see.";
    color: var(--inv-muted);
    font-size: 12px;
    text-align: center;
    opacity: 0.7;
    padding: 24px 8px;
    display: block;
}

.inv-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 95%;
    animation: inv-pop 0.2s ease-out;
}
.inv-msg.inv-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.inv-msg.inv-ai { align-self: flex-start; }

@keyframes inv-pop {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.inv-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid rgba(64, 224, 208, 0.25);
    background: #0d1a34;
    color: #d9e7ff;
}
.inv-msg.inv-user .inv-avatar {
    background: #12264d;
    border-color: rgba(104, 163, 255, 0.4);
}

.inv-bubble {
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(64, 224, 208, 0.15);
}
.inv-msg.inv-user .inv-bubble {
    background: linear-gradient(180deg, #173061, #102041);
    color: #e6f0ff;
    border-color: rgba(104, 163, 255, 0.4);
    border-bottom-right-radius: 4px;
}
.inv-msg.inv-ai .inv-bubble {
    background: linear-gradient(180deg, #0f2240, #0a1830);
    color: #c8f5dd;
    border-color: rgba(71, 175, 126, 0.3);
    border-bottom-left-radius: 4px;
}

.inv-typing {
    display: inline-flex;
    gap: 3px;
    padding: 4px 0;
}
.inv-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9fd1ff;
    animation: inv-blink 1.2s infinite;
}
.inv-typing span:nth-child(2) { animation-delay: 0.2s; }
.inv-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes inv-blink {
    0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
    40%           { opacity: 1;    transform: scale(1); }
}

/* ── Screenshot thumbnail ──────────────────────────────────────── */
.inv-screenshot {
    padding: 8px 16px 0;
    display: none;
    flex-shrink: 0;
}
.inv-screenshot.has-shot { display: block; }
.inv-screenshot img {
    width: 100%;
    max-height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(64, 224, 208, 0.15);
    opacity: 0.8;
}

/* ── Footer ────────────────────────────────────────────────────── */
.inv-footer {
    border-top: 1px solid var(--inv-border);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.inv-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--inv-input-border);
    background: var(--inv-input-bg);
    color: var(--inv-text);
    padding: 9px 12px;
    font-size: 12.5px;
    resize: none;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    font-family: inherit;
    line-height: 1.45;
    box-sizing: border-box;
}
.inv-input:focus {
    border-color: rgba(64, 224, 208, 0.45);
    box-shadow: 0 0 0 3px rgba(64, 224, 208, 0.1);
}
.inv-input::placeholder { color: #3a5a7a; }

.inv-footer-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}
.inv-quota {
    margin-right: auto;
    font-size: 11px;
    color: var(--inv-muted);
}
.inv-btn {
    appearance: none;
    border: 1px solid rgba(64, 224, 208, 0.25);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 160ms ease;
    color: var(--inv-text);
    background: rgba(255, 255, 255, 0.03);
}
.inv-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(64, 224, 208, 0.4);
}
.inv-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.inv-btn.inv-btn-primary {
    background: linear-gradient(180deg, #1b3d8a, #132350);
    border-color: rgba(64, 224, 208, 0.45);
}
.inv-btn.inv-btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #244faa, #1b3d8a);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --inv-width: 100vw; }
    .inv-sidebar { border-left: none; border-top: 1px solid var(--inv-border); }
    body.inv-sidebar-active .dashboard-container,
    body.inv-sidebar-active .app-shell,
    body.inv-sidebar-active .wrap { padding-right: 0; }
}

/* ── Contextual hint (in-context help) ─────────────────────────── */
.siteops-investigate-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 10px 0 4px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(64, 224, 208, 0.08);
    border: 1px solid rgba(64, 224, 208, 0.22);
    color: #cfe6ff;
    font-size: 12.5px;
    line-height: 1.5;
}
.siteops-investigate-hint i { color: #14c97b; margin-top: 1px; }
.siteops-investigate-hint b { color: #eaf6ff; }

