/* =============================================================================
   NANOVERSE — Floating Activity Bar & Command Bar System   v2.0.0
   A floating pill-shaped activity bar on the left, a cinematic bottom-center
   command bar for search, and glass overlay panels for Nexus/History.
   Design: Liquid-glass 3D aesthetic — organic, minimal, futuristic.
   ============================================================================= */

/* ─── Design Tokens (scoped) ────────────────────────────────────────────────── */
:root {
    --ab-width: 56px;
    --ab-gap: 18px;                        /* gap from left viewport edge  */
    --ab-icon-size: 20px;
    --ab-btn-size: 44px;
    --ab-glass-bg: rgba(22, 22, 28, 0.50);
    --ab-glass-border: rgba(255, 255, 255, 0.07);
    --ab-glass-highlight: rgba(255, 255, 255, 0.04);
    --ab-glass-blur: 28px;
    --ab-glass-shadow:
        0  2px  6px rgba(0, 0, 0, 0.30),
        0  8px 32px rgba(0, 0, 0, 0.25),
        inset 0  1px  0 rgba(255, 255, 255, 0.06);
    --ab-radius: 22px;

    --cmd-max-width: 720px;
    --cmd-glass-bg: rgba(18, 18, 26, 0.58);
    --cmd-glass-blur: 44px;
    --cmd-glass-border: rgba(255, 255, 255, 0.08);
    --cmd-glass-shadow:
        inset 0  1px  0   rgba(255, 255, 255, 0.06),
        inset 0 -1px  0   rgba(0, 0, 0, 0.30),
        0  2px  6px rgba(0, 0, 0, 0.18),
        0 12px 32px rgba(0, 0, 0, 0.30),
        0 32px 80px rgba(0, 0, 0, 0.20);
    --cmd-radius: 20px;

    --panel-glass-bg: rgba(22, 22, 34, 0.72);
    --panel-glass-blur: 32px;
    --panel-glass-border: rgba(255, 255, 255, 0.10);
    --panel-glass-shadow:
        0  8px 40px rgba(0, 0, 0, 0.50),
        inset 0  1px  0 rgba(255, 255, 255, 0.07);
    --panel-radius: 24px;

    /* Neutral warm-white accent for activity bar */
    --nv-ab-accent: rgba(255, 255, 255, 0.88);
    --nv-ab-accent-glow: rgba(255, 255, 255, 0.12);
    --nv-ab-accent-soft: rgba(255, 255, 255, 0.06);

    /* Panel accents — kept subtle */
    --nv-cyan: var(--accent-nanoverse, #00f0ff);
    --nv-cyan-glow: rgba(0, 240, 255, 0.25);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   1. RESULTS SHELL — full-viewport grid, no sidebar
   ═══════════════════════════════════════════════════════════════════════════════ */
.nv-results-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100%;
    /* leave room for activity bar on desktop */
    padding-left: calc(var(--ab-width) + var(--ab-gap) + 12px);
    box-sizing: border-box;
    transition: padding 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   2. FLOATING ACTIVITY BAR — pill column, left-center
   ═══════════════════════════════════════════════════════════════════════════════ */
.nv-activity-bar {
    position: fixed;
    left: var(--ab-gap);
    top: 50%;
    transform: translateY(-50%);
    z-index: 1100;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 26px 7px;
    width: var(--ab-width);

    /* Liquid glass */
    background: var(--ab-glass-bg);
    -webkit-backdrop-filter: blur(var(--ab-glass-blur)) saturate(1.2);
            backdrop-filter: blur(var(--ab-glass-blur)) saturate(1.2);
    border: 1px solid var(--ab-glass-border);
    border-top-color: rgba(255, 255, 255, 0.10);
    border-bottom-color: rgba(0, 0, 0, 0.18);
    border-radius: var(--ab-radius);
    box-shadow: var(--ab-glass-shadow);

    /* Top-edge light reflection */
    background-image:
        linear-gradient(
            180deg,
            var(--ab-glass-highlight) 0%,
            transparent 40%
        );
    background-blend-mode: screen;

    /* Smooth entrance */
    animation: abSlideIn 0.6s cubic-bezier(0.23, 1, 0.32, 1) both;
}

@keyframes abSlideIn {
    from { opacity: 0; transform: translateY(-50%) translateX(-24px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}


/* ── Activity Bar Buttons ─────────────────────────────────────────────────── */
.nv-ab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ab-btn-size);
    height: var(--ab-btn-size);
    border: none;
    border-radius: 14px;
    background: transparent;
    color: rgba(255, 255, 255, 0.40);
    font-size: var(--ab-icon-size);
    cursor: pointer;
    transition:
        background 0.25s ease,
        color      0.25s ease,
        box-shadow 0.25s ease,
        transform  0.18s ease;
    position: relative;
    /* Remove all outlines/focus rings that cause the "line" artifact */
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-focus-ring-color: transparent;
}

.nv-ab-btn:focus,
.nv-ab-btn:focus-visible {
    outline: none !important;
    box-shadow: none;
}

.nv-ab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    transform: scale(1.06);
}

.nv-ab-btn:active {
    transform: scale(0.94);
    background: rgba(255, 255, 255, 0.04);
}

/* Active state — neutral warm highlight, no colored accents */
.nv-ab-btn.active {
    background: var(--nv-ab-accent-soft);
    color: var(--nv-ab-accent);
    box-shadow: none;
}

/* Remove the indicator bar/dot entirely — it was causing the "weird line" */
.nv-ab-btn.active::after {
    display: none;
    content: none;
}


/* ── Logo (Home) button ─────────────────────────────────────────────────── */
.nv-ab-logo {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    object-fit: contain;
    filter: brightness(0.85) drop-shadow(0 0 3px rgba(255, 255, 255, 0.10));
    transition: filter 0.25s ease;
}

.nv-ab-btn:hover .nv-ab-logo {
    filter: brightness(1) drop-shadow(0 0 6px rgba(255, 255, 255, 0.18));
}


/* ── Separator ──────────────────────────────────────────────────────────── */
.nv-ab-separator {
    width: 26px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    margin: 4px 0;
}


/* ── Download Button & Hover Menu ───────────────────────────────────────── */
.nv-ab-download-wrap {
    position: relative;
}

.nv-ab-download-menu {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    padding-left: 8px;
    margin-left: 10px;
    min-width: 150px;

    background: var(--ab-glass-bg);
    -webkit-backdrop-filter: blur(var(--ab-glass-blur)) saturate(1.2);
            backdrop-filter: blur(var(--ab-glass-blur)) saturate(1.2);
    border: 1px solid var(--ab-glass-border);
    border-radius: 14px;
    box-shadow: var(--ab-glass-shadow);

    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(-6px);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
    z-index: 1200;
}

/* Invisible bridge between button and menu — prevents hover loss in the gap */
.nv-ab-download-menu::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 0;
    width: 14px;
    height: 100%;
}

.nv-ab-download-wrap:hover .nv-ab-download-menu,
.nv-ab-download-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.nv-ab-dl-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}

.nv-ab-dl-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
}

.nv-ab-dl-option:active {
    background: rgba(255, 255, 255, 0.04);
}

.nv-ab-dl-option i {
    font-size: 15px;
    width: 18px;
    text-align: center;
}

.nv-ab-dl-option[data-format="pdf"] i  { color: #ff5252; }
.nv-ab-dl-option[data-format="docx"] i { color: #448aff; }
.nv-ab-dl-option[data-format="md"] i   { color: #69f0ae; }


/* ═══════════════════════════════════════════════════════════════════════════════
   2b. WORKSPACE TAB BAR — floating fallback for non-Electron (PWA/web)
       In Electron, tabs render inside the desktop title bar instead.
   ═══════════════════════════════════════════════════════════════════════════════ */
.nv-tab-bar {
    position: fixed;
    top: 12px;
    left: calc(var(--ab-width, 56px) + var(--ab-gap, 18px) + 12px);
    right: 12px;
    display: flex;
    align-items: center;
    height: 42px;
    min-height: 42px;
    padding: 0 14px;
    background: rgba(16, 16, 22, 0.75);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
            backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.35),
        0 1px 0 rgba(255, 255, 255, 0.04) inset;
    z-index: 1090;
    animation: abSlideIn 0.4s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.nv-tab-bar-list {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
}
.nv-tab-bar-list::-webkit-scrollbar { display: none; }

.nv-tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    min-width: 100px;
    max-width: 200px;
    height: 30px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
    flex-shrink: 0;
    position: relative;
}
.nv-tab-item:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-1px);
}
.nv-tab-item.active {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 1px 4px rgba(0, 0, 0, 0.2);
}

.nv-tab-icon {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}
.nv-tab-item.active .nv-tab-icon {
    color: var(--nv-cyan, #00f0ff);
}

.nv-tab-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.nv-tab-item.active .nv-tab-label {
    color: rgba(255, 255, 255, 0.90);
}

.nv-tab-close {
    background: none;
    border: none;
    color: transparent;
    font-size: 9px;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nv-tab-item:hover .nv-tab-close {
    color: rgba(255, 255, 255, 0.35);
}
.nv-tab-close:hover {
    color: #f87171 !important;
    background: rgba(248, 113, 113, 0.12);
}

/* Tab type accents */
.nv-tab-type-browser .nv-tab-icon { color: rgba(99, 102, 241, 0.7); }
.nv-tab-type-browser.active .nv-tab-icon { color: #818cf8; }
.nv-tab-type-deep-research .nv-tab-icon { color: rgba(0, 240, 255, 0.6); }
.nv-tab-type-deep-research.active .nv-tab-icon { color: var(--nv-cyan); }

/* Hibernated tab dimming */
.nv-tab-hibernated {
    opacity: 0.45;
}
.nv-tab-hibernated .nv-tab-label {
    font-style: italic;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   3. COMMAND BAR — large rectangular floating input (Liquid Glass 3D)
   ═══════════════════════════════════════════════════════════════════════════════ */
.nv-command-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    z-index: 1200;

    width: 92%;
    max-width: var(--cmd-max-width);
    box-sizing: border-box;

    /* ── Liquid glass shell — rectangular, 3D depth ─────────────── */
    background:
        linear-gradient(
            172deg,
            rgba(255, 255, 255, 0.045) 0%,
            rgba(255, 255, 255, 0.012) 35%,
            transparent 65%
        ),
        var(--cmd-glass-bg);
    -webkit-backdrop-filter: blur(var(--cmd-glass-blur)) saturate(1.25);
            backdrop-filter: blur(var(--cmd-glass-blur)) saturate(1.25);

    /* Asymmetric 3D border — top is brighter (light source), bottom darker */
    border: 1px solid var(--cmd-glass-border);
    border-top-color: rgba(255, 255, 255, 0.11);
    border-left-color: rgba(255, 255, 255, 0.09);
    border-bottom-color: rgba(0, 0, 0, 0.22);
    border-right-color: rgba(0, 0, 0, 0.12);
    border-radius: var(--cmd-radius);
    box-shadow: var(--cmd-glass-shadow);

    /* Invisible by default */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        transform  0.5s  cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity    0.4s  ease,
        visibility 0.4s  ease,
        box-shadow 0.35s ease;
}

/* ── Open state ───────────────────────────────────────────────────────── */
.nv-command-bar.open {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Corner accent lights — subtle 3D depth indicators ────────────────── */
.nv-command-bar::before,
.nv-command-bar::after {
    content: '';
    position: absolute;
    pointer-events: none;
    z-index: -1;
    border-radius: inherit;
}

/* Top-left / top-right warm highlight */
.nv-command-bar::before {
    top: -1px;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.10) 20%,
        rgba(255, 255, 255, 0.14) 50%,
        rgba(255, 255, 255, 0.10) 80%,
        transparent 100%
    );
    border-radius: 0;
}

/* Bottom ambient shadow glow */
.nv-command-bar::after {
    bottom: -8px;
    left: 10%;
    right: 10%;
    height: 16px;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.18) 0%,
        transparent 70%
    );
    filter: blur(6px);
    border-radius: 50%;
}

/* ── Focus-within: top highlight brightens subtly ─────────────────────── */
.nv-command-bar:focus-within {
    border-top-color: rgba(255, 255, 255, 0.15);
    box-shadow:
        inset 0  1px  0   rgba(255, 255, 255, 0.08),
        inset 0 -1px  0   rgba(0, 0, 0, 0.30),
        0  2px  8px rgba(0, 0, 0, 0.20),
        0 14px 36px rgba(0, 0, 0, 0.32),
        0 36px 90px rgba(0, 0, 0, 0.18);
}

.nv-command-bar:focus-within::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.12) 20%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0.12) 80%,
        transparent 100%
    );
}


/* ── Inner form — OVERRIDE all new-style.css base styles ───────────────── */
.nv-command-bar .search-form-container {
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

.nv-command-bar #search-form-results {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    width: 100% !important;
    height: auto !important;
}

/* Kill all cinematic glow pseudo-elements from new-style.css */
.nv-command-bar #search-form-results::before,
.nv-command-bar #search-form-results::after {
    display: none !important;
    content: none !important;
}


/* ── Input field — large text area at the top ──────────────────────────── */
.nv-command-bar #search-query-results {
    flex: none !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: rgba(240, 240, 248, 0.92);
    font-size: 0.95rem;
    font-weight: 400;
    font-family: var(--font-body, 'Inter', 'Poppins', sans-serif);
    letter-spacing: 0.01em;
    line-height: 1.5;
    padding: 16px 20px 12px !important;
    min-height: 28px;
    box-sizing: border-box !important;
    caret-color: rgba(255, 255, 255, 0.60);
    resize: none;
}

.nv-command-bar #search-query-results::placeholder {
    color: rgba(255, 255, 255, 0.20);
    font-weight: 400;
    font-style: normal;
    letter-spacing: 0.015em;
}

.nv-command-bar #search-query-results:focus::placeholder {
    color: rgba(255, 255, 255, 0.13);
}


/* ── Toolbar — below input, separated by a faint divider ──────────────── */
.nv-command-bar .search-bar-toolbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between !important;
    width: 100% !important;
    gap: 6px;
    padding: 8px 14px 10px;
    box-sizing: border-box;
    border-top: 1px solid rgba(255, 255, 255, 0.045);
}

.nv-command-bar .search-bar-toolbar button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.35);
    padding: 7px 12px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    outline: none !important;
    -webkit-tap-highlight-color: transparent;
    transition:
        background  0.25s ease,
        color       0.25s ease,
        border-color 0.25s ease,
        box-shadow  0.25s ease,
        transform   0.2s  ease;
}

.nv-command-bar .search-bar-toolbar button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.75);
    border-color: rgba(255, 255, 255, 0.10);
}

.nv-command-bar .search-bar-toolbar button:active {
    transform: scale(0.96);
}

/* ── Deep Research button — left side ──────────────────────────────────── */
.nv-command-bar .deep-research-btn {
    display: flex !important;
    align-items: center;
    gap: 6px;
    order: 1 !important;
    border-radius: 10px;
    padding: 7px 14px !important;
    background: rgba(255, 255, 255, 0.025) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
    color: rgba(255, 255, 255, 0.40) !important;
    height: auto !important;
    transform: none !important;
    position: static !important;
}

.nv-command-bar .deep-research-btn:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: rgba(255, 255, 255, 0.80) !important;
    box-shadow: none !important;
}

.nv-command-bar .deep-research-btn i {
    font-size: 0.80rem;
}

.nv-command-bar .deep-research-btn span {
    display: inline;
    font-size: 0.78rem;
    font-weight: 500;
}

/* ── Mic button — right side ──────────────────────────────────────────── */
.nv-command-bar .mic-button-results {
    font-size: 0.85rem !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 10px !important;
    order: 2 !important;
    margin-left: auto;
}

.nv-command-bar .mic-button-results:hover {
    color: rgba(255, 255, 255, 0.80) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: none !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   4. MAIN CONTENT — full-width results area
   ═══════════════════════════════════════════════════════════════════════════════ */
.nv-results-main {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 120px;  /* extra bottom padding for command bar */
    box-sizing: border-box;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   5. OVERLAY PANELS — glass sheets for Nexus & History
   ═══════════════════════════════════════════════════════════════════════════════ */
.nv-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 1150;
    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity    0.3s ease,
        visibility 0.3s ease;
}

.nv-panel-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Backdrop scrim */
.nv-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(4px);
            backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

/* Glass card */
.nv-panel-glass {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;

    background: var(--panel-glass-bg);
    -webkit-backdrop-filter: blur(var(--panel-glass-blur));
            backdrop-filter: blur(var(--panel-glass-blur));
    border: 1px solid var(--panel-glass-border);
    border-radius: var(--panel-radius);
    box-shadow: var(--panel-glass-shadow);
    overflow: hidden;

    /* Top-edge light */
    background-image:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.06) 0%,
            transparent 30%
        );
    background-blend-mode: screen;

    /* Entry animation */
    transform: translateY(24px) scale(0.97);
    transition:
        transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
        opacity   0.3s ease;
}

.nv-panel-overlay.open .nv-panel-glass {
    transform: translateY(0) scale(1);
}


/* ── Panel header ─────────────────────────────────────────────────────── */
.nv-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.nv-panel-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-family: var(--font-body, 'Poppins', sans-serif);
}

.nv-panel-title-area i {
    font-size: 1.1rem;
    color: var(--nv-cyan);
    filter: drop-shadow(0 0 6px var(--nv-cyan-glow));
}

.nv-panel-title-area h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.nv-panel-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.50);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.nv-panel-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}


/* ── Panel body (scrollable) ─────────────────────────────────────────── */
.nv-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px 22px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 240, 255, 0.18) transparent;
}

.nv-panel-body::-webkit-scrollbar {
    width: 5px;
}
.nv-panel-body::-webkit-scrollbar-track {
    background: transparent;
}
.nv-panel-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.12), rgba(0, 240, 255, 0.28));
    border-radius: 100px;
}
.nv-panel-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.3), rgba(0, 240, 255, 0.5));
}


/* ── Nexus placeholder ───────────────────────────────────────────────── */
.nexus-placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.88rem;
    text-align: center;
    padding: 2rem 0;
    font-style: italic;
}

/* ── Nexus loading state ─────────────────────────────────────────────── */
.nexus-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    gap: 1rem;
}

.nexus-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 240, 255, 0.15);
    border-top-color: rgba(0, 240, 255, 0.8);
    border-radius: 50%;
    animation: nexusSpinnerRotate 0.8s linear infinite;
}

@keyframes nexusSpinnerRotate {
    to { transform: rotate(360deg); }
}


/* ── History placeholder & items ─────────────────────────────────────── */
.history-placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.88rem;
    text-align: center;
    padding: 2rem 0;
    font-style: italic;
    list-style: none;
}

/* Style the history list (if rendered by script.js) */
.nv-panel-body #search-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nv-panel-body .search-history-item {
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.80);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.nv-panel-body .search-history-item:hover {
    background: rgba(0, 240, 255, 0.06);
    border-color: rgba(0, 240, 255, 0.18);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   6. INNOVATION NODE CARDS — glass styling inside the nexus panel
   ═══════════════════════════════════════════════════════════════════════════════ */
.nv-panel-body #innovation-nodes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.nv-panel-body .innovation-node {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 14px 16px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.18s ease;
}

.nv-panel-body .innovation-node:hover {
    background: rgba(0, 240, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.15);
    transform: translateY(-1px);
}

/* Routing badge row — shows target app + tool */
.nv-panel-body .nexus-node-routing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.nv-panel-body .nexus-route-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--nv-cyan, #00f0ff);
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 6px;
    padding: 2px 8px;
}

.nv-panel-body .nexus-route-badge i {
    font-size: 0.62rem;
}

.nv-panel-body .nexus-route-tool {
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
}

.nv-panel-body .innovation-node h4 {
    margin: 0 0 6px;
    font-size: 0.92rem;
    color: #ffffff;
    font-weight: 600;
}

.nv-panel-body .innovation-node p {
    margin: 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.5;
}

.nv-panel-body .innovation-node-button {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid rgba(0, 240, 255, 0.20);
    color: var(--nv-cyan);
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.nv-panel-body .innovation-node-button i {
    font-size: 0.7rem;
}

.nv-panel-body .innovation-node-button:hover {
    background: rgba(0, 240, 255, 0.10);
    border-color: rgba(0, 240, 255, 0.35);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   7. MOBILE / RESPONSIVE — activity bar moves to bottom on small screens
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Activity bar → bottom horizontal pill, pinned near screen bottom */
    .nv-activity-bar {
        top: auto;
        bottom: 18px;
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row;
        width: auto;
        padding: 8px 16px;
        gap: 6px;
        animation: abSlideInMobile 0.5s cubic-bezier(0.23, 1, 0.32, 1) both;
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    }

    /* Hide activity bar when a panel/overlay is open */
    .nv-activity-bar.ab-hidden-mobile {
        animation: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateX(-50%) translateY(20px) !important;
    }

    @keyframes abSlideInMobile {
        from { opacity: 0; transform: translateX(-50%) translateY(20px); }
        to   { opacity: 1; transform: translateX(-50%) translateY(0); }
    }

    .nv-ab-separator {
        width: 1px;
        height: 24px;
        background: linear-gradient(180deg, transparent, rgba(255,255,255,0.08), transparent);
        margin: 0 4px;
    }

    .nv-results-shell {
        padding-left: 0;
    }

    /* Tab bar — full width on mobile */
    .nv-tab-bar {
        left: 8px;
        right: 8px;
        top: 8px;
        border-radius: 10px;
    }

    .nv-results-main {
        padding: 1rem 1rem 200px;
    }

    /* Command bar — slightly tighter */
    .nv-command-bar {
        bottom: 16px;
        width: 95%;
        --cmd-radius: 18px;
        --cmd-glass-blur: 36px;
    }

    .nv-command-bar #search-query-results {
        padding: 14px 16px 10px !important;
        font-size: 0.90rem;
    }

    .nv-command-bar .search-bar-toolbar {
        padding: 6px 12px 8px;
    }

    .nv-panel-glass {
        width: 96%;
        max-height: 85vh;
        border-radius: 18px;
    }

    /* Deep research label hidden on tablet */
    .nv-command-bar .deep-research-btn span {
        display: none;
    }
}

/* Extra-small screens */
@media (max-width: 480px) {
    .nv-activity-bar {
        bottom: 14px;
        padding: 6px 12px;
        gap: 4px;
    }

    .nv-ab-btn {
        width: 38px;
        height: 38px;
        font-size: 18px;
        border-radius: 12px;
    }

    .nv-ab-logo {
        width: 22px;
        height: 22px;
    }

    .nv-command-bar {
        bottom: 12px;
        --cmd-radius: 16px;
    }

    .nv-command-bar #search-query-results {
        font-size: 0.87rem;
        padding: 12px 14px 8px !important;
    }

    .nv-command-bar .mic-button-results {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.80rem !important;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   8. HIDE THE OLD SEARCH DRAWER — completely removed from layout
   ═══════════════════════════════════════════════════════════════════════════════ */
.nv-search-drawer {
    display: none !important;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   9. UTILITY / ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════════════════════ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion — respect user preference */
@media (prefers-reduced-motion: reduce) {
    .nv-activity-bar,
    .nv-command-bar,
    .nv-panel-glass,
    .nv-ab-btn,
    .nv-ab-btn.active::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   10. ELECTRON DESKTOP FRAME — adjust for ultra-thin title bar + glass container
   ═══════════════════════════════════════════════════════════════════════════════ */
html.nv-desktop-frame .nv-activity-bar {
    left: 10px;
}

html.nv-desktop-frame .nv-results-shell {
    padding-left: calc(var(--ab-width) + 10px + 10px);
}

html.nv-desktop-frame .nv-command-bar {
    bottom: 12px;
}

html.nv-desktop-frame .nv-panel-overlay {
    border-radius: 14px;
}
