﻿/* ============================================================
   json-editor.directive.css
   Estilos para la directiva <json-editor>
   ============================================================ */

/* ── Tokens de color ─────────────────────────────────────────────────────── */
.je-theme-dark {
    --je-bg: #1a1b26;
    --je-bg2: #16161e;
    --je-bg3: #24253a;
    --je-border: #2e3050;
    --je-text: #c0caf5;
    --je-text2: #6272a4;
    --je-text3: #414868;
    --je-accent: #7aa2f7;
    --je-col-key: #e0af68;
    --je-col-str: #9ece6a;
    --je-col-num: #7dcfff;
    --je-col-kw: #bb9af7;
    --je-col-brace: #ff9e64;
    --je-col-bracket: #7aa2f7;
    --je-col-punct: #6272a4;
    --je-col-err: #f7768e;
    --je-mark: rgba(224,175,104,0.25);
    --je-mark-cur: rgba(255,158,100,0.45);
    --je-ok: #9ece6a;
    --je-err: #f7768e;
}

.je-theme-light {
    --je-bg: #f8f8f2;
    --je-bg2: #f0f0e8;
    --je-bg3: #e4e4dc;
    --je-border: #d0d0c0;
    --je-text: #282a36;
    --je-text2: #6272a4;
    --je-text3: #aaa;
    --je-accent: #5c6bc0;
    --je-col-key: #c18401;
    --je-col-str: #50a14f;
    --je-col-num: #0184bc;
    --je-col-kw: #a626a4;
    --je-col-brace: #d75f00;
    --je-col-bracket: #5c6bc0;
    --je-col-punct: #999;
    --je-col-err: #e45649;
    --je-mark: rgba(193,132,1,0.18);
    --je-mark-cur: rgba(215,95,0,0.32);
    --je-ok: #50a14f;
    --je-err: #e45649;
}

/* ── Host ────────────────────────────────────────────────────────────────── */
.je-host {
    display: flex;
    flex-direction: column;
    background: var(--je-bg);
    border: 1px solid var(--je-border);
    border-radius: 8px;
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    position: relative;
    --je-gutter-w: 58px;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.je-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    background: var(--je-bg2);
    border-bottom: 1px solid var(--je-border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.je-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--je-accent);
    letter-spacing: -0.5px;
    margin-right: 4px;
}

.je-sep {
    width: 1px;
    height: 18px;
    background: var(--je-border);
    margin: 0 2px;
    flex-shrink: 0;
}

.je-spacer {
    flex: 1;
}

.je-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    font-size: 12px;
    font-family: system-ui, sans-serif;
    font-weight: 500;
    color: var(--je-text2);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    transition: color .12s, background .12s, border-color .12s;
    white-space: nowrap;
    line-height: 1;
}

    .je-btn:hover:not(:disabled) {
        color: var(--je-text);
        background: var(--je-bg3);
        border-color: var(--je-border);
    }

    .je-btn:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

.je-btn-active {
    color: var(--je-accent) !important;
    background: rgba(122,162,247,.1) !important;
    border-color: rgba(122,162,247,.3) !important;
}

.je-btn-danger:hover:not(:disabled) {
    color: var(--je-err);
}

.je-btn svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Search bar ──────────────────────────────────────────────────────────── */
.je-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: var(--je-bg2);
    border-bottom: 1px solid var(--je-border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.je-sinput {
    font-family: inherit;
    font-size: 12px;
    padding: 4px 8px;
    background: var(--je-bg);
    border: 1px solid var(--je-border);
    border-radius: 5px;
    color: var(--je-text);
    outline: none;
    width: 160px;
    transition: border-color .15s;
}

    .je-sinput:focus {
        border-color: var(--je-accent);
    }

.je-sinput-nomatch {
    border-color: var(--je-err) !important;
}

.je-slabel {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--je-text2);
    cursor: pointer;
    user-select: none;
    font-family: system-ui, sans-serif;
}

    .je-slabel input {
        accent-color: var(--je-accent);
        cursor: pointer;
    }

.je-matchinfo {
    font-size: 11px;
    color: var(--je-text2);
    min-width: 70px;
}

/* ── Editor area ─────────────────────────────────────────────────────────── */
json-editor {
    display: block;
}

.je-editor-wrap {
    display: flex;
    flex: none;
    position: relative;
    overflow: hidden;
    min-height: 200px;
}

.je-editor-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: var(--je-gutter-w);
    right: 0;
    height: 48px;
    background: linear-gradient(to bottom, transparent 0%, var(--je-bg) 85%);
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
    z-index: 2;
}

.je-editor-wrap.je-scroll-fade-bottom::after {
    opacity: 1;
}

/* ── Custom floating scrollbar ──────────────────────────────────────────── */
.je-scrollbar {
    position: absolute;
    top: 4px;
    right: 4px;
    bottom: 4px;
    width: 6px;
    border-radius: 3px;
    z-index: 5;
    opacity: 0;
    transition: opacity .3s, width .15s;
    pointer-events: none;
}

.je-scrollbar:hover {
    width: 10px;
    border-radius: 5px;
}

.je-scrollbar:hover .je-scrollbar-thumb {
    opacity: .55;
}

.je-editor-wrap:hover .je-scrollbar,
.je-scrollbar.je-scrollbar-visible {
    opacity: 1;
    pointer-events: auto;
}

.je-scrollbar-thumb {
    position: absolute;
    width: 100%;
    min-height: 24px;
    background: var(--je-text3);
    border-radius: inherit;
    opacity: .4;
    cursor: pointer;
    transition: opacity .15s;
}

.je-linenums {
    padding: 14px 10px 14px 12px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--je-text3);
    text-align: right;
    user-select: none;
    background: var(--je-bg2);
    border-right: 1px solid var(--je-border);
    min-width: var(--je-gutter-w);
    overflow: hidden;
    white-space: pre;
    flex-shrink: 0;
}

.je-highlight {
    position: absolute;
    top: 0;
    left: var(--je-gutter-w);
    right: 0;
    bottom: 0;
    padding: 14px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.65;
    pointer-events: none;
    overflow: scroll;
    scrollbar-width: none;
    -ms-overflow-style: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    color: var(--je-text);
}

.je-highlight::-webkit-scrollbar {
    display: none;
}

    .je-highlight .je-mark {
        background: var(--je-mark);
        border-radius: 2px;
    }

    .je-highlight .je-mark-cur {
        background: var(--je-mark-cur);
        border-radius: 2px;
        outline: 1px solid var(--je-col-brace);
    }

.je-textarea {
    position: absolute;
    top: 0;
    left: var(--je-gutter-w);
    right: 0;
    bottom: 0;
    padding: 14px;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.65;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    color: transparent;
    caret-color: var(--je-text);
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    tab-size: 2;
}

    .je-textarea::-webkit-scrollbar {
        display: none;
    }

    .je-textarea::selection {
        background: rgba(122,162,247,.2);
    }

    .je-textarea::placeholder {
        color: var(--je-text3);
    }

/* ── Status bar ──────────────────────────────────────────────────────────── */
.je-status {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 5px 12px;
    background: var(--je-bg2);
    border-top: 1px solid var(--je-border);
    font-family: inherit;
    font-size: 11px;
    flex-shrink: 0;
    overflow: hidden;
}

.je-smuted {
    color: var(--je-text2);
}

.je-sok {
    color: var(--je-ok);
}

.je-serr {
    color: var(--je-err);
}

.je-path {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.je-toast {
    position: absolute;
    bottom: 40px;
    right: 14px;
    padding: 7px 14px;
    background: var(--je-bg3);
    border: 1px solid var(--je-border);
    border-radius: 6px;
    font-size: 12px;
    font-family: system-ui, sans-serif;
    color: var(--je-text);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 10;
    white-space: nowrap;
}

.je-toast-show {
    opacity: 1;
}

.je-toast-err {
    color: var(--je-err);
    border-color: var(--je-err);
}

/* ── Layout (ffoCfgEdit page) ────────────────────────────────────────────── */
.ffo-json-editor-wrap {
    margin-bottom: 0;
}
