﻿/* Priority Ninja Dev LAB - unify the app's accent with the Claude-purple already
   established for the AI-branded elements, so the one thing that makes this tool
   distinctive (the Claude integration) reads as the app's actual identity, not an add-on. */
:root {
    --accent: #7c5cff;
}

* { box-sizing: border-box; }

/* ---------- App shell ---------- */

.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    font-family: system-ui, sans-serif;
    background: var(--bg);
    overflow: hidden;
}

.app-topbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 20px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

/* Small "dev lab" badge - two lines (name + early-access tagline) in a compact bordered pill,
   not a full-size heading, so it reads as a status marker rather than the page's main title. */
.app-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
}

.app-brand-mark {
    font-size: 1.25rem;
    line-height: 1;
}

.app-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.app-brand-name {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text);
}

.app-brand-tagline {
    font-size: 0.68rem;
    color: var(--muted);
}

.app-topbar-connect {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

    .app-topbar-connect input[type="text"] {
        padding: 6px 10px;
        font-size: 0.85rem;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: var(--bg);
        color: var(--text);
        width: 180px;
    }

    .app-topbar-connect .status {
        margin: 0;
        white-space: nowrap;
    }

/* ---------- Login modal ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-dialog {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    padding: 20px 24px;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.3rem;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text);
}

.modal-dialog h2 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.modal-field-row input {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}

.modal-error {
    margin: 0;
    font-size: 0.85rem;
    color: var(--err);
}

.modal-error[hidden] {
    display: none;
}

.app-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* ---------- Sidebar (search + filters + results), resizable ---------- */

.app-sidebar {
    flex-shrink: 0;
    width: var(--sidebar-width, 360px);
    min-width: 240px;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.resize-handle {
    flex-shrink: 0;
    width: 5px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
}

    .resize-handle:hover,
    .resize-handle.active {
        background: var(--accent);
    }

.boss-search {
    flex-shrink: 0;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

    .boss-search input {
        width: 100%;
        padding: 10px 14px;
        font-size: 1rem;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--bg);
        color: var(--text);
        outline: none;
        transition: 0.2s;
    }

        .boss-search input:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.25);
        }

.boss-filters {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
}

/* Lightweight text-link style, not pill buttons - just colored text with an underline on
   hover/active, closer to a plain <a> than a chunky button. */
.filter-chip {
    padding: 0;
    font-size: 0.78rem;
    border: none;
    border-radius: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    transition: 0.15s;
}

    .filter-chip:hover {
        color: var(--text);
        text-decoration: underline;
    }

    .filter-chip.active {
        background: none;
        color: var(--accent);
        font-weight: 600;
        text-decoration: underline;
    }

.boss-results {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
}
    .boss-results .icon {
        margin-right: 6px;
        font-size: 18px;
    }

/* ---------- Main workspace: Preview / Ask Claude tabs ---------- */

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.workspace-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    padding: 8px 20px 0;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.workspace-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: 0.15s;
}

    .workspace-tab:hover {
        color: var(--text);
    }

    .workspace-tab.active {
        color: var(--accent);
        border-bottom-color: var(--accent);
    }

.tab-busy-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: tab-busy-pulse 1.1s ease-in-out infinite;
}

@keyframes tab-busy-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.workspace-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    /* [hidden] and .workspace-panel{display:flex} tie in specificity, and author CSS beats the
       UA stylesheet's [hidden]{display:none} on a tie - without this override both panels stay
       flex-visible and stack on top of each other regardless of which tab is active. */
    .workspace-panel[hidden] {
        display: none;
    }

.boss-preview {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* ---------- Ask Claude tab: chat history + input ---------- */

.chat-toolbar {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border);
}

.chat-new-btn {
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--muted);
    cursor: pointer;
    transition: 0.15s;
}

    .chat-new-btn:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

.chat-history {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-empty {
    margin: auto;
    color: var(--muted);
    font-size: 0.9rem;
}

.chat-turn {
    display: flex;
}

.chat-turn-user {
    justify-content: flex-end;
}

.chat-turn-assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-bubble-user {
    background: var(--accent);
    color: white;
    white-space: pre-wrap;
}

.chat-bubble-assistant {
    background: #f4f1ff;
    border: 1px solid #ded4ff;
    color: #2a2a2a;
}

.chat-bubble-assistant.dir-rtl {
    direction: rtl;
    text-align: right;
}

.chat-bubble-assistant.dir-ltr {
    direction: ltr;
    text-align: left;
}

.chat-bubble-pending {
    color: #666;
    font-style: italic;
}

.chat-progress-line {
    margin-bottom: 4px;
}

.chat-progress-line:last-child {
    margin-bottom: 0;
}

.chat-bubble-error {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fff0f0;
    border: 1px solid #ffd6d6;
    color: #a33;
    font-size: 0.85rem;
}

.chat-text-segment {
    margin: 0 0 6px;
}

    .chat-text-segment:last-child {
        margin-bottom: 0;
    }

    .chat-text-segment h3,
    .chat-text-segment h4 {
        margin: 10px 0 4px;
        font-size: 0.95rem;
    }

.chat-code-wrap {
    margin: 6px 0;
}

.chat-code-block {
    margin: 0;
    padding: 10px 12px;
    background: #1e1e2e;
    color: #e4e0ff;
    border-radius: 8px;
    font-family: Consolas, monospace;
    font-size: 0.82rem;
    white-space: pre-wrap;
    overflow-x: auto;
}

.chat-load-editor-btn {
    margin-top: 6px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: white;
    color: var(--accent);
    cursor: pointer;
    transition: 0.15s;
}

    .chat-load-editor-btn:hover {
        background: var(--accent);
        color: white;
    }

.chat-input-row {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: var(--panel);
    border-top: 1px solid var(--border);
}

    .chat-input-row input {
        flex: 1;
        padding: 10px 14px;
        font-size: 0.95rem;
        border: 1px solid #ded4ff;
        border-radius: 8px;
        outline: none;
        transition: 0.2s;
    }

        .chat-input-row input:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.25);
        }

/* ---------- Code view toolbar: "Ask Claude about this" + Edit toggle ---------- */

.code-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.edit-toggle-btn {
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--muted);
    cursor: pointer;
    transition: 0.15s;
}

    .edit-toggle-btn:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

    .edit-toggle-btn.active {
        background: var(--accent);
        border-color: var(--accent);
        color: white;
    }

.local-draft-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: #a35b00;
    background: #fff4e0;
    border: 1px solid #ffdca0;
    padding: 4px 10px;
    border-radius: 999px;
}
.group-header {
    padding: 8px;
    background: #eee;
    margin-top: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    border-radius: 4px;
}
.group-badge {
    background: #d1d5db;
    color: #111;    
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;    
}

.result-item {
    padding: 5px 6px;
    margin-bottom: 6px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.15s;
}

    .result-item:hover {
        background: #f3f3f3;
    }

.result-type {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
}

.result-name {
    font-size: 0.85em;
    font-weight: bold;
    display: flex;
    justify-content: space-between; /* left + right */
    align-items: center;
}

.table-Rname {
    display: inline-block;
    text-align: right !important;
    color: gray;
    right: 5px;
    font-size: 0.85em;
}
.result-name2 {
    font-size: 1.25em;
    font-weight: bold;
    display: flex;
    justify-content: space-between; /* left + right */
    align-items: center;
}

.table-Rname2 {
    display: inline-block;
    text-align: right !important;
    color: gray;
    right: 5px;
    font-size: 1.25em;
}
/*.pill-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.pill {
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: background 0.15s ease;
}

    .pill:hover {
        background: #f7f7f7;
    }

.pill-title {
    font-weight: 600;
    color: #222;
}

.pill-desc {
    font-size: 0.85em;
    color: #666;*/
}
/*- new pill */
.pill-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.pill {
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.15s ease;
}

    .pill:hover {
        background: #f7f7f7;
    }

.pill-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pill-title {
    font-weight: 600;
    color: #222;
}

.pill-type {
    font-size: 12px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 6px;
}

.pill-sub {
    font-size: 13px;
    color: #555;
}

.pill-index {
    margin-top: 4px;
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: #444;
}

.pill-index-type {
    background: #dff0ff;
    color: #0066aa;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
}

.pill-index-prio,
.pill-index-col {
    background: #eee;
    padding: 2px 6px;
    border-radius: 6px;
}
.pill-icons {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.pill-icon {
    font-size: 16px;
    line-height: 1;
}
/*- end pill*/
/*pre {
    direction: ltr;
    unicode-bidi: plaintext;
}
*/
.code-container {
    /* hosts a CodeMirror 6 read-only editor (real line numbers) instead of a hand-rolled <pre> */
    position: relative;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
}

.code-block {
    counter-reset: line;
    padding: 6px 0 6px 45px;
    margin: 0;
    white-space: pre;
    font-family: Consolas, monospace;
    font-size: 14px;
    line-height: 1.1; /* ⭐ tighter lines */
    direction: ltr;
    unicode-bidi: plaintext;
}

    .code-block code {
        display: block;
    }

        .code-block code span {
            display: flex;
            counter-increment: line;
            padding: 0; /* ⭐ remove extra padding */
            margin: 0; /* ⭐ remove extra margin */
        }

        .code-block code span::before {
                content: counter(line);
                position: absolute;
                left: 10px;
                color: #999;
                text-align: right;
                line-height: 1.1; /* ⭐ match line height */
                width: 30px;
            }
        .bottom-spacer {
            display: block;
            height: 20px; /* ⭐ your +10px fix */
        }
/*- RTL BLOCK */
/* \u202E -*/


.RTLcode-block {
    counter-reset: line;
    padding: 6px 45px 6px 0; /* swapped left/right padding */
    margin: 0;
    white-space: pre;
    font-family: Consolas, monospace;
    font-size: 14px;
    line-height: 1.1;
    direction: rtl; /* RTL direction */
    /*text-align: right !important;*/
    //unicode-bidi: plaintext;
}

    .RTLcode-block code {
        display: block;
        direction: rtl; /* RTL direction */
        /*text-align: right !important;*/
    }

        .RTLcode-block code span {
            display: flex;
            counter-increment: line;
            padding: 0;
            margin: 0;
            position: relative; /* needed for ::before on the right */
           /* text-align: right !important;*/
        }

            /*.RTLcode-block code span::before {
                content: counter(line);
                position: absolute;
                right: 10px;*/ /* moved from left → right */
                /*color: #999;
                text-align: left;*/ /* mirror alignment */
                /*line-height: 1.1;
                width: 30px;
            }*/

.bottom-spacer {
    display: block;
    height: 20px;
}

        /*- end rtl */
.highlight {
    background-color: yellow;
    color: black;
    font-weight: bold;
    padding: 0 2px;
}

/*-----------------------------*/

.analysis-summary {
    margin-top: 12px;
    padding: 10px;
    background: #222;
    color: #eee;
    border-radius: 6px;
    font-size: 14px;
    white-space: pre-wrap;
}

    .analysis-summary.hidden {
        display: none;
    }

/*-----------------------------*/
/* Claude AI ask button (shared by the code-view "Ask Claude about this" button and the chat
   tab's "Ask" button - the result now always renders in the chat history, see .chat-bubble-*
   above under "Ask Claude tab" for that styling). */

.claude-insight-btn {
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #7c5cff;
    border-radius: 999px;
    background: #7c5cff;
    color: white;
    cursor: pointer;
    transition: 0.15s;
}

    .claude-insight-btn:hover:not(:disabled) {
        background: #6a4ce0;
    }

    .claude-insight-btn:disabled {
        opacity: 0.6;
        cursor: default;
    }