/* ── Fs8PromptEditor — Obsidian-style inline Markdown editor ── */

.fs8-prompt-editor {
    position: relative;
    min-height: 2.5em;
    max-height: 40vh;
    overflow-y: auto;
    cursor: text;
    font-size: inherit;
    line-height: 1.6;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.fs8-prompt-editor::-webkit-scrollbar {
    width: 6px;
}

.fs8-prompt-editor::-webkit-scrollbar-track {
    background: transparent;
}

.fs8-prompt-editor::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.fs8-prompt-editor::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}

.fs8-prompt-copy-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    font-size: 0.8rem;
}

.fs8-prompt-editor:hover .fs8-prompt-copy-btn {
    opacity: 1;
}

.fs8-prompt-copy-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    color: rgba(0, 0, 0, 0.6);
}

.fs8-prompt-editor[data-empty="true"]::before {
    content: attr(data-placeholder);
    position: absolute;
    top: 0;
    left: 0;
    color: rgba(0, 0, 0, 0.35);
    pointer-events: none;
    padding: 1px 4px;
}

.fs8-prompt-blocks {
    min-height: inherit;
    user-select: text;
    -webkit-user-select: text;
}

.fs8-prompt-block {
    padding: 1px 4px;
    border-radius: 3px;
    cursor: text;
    min-height: 1.4em;
    transition: background 0.1s ease;
    word-break: break-word;
}

.fs8-prompt-block:hover:not(.editing) {
    background: rgba(0, 0, 0, 0.018);
}

.fs8-prompt-block.editing {
    background: rgba(0, 0, 0, 0.012);
}

.fs8-prompt-block .fs8-prompt-edit-textarea {
    display: block;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    padding: 0;
    margin: 0;
    overflow: hidden;
    color: inherit;
}

/* ── Rendered block markdown typography ── */

.fs8-prompt-block p,
.fs8-prompt-block ul,
.fs8-prompt-block ol {
    margin: 0;
    padding: 0;
    font-size: inherit;
    line-height: inherit;
}

.fs8-prompt-block h1,
.fs8-prompt-block h2,
.fs8-prompt-block h3,
.fs8-prompt-block h4,
.fs8-prompt-block h5,
.fs8-prompt-block h6 {
    margin: 0;
    padding: 0;
    font-weight: 600;
    line-height: 1.3;
}

.fs8-prompt-block h1 { font-size: 1.5em; }
.fs8-prompt-block h2 { font-size: 1.3em; }
.fs8-prompt-block h3 { font-size: 1.15em; }

.fs8-prompt-block code {
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.06);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.fs8-prompt-block pre {
    margin: 0.25em 0;
    padding: 0.5em;
    font-size: 0.82em;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
    overflow-x: auto;
}

.fs8-prompt-block pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.fs8-prompt-block blockquote {
    margin: 0.25em 0;
    padding: 0.1em 0.75em;
    border-left: 3px solid rgba(0, 0, 0, 0.15);
    color: rgba(0, 0, 0, 0.6);
}

.fs8-prompt-block ul,
.fs8-prompt-block ol {
    padding-left: 1.5em;
}

.fs8-prompt-block a {
    color: var(--bs-primary, #0d6efd);
    text-decoration: underline;
}

.fs8-prompt-block hr {
    margin: 0.5em 0;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.fs8-prompt-block strong { font-weight: 600; }
.fs8-prompt-block img    { max-width: 100%; }

.fs8-prompt-block:not(.editing) button,
.fs8-prompt-block:not(.editing) input,
.fs8-prompt-block:not(.editing) select,
.fs8-prompt-block:not(.editing) textarea.custom-textarea {
    pointer-events: none;
    opacity: 0.7;
}

/* ── Reference token badges ── */

.fs8-ref-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.05em 0.55em;
    font-size: 0.82em;
    line-height: 1.5;
    border-radius: 0.75em;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: baseline;
}

.fs8-ref-badge i { font-size: 0.85em; }

.fs8-ref-badge-data {
    background: #d7ffa9;
    color: #2d6a1e;
}

.fs8-ref-badge-definitions {
    background: #ffe0b2;
    color: #7a4a0a;
}

.fs8-ref-badge-state {
    background: #e0e0ff;
    color: #3a3a8a;
}

.fs8-ref-badge-wikilink {
    background: rgba(139, 92, 246, 0.15);
    color: rgb(109, 62, 216);
}

.fs8-ref-open {
    color: inherit;
    opacity: 0.55;
    text-decoration: none;
    cursor: pointer;
    margin-left: 0.1em;
}

.fs8-ref-open:hover {
    opacity: 1;
}

/* ── Wiki-link [[ autocomplete dropdown ── */

.fs8-ac-dropdown {
    position: absolute;
    z-index: 20;
    display: none;
    min-width: 160px;
    max-height: 180px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 0.85em;
    scrollbar-width: thin;
}

.fs8-ac-item {
    padding: 0.35em 0.7em;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fs8-ac-item:hover,
.fs8-ac-item.active {
    background: rgba(139, 92, 246, 0.12);
    color: rgb(109, 62, 216);
}

/* ── Flowchart prompt preview (read-only, scaled down) ── */

.flochart-prompt-preview {
    max-height: 12em;
    overflow-y: auto;
    line-height: 1.35;
    font-size: 0.8rem;
    opacity: 0.75;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.flochart-prompt-preview::-webkit-scrollbar { width: 4px; }
.flochart-prompt-preview::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 2px; }

.flochart-prompt-preview .fs8-prompt-block { padding: 0 2px; min-height: unset; }
.flochart-prompt-preview .fs8-prompt-block p { margin: 0; }
.flochart-prompt-preview .fs8-prompt-block h1 { font-size: 1.15em; }
.flochart-prompt-preview .fs8-prompt-block h2 { font-size: 1.05em; }
.flochart-prompt-preview .fs8-prompt-block h3 { font-size: 1em; }
.flochart-prompt-preview .fs8-prompt-block pre { font-size: 0.78em; padding: 0.3em; }
.flochart-prompt-preview .fs8-prompt-block code { font-size: 0.82em; padding: 0.05em 0.2em; }
.flochart-prompt-preview .fs8-ref-badge { font-size: 0.78em; padding: 0.02em 0.4em; }

/* ── Tree-panel prompt preview: cap width so it doesn't push siblings ── */
.tree-prompt-preview {
    max-width: 22rem;
    overflow-x: hidden;
}
