/* Core Variables & Themes */
:root {
    --bg-main: #0b0f19;
    --bg-pane: rgba(17, 24, 39, 0.7);
    --bg-pane-header: rgba(31, 41, 55, 0.4);
    --bg-input: #080c14;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #38bdf8;
    
    /* Brand Colors */
    --primary: #38bdf8; /* Cyan */
    --primary-glow: rgba(56, 189, 248, 0.15);
    --gradient-start: #38bdf8;
    --gradient-end: #818cf8;
    
    /* Text Colors */
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dark: #64748b;
    
    /* Status Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --bg-danger-transparent: rgba(239, 68, 68, 0.1);
    
    /* Interactive states */
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(255, 255, 255, 0.08);
    
    /* Tree syntax colors */
    --syntax-key: #f43f5e;
    --syntax-string: #10b981;
    --syntax-number: #f59e0b;
    --syntax-boolean: #3b82f6;
    --syntax-null: #6b7280;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Abstract Background Glows */
body::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.08) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* Main Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    padding: 1.5rem;
    gap: 1rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-pane);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: blur(12px);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.icon-gradient {
    color: var(--primary);
    width: 1.25rem;
    height: 1.25rem;
}

.logo-text {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.logo-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.gradient-text {
    color: #ffffff;
}

.version-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dark);
    background: var(--bg-active);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Dashboard Pane Layout */
.dashboard {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-grow: 1;
    min-height: 0; /* Important for flex item scroll inheritance */
    position: relative;
}

.pane-editor {
    width: 33.33%; /* Default 1:3 ratio starting point */
    min-width: 250px;
    flex-shrink: 0;
    container-type: inline-size;
}

.pane-viewer {
    flex-grow: 1;
    min-width: 250px;
    container-type: inline-size;
}

/* Grab handle resizer */
.resizer {
    width: 1.25rem; /* Wider touchable area */
    cursor: col-resize;
    align-self: stretch;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    border-radius: 4px;
    flex-shrink: 0;
}

.resizer::after {
    content: '';
    width: 2px;
    height: 24px;
    background: var(--border-color);
    border-radius: 1px;
    transition: background 0.15s ease, height 0.15s ease;
}

.resizer:hover::after,
.resizer.dragging::after {
    background: var(--primary);
    height: 32px;
}

.resizer:hover,
.resizer.dragging {
    background: rgba(56, 189, 248, 0.08);
}

body.light-theme .resizer:hover,
body.light-theme .resizer.dragging {
    background: rgba(2, 132, 199, 0.08);
}

@media (max-width: 900px) {
    .dashboard {
        flex-direction: column;
        gap: 1rem;
    }
    .resizer {
        display: none;
    }
    .pane-editor {
        width: 100% !important;
        height: 40%;
    }
}

.pane {
    background: var(--bg-pane);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--bg-pane-header);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pane-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.pane-title i {
    width: 1.1rem;
    height: 1.1rem;
    color: var(--primary);
}

.pane-title h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn i {
    width: 1rem;
    height: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-main);
    font-weight: 600;
}

.btn-primary:hover {
    background: #5cd0ff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.btn-secondary {
    background: var(--bg-active);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.btn-icon-text:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.btn-icon-text.text-danger:hover {
    color: var(--color-danger);
    background: var(--bg-danger-transparent);
}

.btn-icon-text i {
    width: 0.95rem;
    height: 0.95rem;
}

/* Editor Section */
.editor-container {
    display: flex;
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-input);
}

.line-numbers {
    width: 3rem;
    padding: 1rem 0.5rem;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-dark);
    border-right: 1px solid var(--border-color);
    user-select: none;
    overflow: hidden;
    line-height: 1.5;
}

#json-input {
    flex-grow: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 1rem;
    resize: none;
    width: calc(100% - 3rem);
    height: 100%;
    overflow-y: auto;
    white-space: pre;
}

/* Pane Footer */
.pane-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.25rem;
    background: var(--bg-pane-header);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 0.5rem;
    height: 3.5rem;
    flex-shrink: 0;
    box-sizing: border-box;
}

.stats-info {
    font-family: 'JetBrains Mono', monospace;
}

/* Error Banner */
.error-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-danger);
    background: var(--bg-danger-transparent);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-family: inherit;
    font-weight: 500;
}

.error-banner i {
    width: 0.9rem;
    height: 0.9rem;
}

.error-banner.hidden {
    display: none;
}

/* Query Bar */
.query-section {
    padding: 0.75rem 1.25rem;
    background: rgba(8, 12, 20, 0.5);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.query-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem 0.75rem;
    position: relative;
}

.query-input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.query-prefix {
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    margin-right: 0.5rem;
}

#query-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 0.4rem 0;
}

.btn-clear-query {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 4px;
}

.btn-clear-query:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.btn-clear-query i {
    width: 0.85rem;
    height: 0.85rem;
}

.query-helpers {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.helper-label {
    font-size: 0.75rem;
    color: var(--text-dark);
}

.helper-chip {
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.15s ease;
}

.helper-chip:hover {
    background: var(--bg-active);
    color: var(--primary);
    border-color: rgba(56, 189, 248, 0.4);
}

.query-status-bar {
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
}

/* Tabs & Viewer Options */
.viewer-tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn i {
    width: 0.9rem;
    height: 0.9rem;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--bg-active);
    color: var(--primary);
}

/* Viewer Body */
.viewer-body {
    flex-grow: 1;
    overflow: auto;
    background: var(--bg-input);
    position: relative;
    padding: 1.25rem;
}

.tree-container, .raw-container {
    height: 100%;
}

.raw-container pre {
    height: 100%;
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100%;
    color: var(--text-dark);
    text-align: center;
    gap: 1.5rem;
    padding: 1rem 0;
}

.empty-state-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    margin-bottom: auto;
}

/* If there is info content, align the hero to center relative to container, or pad it */
.empty-state-hero i {
    width: 3rem;
    height: 3rem;
    stroke-width: 1;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.empty-state-hero p {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
}

.empty-state-hero span {
    font-size: 0.8rem;
    max-width: 250px;
}

.empty-state-info {
    width: 100%;
    max-width: 600px;
    margin-top: 1rem;
    margin-bottom: auto;
}

.info-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color) 20%, var(--border-color) 80%, transparent);
    margin-bottom: 1.5rem;
    width: 100%;
}

.info-section {
    text-align: left;
}

.info-section h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-section h3 i {
    width: 1.1rem;
    height: 1.1rem;
    color: var(--primary);
    stroke-width: 2;
}

.faq-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.faq-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(56, 189, 248, 0.2);
}

.faq-item h4 {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.faq-item p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: left;
}

.faq-item code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 0.75rem;
}

/* Interactive Tree Viewer Styles */
.json-tree {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    user-select: text;
}

.json-node {
    margin-left: 1.25rem;
    position: relative;
}

.json-node::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.05);
}

/* Root level shouldn't have line margin or line decorator */
.json-tree > .json-node {
    margin-left: 0;
}
.json-tree > .json-node::before {
    display: none;
}

.json-line {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    position: relative;
}

.json-line:hover {
    background-color: var(--bg-hover);
}

.json-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    margin-left: -1rem;
    margin-right: 0.25rem;
    color: var(--text-dark);
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s ease, color 0.2s ease;
}

.json-toggle:hover {
    color: var(--text-main);
}

.json-toggle.collapsed {
    transform: rotate(-90deg);
}

.json-toggle svg {
    width: 0.8rem;
    height: 0.8rem;
}

.json-key {
    color: var(--syntax-key);
    font-weight: 500;
    margin-right: 0.25rem;
    cursor: pointer;
}

.json-key:hover {
    text-decoration: underline;
}

.json-val {
    word-break: break-all;
}

.json-val.string {
    color: var(--syntax-string);
}

.json-val.number {
    color: var(--syntax-number);
}

.json-val.boolean {
    color: var(--syntax-boolean);
}

.json-val.null {
    color: var(--syntax-null);
}

.json-bracket {
    color: var(--text-muted);
}

.json-collapsed-text {
    font-size: 0.75rem;
    color: var(--text-dark);
    background: var(--bg-active);
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    margin: 0 0.25rem;
    cursor: pointer;
}

.json-node-actions {
    opacity: 0;
    display: inline-flex;
    gap: 0.35rem;
    margin-left: 0.75rem;
    transition: opacity 0.2s ease;
    vertical-align: middle;
}

.json-line:hover .json-node-actions {
    opacity: 1;
}

.node-action-btn {
    background: transparent;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    padding: 0.1rem;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node-action-btn:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

.node-action-btn svg {
    width: 0.75rem;
    height: 0.75rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(17, 24, 39, 0.95);
    color: var(--text-main);
    border: 1px solid var(--border-focus);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px var(--primary-glow);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(8px);
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(1rem);
    pointer-events: none;
}

.toast-icon {
    color: var(--color-success);
    width: 1.1rem;
    height: 1.1rem;
}

/* Styled Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-input);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Table View Mode Styles
   ========================================================================== */
.table-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
}

.visual-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    text-align: left;
}

.visual-table th {
    background: rgba(31, 41, 55, 0.9);
    color: var(--text-main);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background 0.15s ease, color 0.15s ease;
}

.visual-table th:hover {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
}

.visual-table th.sort-asc::after {
    content: " ▴";
    color: var(--primary);
}

.visual-table th.sort-desc::after {
    content: " ▾";
    color: var(--primary);
}

.visual-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.visual-table tr:hover {
    background: var(--bg-hover);
}

/* ==========================================================================
   Chart View Mode Styles
   ========================================================================== */
.chart-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 1rem;
}

.chart-controls {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-pane-header);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
    min-width: 140px;
}

.control-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.select-styled {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    outline: none;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.select-styled:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.select-styled option {
    background: var(--bg-main);
    color: var(--text-main);
}

.canvas-wrapper {
    flex-grow: 1;
    position: relative;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    height: calc(100% - 80px);
}

#chart-canvas {
    max-width: 100%;
    max-height: 100%;
}

/* ==========================================================================
   Query Suggestions Dropdown
   ========================================================================== */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    max-height: 220px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 8px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 189, 248, 0.1);
}

.suggestion-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    transition: all 0.15s ease;
}

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

.suggestion-item.active {
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
    padding-left: 1rem; /* Subtle indent on active */
}

.suggestion-val {
    font-weight: 500;
}

.suggestion-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.suggestion-desc {
    font-size: 0.7rem;
    color: var(--text-dark);
}

.type-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.type-badge.property {
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.type-badge.method {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.type-badge.array {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.type-badge.object {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.2);
}

/* ==========================================================================
   JSON Graph View Mode
   ========================================================================== */
.graph-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #080c14;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.graph-viewport {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    cursor: grab;
    user-select: none;
}

.graph-viewport.panning {
    cursor: grabbing;
}

.graph-canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    display: inline-flex;
    align-items: center;
    padding: 120px 200px 120px 120px;
    min-width: 100%;
    min-height: 100%;
}

.graph-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    transform-origin: 0 0;
}

.graph-curve {
    fill: none;
    stroke: var(--text-dark);
    stroke-width: 1.5px;
    opacity: 0.55;
    transition: stroke 0.2s ease, stroke-width 0.2s ease, opacity 0.2s ease;
}

.graph-curve:hover {
    stroke: var(--primary);
    stroke-width: 2.5px;
    opacity: 0.95;
}

.graph-edge-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 500;
    fill: var(--text-muted);
    text-anchor: middle;
    dominant-baseline: central;
}

.graph-edge-bg {
    fill: #0b0f19;
    stroke: var(--border-color);
    stroke-width: 1px;
    rx: 4px;
}

/* Recursive Graph Alignment Rules */
.graph-tree {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6rem; /* Horizontal spacing between card columns */
    position: relative;
}

.graph-node-container {
    position: relative;
    display: flex;
    align-items: center;
}

.graph-children {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3rem; /* Vertical spacing between sibling cards */
    position: relative;
}

/* Graph Node Card Styling */
.graph-card {
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 230px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    font-size: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.graph-card:hover {
    border-color: var(--border-focus);
    box-shadow: 0 0 15px var(--primary-glow);
}

.graph-card-header {
    background: var(--bg-pane-header);
    padding: 0.45rem 0.75rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.graph-card-header.array-node .graph-card-header-badge {
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.graph-card-header.object-node .graph-card-header-badge {
    color: var(--primary);
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.graph-card-header-title {
    color: var(--text-main);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 150px;
}

.graph-card-header-badge {
    font-size: 0.6rem;
    background: var(--bg-active);
    color: var(--text-muted);
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
}

.graph-card-body {
    padding: 0.5rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
}

.graph-prop-table {
    width: 100%;
    border-collapse: collapse;
}

.graph-prop-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.graph-prop-row:last-child {
    border-bottom: none;
}

.graph-prop-key {
    color: var(--syntax-key);
    font-weight: 500;
    padding-right: 0.5rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100px;
}

.graph-prop-val {
    text-align: right;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100px;
}

.graph-prop-val.string { color: var(--syntax-string); }
.graph-prop-val.number { color: var(--syntax-number); }
.graph-prop-val.boolean { color: var(--syntax-boolean); }
.graph-prop-val.null { color: var(--syntax-null); }

/* Links inside card indicating nested branches */
.graph-link-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.graph-link-row:last-child {
    border-bottom: none;
}

.graph-link-key {
    font-weight: 500;
    color: var(--text-main);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 120px;
}

.graph-link-indicator {
    font-size: 0.55rem;
    background: rgba(56, 189, 248, 0.08);
    color: var(--primary);
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid rgba(56, 189, 248, 0.2);
    white-space: nowrap;
}

/* ==========================================================================
   Graph Node Modal Dialog
   ========================================================================== */
.graph-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    animation: fadeInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.graph-modal-content {
    background: rgba(17, 24, 39, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 480px;
    max-width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 30px rgba(56, 189, 248, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleInModal 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scaleInModal {
    from { transform: scale(0.92); }
    to { transform: scale(1); }
}

.graph-modal-header {
    padding: 0.9rem 1.25rem;
    background: var(--bg-pane-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.btn-close-modal:hover {
    color: var(--color-danger);
    background: var(--bg-danger-transparent);
}

.btn-close-modal svg {
    width: 1.1rem;
    height: 1.1rem;
}

.graph-modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin-top: 0.4rem;
}

.code-block-wrapper {
    position: relative;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    overflow: hidden;
}

.code-block-wrapper pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-main);
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 1.5rem; /* Space for copy button */
}

.btn-copy-code {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    backdrop-filter: blur(4px);
}

.btn-copy-code:hover {
    color: var(--primary);
    border-color: var(--border-focus);
    background: rgba(56, 189, 248, 0.1);
}

.btn-copy-code svg {
    width: 0.85rem;
    height: 0.85rem;
}

/* ==========================================================================
   Light Theme Overrides
   ========================================================================== */
body.light-theme {
    --bg-main: #f8fafc;
    --bg-pane: rgba(255, 255, 255, 0.85);
    --bg-pane-header: #f1f5f9;
    --bg-input: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: #0284c7;
    
    --primary: #0284c7;
    --primary-glow: rgba(2, 132, 199, 0.08);
    --gradient-start: #0284c7;
    --gradient-end: #4f46e5;
    
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dark: #64748b;
    
    --bg-hover: rgba(0, 0, 0, 0.03);
    --bg-active: rgba(0, 0, 0, 0.06);
    
    --syntax-key: #e11d48;
    --syntax-string: #16a34a;
    --syntax-number: #d97706;
    --syntax-boolean: #2563eb;
    --syntax-null: #64748b;
}

body.light-theme::before,
body.light-theme::after {
    background: none;
}

body.light-theme .graph-container {
    background: #f1f5f9;
}

body.light-theme .graph-card {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

body.light-theme .graph-card:hover {
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.15);
}

body.light-theme .graph-edge-bg {
    fill: #ffffff;
}

body.light-theme .graph-edge-label {
    fill: #475569;
}

body.light-theme .graph-curve {
    stroke: #cbd5e1;
}

body.light-theme .graph-modal-content {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 30px rgba(2, 132, 199, 0.05);
}

body.light-theme .btn-copy-code {
    background: rgba(241, 245, 249, 0.9);
}

body.light-theme .query-section {
    background: #f1f5f9;
}

body.light-theme .helper-label {
    color: var(--text-muted);
}

body.light-theme .suggestions-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(2, 132, 199, 0.3);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

body.light-theme .suggestion-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

body.light-theme .toast {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.text-muted {
    color: var(--text-muted) !important;
}

body.light-theme .visual-table th {
    background: #e2e8f0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .visual-table th:hover {
    background: rgba(2, 132, 199, 0.08);
}

body.light-theme .visual-table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

body.light-theme .viewer-tabs {
    background: #e2e8f0;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .tab-btn {
    color: #475569;
}

body.light-theme .tab-btn:hover {
    color: #0f172a;
}

body.light-theme .tab-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Responsive Optimizations */
@media (max-width: 1024px) {
    .header-actions button span {
        display: none;
    }
    .header-actions button {
        padding: 0.5rem;
        min-width: 36px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    .app-header {
        padding: 0.75rem 1rem;
    }
    .pane-header {
        padding: 0.75rem 1rem;
    }
    .pane-footer {
        padding: 0.6rem 1rem;
        height: auto;
    }
}

@media (max-width: 600px) {
    .viewer-tabs {
        width: 100%;
        justify-content: space-between;
    }
    .viewer-tabs .tab-btn {
        flex-grow: 1;
        justify-content: center;
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Viewer Controls Button Sizing & Container Query */
.viewer-controls {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex-grow: 1;
}

.viewer-controls .btn {
    flex: 1 1 110px;
    justify-content: center;
}

@container (max-width: 380px) {
    .viewer-controls .btn span {
        display: none;
    }
    .viewer-controls .btn {
        min-width: 36px;
        flex: 1 1 36px;
        padding: 0.4rem;
    }
    .viewer-controls {
        flex-direction: row !important;
        justify-content: center;
    }
}

@container (max-width: 300px) {
    .editor-actions .btn-icon-text span {
        display: none;
    }
    .editor-actions .btn-icon-text {
        padding: 0.4rem;
        min-width: 32px;
        justify-content: center;
    }
    .editor-actions {
        gap: 0.3rem;
    }
}

@container (max-width: 500px) {
    .tab-btn span {
        display: none;
    }
    .tab-btn {
        padding: 0.35rem 0.5rem;
        justify-content: center;
    }
}

.faq-modal-content {
    width: 600px;
    max-width: 95%;
}

.faq-modal-body {
    max-height: 75vh;
    overflow-y: auto;
    padding: 1.25rem;
}


