/**
 * JSON Formatter.
 */

.em-json__bar {
    display: flex;
    flex-wrap: wrap;
    gap: .8em 1.4em;
    align-items: center;
    padding: .8em 1em;
    border: 1px solid var(--em-line, #e5e7eb);
    border-radius: 10px;
    background: var(--em-surface, #fff);
}

.em-json__group,
.em-json__check {
    display: flex;
    align-items: center;
    gap: .5em;
    color: var(--em-ink, inherit);
}

.em-json__check input { accent-color: var(--em-brand, #2563eb); }

.em-json__label { font-weight: 600; }

.em-json__select {
    padding: .45em .65em;
    border: 1px solid var(--em-line, #e5e7eb);
    border-radius: 8px;
    background: var(--em-surface, #fff);
    color: var(--em-ink, inherit);
    font: inherit;
}

.em-json__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5em;
    margin-left: auto;
}

.em-json__go,
.em-json__copy,
.em-json__sample,
.em-json__clear {
    padding: .5em 1em;
    border: 1px solid var(--em-brand, #2563eb);
    border-radius: 8px;
    background: var(--em-brand, #2563eb);
    color: var(--em-on-brand, #fff);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.em-json__copy,
.em-json__sample { background: transparent; color: var(--em-brand, #2563eb); }

.em-json__clear {
    border-color: var(--em-line, #e5e7eb);
    background: transparent;
    color: var(--em-soft, #6b7280);
    font-weight: 400;
}

/* ── What it says about the JSON ───────────────────────────────────────── */

.em-json__status {
    margin: .9em 0 0;
    padding: .7em .9em;
    border-left: 3px solid var(--em-line, #e5e7eb);
    border-radius: 0 8px 8px 0;
    font-size: .92rem;
    line-height: 1.55;
    color: var(--em-ink, inherit);
}

.em-json__status.is-good {
    border-left-color: #16a34a;
    background: rgba(22, 163, 74, .10);
}

/* The failure is the message people came for, so it carries the weight. */
.em-json__status.is-bad {
    border-left-color: #dc2626;
    background: rgba(220, 38, 38, .10);
    font-weight: 600;
}

/* ── The two boxes ─────────────────────────────────────────────────────── */

.em-json__panes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1em;
    margin-top: 1em;
}

.em-json__pane-label {
    display: block;
    margin-bottom: .4em;
    font-weight: 600;
    color: var(--em-ink, inherit);
}

.em-json__area {
    display: block;
    width: 100%;
    padding: .8em;
    border: 1px solid var(--em-line, #e5e7eb);
    border-radius: 10px;
    background: var(--em-surface, #fff);
    color: var(--em-ink, inherit);
    /* Monospace here, unlike the OCR tool: JSON is code, and alignment is
       what makes the nesting readable. */
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .88rem;
    line-height: 1.6;
    tab-size: 2;
    resize: vertical;
    /* Long URLs inside strings must not force the whole box sideways. */
    white-space: pre;
    overflow: auto;
}

.em-json__area:focus-visible {
    outline: 2px solid var(--em-brand, #2563eb);
    outline-offset: 1px;
}

@media (max-width: 560px) {
    .em-json__actions { margin-left: 0; width: 100%; }
}
