/* ============================================================
   JSON Structure Diff Viewer — Styles
   Split-pane code diff aesthetic, dark mode
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500;600&display=swap');

:root {
    --bg: #0D1117;
    --bg-elevated: #161B22;
    --bg-surface: #21262D;
    --bg-hover: #30363D;
    --text-primary: #E6EDF3;
    --text-secondary: #8B949E;
    --text-muted: #484F58;
    --border: #30363D;
    --added: #2EA04377;
    --added-text: #3FB950;
    --deleted: #F8514977;
    --deleted-text: #F85149;
    --changed: #D2992277;
    --changed-text: #D29922;
    --primary: #58A6FF;
    --radius: 8px;
    --shadow: 0 4px 16px rgba(0, 0, 0, .4);
    --font: 'Inter', -apple-system, sans-serif;
    --font-mono: 'Fira Code', 'JetBrains Mono', monospace;
}

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

html,
body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    overflow: hidden;
}

.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    flex-wrap: wrap;
}

.toolbar-title {
    font-weight: 800;
    font-size: .95rem;
    color: var(--primary);
    margin-right: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms;
}

.btn:hover {
    background: var(--bg-hover);
}

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

.btn-sm {
    padding: 4px 10px;
    font-size: .75rem;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .8rem;
    color: var(--text-secondary);
}

.toggle input {
    accent-color: var(--primary);
}

/* --- Split Panes --- */
.split-panes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    overflow: hidden;
}

.pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.pane:last-child {
    border-right: none;
}

.pane-header {
    padding: 6px 12px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    font-size: .8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pane-body {
    flex: 1;
    overflow: hidden;
}

textarea.json-input {
    width: 100%;
    height: 100%;
    resize: none;
    padding: 12px;
    border: none;
    outline: none;
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: .8rem;
    line-height: 1.6;
}

/* --- Diff Results --- */
.diff-output {
    width: 100%;
    overflow: auto;
    height: 100%;
}

.diff-tree {
    padding: 12px;
    font-family: var(--font-mono);
    font-size: .8rem;
    line-height: 1.7;
}

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

.diff-indent {
    display: inline-block;
    width: 20px;
}

.diff-key {
    font-weight: 600;
}

.diff-type {
    color: var(--text-muted);
    font-size: .75rem;
}

.diff-added {
    background: var(--added);
    color: var(--added-text);
    padding: 1px 4px;
    border-radius: 3px;
}

.diff-deleted {
    background: var(--deleted);
    color: var(--deleted-text);
    padding: 1px 4px;
    border-radius: 3px;
}

.diff-changed {
    background: var(--changed);
    color: var(--changed-text);
    padding: 1px 4px;
    border-radius: 3px;
}

.diff-same {
    color: var(--text-secondary);
}

/* --- Stats Bar --- */
.stats-bar {
    display: flex;
    gap: 12px;
    padding: 6px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    font-size: .8rem;
    color: var(--text-secondary);
}

.stat-added {
    color: var(--added-text);
}

.stat-deleted {
    color: var(--deleted-text);
}

.stat-changed {
    color: var(--changed-text);
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: .85rem;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: all 200ms;
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
    .split-panes {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .pane {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}