/* DevFix — JSONPath / jq Live Tester */

.jsonq-shell {
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.jsonq-head,
.jsonq-panel-head,
.jsonq-result-head,
.jsonq-history-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.jsonq-head {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.jsonq-head h2 {
    margin: 0 0 8px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.jsonq-head p,
.jsonq-panel-head span,
.jsonq-result-head span {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.jsonq-examples,
.jsonq-mode-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.jsonq-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    row-gap: 12px;
    column-gap: 16px;
    padding: 14px 16px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-sizing: border-box;
}

.jsonq-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.jsonq-toolbar-group--tail {
    margin-left: auto;
    justify-content: flex-end;
}

.jsonq-shell .jsonq-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--r-md);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), color 0.18s var(--ease);
    white-space: normal;
    text-align: center;
    word-break: break-word;
    box-sizing: border-box;
    max-width: 100%;
}

.jsonq-shell .jsonq-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
    border-color: var(--accent);
}

.jsonq-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-sm);
}

.jsonq-btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.jsonq-btn-secondary {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.jsonq-btn-secondary:hover {
    background: var(--bg-surface);
    transform: translateY(-1px);
}

.jsonq-btn-ghost {
    background: var(--bg-surface);
    border-color: var(--border);
    color: var(--text-secondary);
}

.jsonq-btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--bg-raised);
}

.jsonq-btn-sm {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 600;
}

.jsonq-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
    gap: 16px;
    align-items: start;
}

.jsonq-panel {
    min-width: 0;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 18px;
}

.jsonq-panel h3,
.jsonq-history-head h3 {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 1rem;
}

.jsonq-json-input,
.jsonq-expression,
.jsonq-result,
.jsonq-highlight {
    width: 100%;
    box-sizing: border-box;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    outline: none;
    font-family: var(--font-mono);
}

.jsonq-json-input {
    min-height: 520px;
    padding: 14px;
    resize: vertical;
    font-size: 0.82rem;
    line-height: 1.5;
}

.jsonq-expression {
    margin: 12px 0;
    padding: 12px;
    font-size: 0.88rem;
}

.jsonq-mode,
.jsonq-examples button {
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    color: var(--text-secondary);
    padding: 8px 11px;
    cursor: pointer;
    font-weight: 800;
}

.jsonq-mode.active,
.jsonq-examples button:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.jsonq-result-head {
    margin-top: 16px;
}

.jsonq-result,
.jsonq-highlight {
    min-height: 260px;
    max-height: 520px;
    overflow: auto;
    padding: 14px;
    white-space: pre-wrap;
    font-size: 0.82rem;
    line-height: 1.5;
}

.jsonq-highlight-wrap {
    margin-top: 14px;
}

.jsonq-highlight-head {
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.jsonq-key {
    color: var(--accent);
}

.jsonq-hit {
    display: inline;
    background: rgba(251, 191, 36, 0.18);
    outline: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 3px;
}

.jsonq-history {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.jsonq-history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.jsonq-history-list button {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-surface);
    color: var(--text-secondary);
    padding: 8px 10px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.jsonq-empty {
    color: var(--text-muted);
    font-size: 0.84rem;
}

@media (max-width: 900px) {
    .jsonq-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .jsonq-toolbar-group--tail {
        margin-left: 0;
        justify-content: flex-start;
    }

    .jsonq-toolbar-group .jsonq-btn {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
    }
}

@media (max-width: 1050px) {
    .jsonq-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .jsonq-shell {
        padding: 18px;
    }

    .jsonq-head,
    .jsonq-panel-head,
    .jsonq-result-head,
    .jsonq-history-head {
        flex-direction: column;
    }
}
