/* JSON Path Query Tool — style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #0a0e1a;
    --bg2: #111827;
    --bg3: #1f2937;
    --border: #1f2937;
    --text: #f0f0f8;
    --text2: #94a3b8;
    --text3: #4b5563;
    --primary: #f59e0b;
    --primary2: #fbbf24;
    --green: #34d399;
    --red: #f87171;
    --blue: #60a5fa;
    --radius: 12px;
    --t: all 0.18s ease;
}

@media(prefers-color-scheme:light) {
    :root {
        --bg: #f8fafc;
        --bg2: #fff;
        --bg3: #f1f5f9;
        --border: #e2e8f0;
        --text: #111827;
        --text2: #4b5563;
        --text3: #9ca3af;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 50% 30% at 10% 5%, rgba(245, 158, 11, 0.07), transparent), radial-gradient(ellipse 40% 20% at 90% 90%, rgba(96, 165, 250, 0.05), transparent);
    z-index: 0;
}

/* Header */
header {
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 50;
}

.header-inner {
    max-width: 100%;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.3);
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
}

.brand-sub {
    font-size: 10px;
    color: var(--text3);
}

h1.brand-title {
    display: inline;
}

.header-actions {
    display: flex;
    gap: 6px;
}

/* Layout */
.app-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.left-col,
.right-col {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.right-col {
    border-right: none;
}

/* Cards */
.card {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.card-header {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text2);
}

.card-body {
    padding: 12px 14px;
}

/* Code area */
.code-area {
    flex: 1;
    position: relative;
    min-height: 200px;
}

.code-editor {
    width: 100%;
    height: 100%;
    min-height: 200px;
    background: #07080f;
    color: #e2e8f0;
    border: none;
    resize: none;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.7;
    outline: none;
    tab-size: 2;
}

.code-editor::placeholder {
    color: #374151;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--primary);
    color: var(--primary2);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #000;
    font-weight: 700;
}

.btn-primary:hover {
    background: #d97706;
    border-color: #d97706;
}

.btn-sm {
    padding: 4px 9px;
    font-size: 11px;
    border-radius: 6px;
}

/* Input */
.inp {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    transition: var(--t);
    outline: none;
}

.inp.mono {
    font-family: 'JetBrains Mono', monospace;
}

.inp:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.inp::placeholder {
    color: var(--text3);
}

/* Query row */
.query-row {
    display: flex;
    gap: 6px;
}

.query-row .inp {
    flex: 1;
}

/* JSON Status */
.json-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 8px;
}

.json-status.ok {
    background: rgba(52, 211, 153, 0.12);
    color: var(--green);
}

.json-status.error {
    background: rgba(248, 113, 113, 0.12);
    color: var(--red);
}

/* Query Error */
.query-error {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: var(--red);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

/* Examples */
.examples-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.example-chip {
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text2);
    cursor: pointer;
    transition: var(--t);
    background: var(--bg3);
}

.example-chip:hover {
    border-color: var(--primary);
    color: var(--primary2);
    background: rgba(245, 158, 11, 0.08);
}

/* Results */
.result-count {
    color: var(--text3);
    font-size: 10px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.results-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    background: #07080f;
    min-height: 150px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 120px;
    color: var(--text3);
    font-size: 12px;
    font-family: 'Inter', sans-serif;
}

.empty-icon {
    font-size: 24px;
}

/* Result views */
.flat-item {
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

.flat-item:last-child {
    border-bottom: none;
}

.flat-index {
    color: var(--text3);
    margin-right: 10px;
}

.json-str {
    color: #86efac;
}

.json-num {
    color: #93c5fd;
}

.json-bool {
    color: #f9a8d4;
}

.json-null {
    color: #94a3b8;
}

.json-key {
    color: #fde68a;
}

.tree-node {
    padding: 1px 0;
}

.tree-indent {
    display: inline-block;
    width: 18px;
}

.table-result {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.table-result th {
    background: var(--bg3);
    padding: 6px 10px;
    text-align: left;
    color: var(--primary2);
    border-bottom: 1px solid var(--border);
}

.table-result td {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

/* View toggle */
.view-toggle {
    display: flex;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
}

.view-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    transition: var(--t);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.view-btn.active {
    background: var(--primary);
    color: #000;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: var(--bg3);
    border: 1px solid var(--border);
    transition: var(--t);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text3);
    transition: var(--t);
}

.toggle-switch input:checked~.toggle-track {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--primary);
}

.toggle-switch input:checked~.toggle-thumb {
    background: var(--primary);
    left: 19px;
}

/* Ref table */
.ref-table-wrap {
    overflow-x: auto;
    max-height: 240px;
    overflow-y: auto;
}

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.ref-table th {
    background: var(--bg3);
    padding: 7px 12px;
    text-align: left;
    color: var(--text2);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

.ref-table td {
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: top;
}

.ref-table td:first-child {
    color: var(--text2);
}

.ref-table td:not(:first-child) {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.ref-table .jp {
    color: var(--primary2);
}

.ref-table .jq {
    color: #93c5fd;
}

/* Toast */
.toast-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.toast {
    background: var(--bg2);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text);
    transform: translateX(20px);
    opacity: 0;
    transition: all 0.22s ease;
    pointer-events: all;
}

.toast.show {
    transform: none;
    opacity: 1;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px
}

@media(max-width:760px) {
    .app-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    body {
        height: auto;
        overflow: auto;
    }

    .left-col,
    .right-col {
        border-right: none;
    }
}