/* ========================================
   API Response Diff — Styles
   Indigo Dark Theme
   ======================================== */
:root {
    --primary: #6366F1;
    --primary-dim: rgba(99, 102, 241, 0.2);
    --accent: #22D3EE;
    --accent-dim: rgba(34, 211, 238, 0.15);
    --bg: #0F172A;
    --bg-panel: rgba(15, 23, 42, 0.8);
    --bg-card: rgba(99, 102, 241, 0.06);
    --border: rgba(99, 102, 241, 0.15);
    --text: #E2E8F0;
    --text-muted: rgba(226, 232, 240, 0.5);
    --added: #22C55E;
    --removed: #EF4444;
    --changed: #F59E0B;
    --radius: 12px;
    --transition: 250ms ease;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html {
    font-size: 14px
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    background-image: radial-gradient(ellipse at 15% 0%, rgba(99, 102, 241, .07) 0%, transparent 60%),
        radial-gradient(ellipse at 85% 100%, rgba(34, 211, 238, .05) 0%, transparent 50%)
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, .88)
}

.header-left {
    display: flex;
    align-items: center;
    gap: .6rem
}

.logo {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 6px var(--primary-dim))
}

.app-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

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

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text);
    transition: all var(--transition)
}

.btn-icon:hover {
    border-color: var(--primary);
    background: var(--primary-dim)
}

/* Layout */
.app-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem
}

.glass {
    background: var(--bg-panel);
    backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem
}

/* Input Panels */
.input-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .6rem
}

.panel-head h2 {
    font-size: .82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent)
}

.btn-small {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 12px;
    color: var(--primary);
    cursor: pointer;
    font-family: var(--font);
    font-size: .75rem;
    font-weight: 600;
    transition: all var(--transition)
}

.btn-small:hover {
    background: var(--primary-dim);
    border-color: var(--primary)
}

.input-panel textarea {
    width: 100%;
    background: rgba(15, 23, 42, .5);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    color: var(--text);
    font-family: 'Courier New', monospace;
    font-size: .8rem;
    resize: vertical;
    transition: border-color var(--transition)
}

.input-panel textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-dim)
}

/* Controls Row */
.controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap
}

.filter-group {
    display: flex;
    gap: 8px;
    flex: 1
}

.filter-group input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text);
    font-family: var(--font);
    font-size: .82rem;
    transition: border-color var(--transition)
}

.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-dim)
}

.filter-group input::placeholder {
    color: var(--text-muted)
}

.btn-compare {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: linear-gradient(135deg, var(--primary), #4338CA);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(99, 102, 241, .25)
}

.btn-compare:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, .35)
}

.btn-compare:active {
    transform: translateY(0)
}

/* Results */
.results-section {
    min-height: 200px
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted)
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: .75rem
}

.hidden {
    display: none
}

/* Diff Stats */
.diff-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 1rem
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: .8rem;
    font-weight: 600
}

.stat-chip.s-added {
    color: var(--added);
    border-color: rgba(34, 197, 94, .25)
}

.stat-chip.s-removed {
    color: var(--removed);
    border-color: rgba(239, 68, 68, .25)
}

.stat-chip.s-changed {
    color: var(--changed);
    border-color: rgba(245, 158, 11, .25)
}

.stat-chip.s-equal {
    color: var(--text-muted)
}

/* Diff Output */
.diff-output {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-family: 'Courier New', monospace;
    font-size: .8rem
}

.diff-row {
    display: flex;
    padding: 4px 14px;
    border-bottom: 1px solid rgba(99, 102, 241, .06);
    transition: background var(--transition);
    cursor: pointer
}

.diff-row:hover {
    background: rgba(99, 102, 241, .06)
}

.diff-row.added {
    background: rgba(34, 197, 94, .06);
    border-left: 3px solid var(--added)
}

.diff-row.removed {
    background: rgba(239, 68, 68, .06);
    border-left: 3px solid var(--removed)
}

.diff-row.changed {
    background: rgba(245, 158, 11, .06);
    border-left: 3px solid var(--changed)
}

.diff-row.equal {
    color: var(--text-muted)
}

.diff-key {
    color: var(--accent);
    margin-right: 8px;
    user-select: none;
    min-width: 0;
    word-break: break-word
}

.diff-val {
    color: var(--text);
    word-break: break-word
}

.diff-val.str {
    color: #A78BFA
}

.diff-val.num {
    color: #22D3EE
}

.diff-val.bool {
    color: #F59E0B
}

.diff-val.null {
    color: var(--text-muted);
    font-style: italic
}

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

.collapse-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: .75rem;
    margin-right: 4px;
    padding: 0 2px;
    transition: transform var(--transition)
}

.collapse-btn.collapsed {
    transform: rotate(-90deg)
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: .85rem;
    box-shadow: 0 8px 32px rgba(99, 102, 241, .3);
    transition: transform 300ms cubic-bezier(.34, 1.56, .64, 1);
    z-index: 1000;
    pointer-events: none
}

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

::-webkit-scrollbar {
    width: 6px
}

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

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, .15);
    border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, .3)
}

@media(max-width:768px) {
    .input-panels {
        grid-template-columns: 1fr
    }

    .controls-row {
        flex-direction: column
    }

    .filter-group {
        flex-direction: column
    }
}