:root {
    /* MD3 Color Tokens - Dark Theme (Default) */
    --md-sys-color-primary: #D0BCFF;
    --md-sys-color-on-primary: #381E72;
    --md-sys-color-primary-container: #4F378B;
    --md-sys-color-on-primary-container: #EADDFF;
    --md-sys-color-secondary: #CCC2DC;
    --md-sys-color-on-secondary: #332D41;
    --md-sys-color-secondary-container: #4A4458;
    --md-sys-color-on-secondary-container: #E8DEF8;
    --md-sys-color-tertiary: #EFB8C8;
    --md-sys-color-on-tertiary: #492532;
    --md-sys-color-tertiary-container: #633B48;
    --md-sys-color-on-tertiary-container: #FFD8E4;
    --md-sys-color-error: #F2B8B5;
    --md-sys-color-on-error: #601410;
    --md-sys-color-error-container: #8C1D18;
    --md-sys-color-on-error-container: #F9DEDC;
    --md-sys-color-background: #1C1B1F;
    --md-sys-color-on-background: #E6E1E5;
    --md-sys-color-surface: #1C1B1F;
    --md-sys-color-on-surface: #E6E1E5;
    --md-sys-color-surface-variant: #49454F;
    --md-sys-color-on-surface-variant: #CAC4D0;
    --md-sys-color-outline: #938F99;
    --md-sys-color-outline-variant: #49454F;

    /* VS Code color palette for nesting (dark theme) - 7 unique bright colors */
    --nest-color-0: #FFD700;
    /* Gold */
    --nest-color-1: #DA70D6;
    /* Orchid/Purple */
    --nest-color-2: #179FFF;
    /* Sky Blue */
    --nest-color-3: #FF6B6B;
    /* Coral Red */
    --nest-color-4: #4ECDC4;
    /* Turquoise */
    --nest-color-5: #FFA500;
    /* Orange */
    --nest-color-6: #98D8C8;
    /* Mint Green */

    --indent-guide: #49454F;
    --scrollbar-bg: transparent;
    --scrollbar-thumb: #49454F;

    /* Dark theme editor backgrounds */
    --editor-background: #1E1E1E;
    --preview-background: #1E1E1E;

    /* JSON Syntax Highlighting Colors (VS Code Dark+ theme inspired) */
    --json-key: #9CDCFE;
    --json-string: #CE9178;
    --json-number: #B5CEA8;
    --json-boolean: #569CD6;
    --json-null: #569CD6;
}

[data-theme="light"] {
    /* MD3 Color Tokens - Light Theme (Seed: Violet) */
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    --md-sys-color-secondary: #625B71;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #E8DEF8;
    --md-sys-color-on-secondary-container: #1D192B;
    --md-sys-color-tertiary: #7D5260;
    --md-sys-color-on-tertiary: #FFFFFF;
    --md-sys-color-tertiary-container: #FFD8E4;
    --md-sys-color-on-tertiary-container: #31111D;
    --md-sys-color-error: #B3261E;
    --md-sys-color-on-error: #FFFFFF;
    --md-sys-color-error-container: #F9DEDC;
    --md-sys-color-on-error-container: #410E0B;
    --md-sys-color-background: #FFFBFE;
    --md-sys-color-on-background: #1C1B1F;
    /* Surface colors updated for better contrast/separation */
    --md-sys-color-surface: #FFFBFE;
    --md-sys-color-on-surface: #1C1B1F;
    --md-sys-color-surface-variant: #E7E0EC;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;

    /* Custom elevations & utilities */
    --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-3: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);

    /* Syntax Highlighting / Nesting Colors - 7 unique colors for light theme */
    --nest-color-0: #D4AF37;
    /* Darker Gold */
    --nest-color-1: #9C27B0;
    /* Purple */
    --nest-color-2: #0277BD;
    /* Dark Blue */
    --nest-color-3: #D32F2F;
    /* Dark Red */
    --nest-color-4: #00897B;
    /* Dark Teal */
    --nest-color-5: #F57C00;
    /* Dark Orange */
    --nest-color-6: #388E3C;
    /* Dark Green */

    --indent-guide: #E0E0E0;
    --scrollbar-thumb: #CAC4D0;

    /* Light theme editor backgrounds */
    --editor-background: #FFFFFF;
    --preview-background: #F5F5F5;

    /* JSON Syntax Highlighting Colors (VS Code Light+ theme inspired) */
    --json-key: #001080;
    --json-string: #A31515;
    --json-number: #098658;
    --json-boolean: #0000FF;
    --json-null: #0000FF;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 14px;
}

/* Material Icons Helper */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 20px;
    /* Default size */
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

/* Button Reset & Base Styles */
button {
    font-family: 'Roboto', sans-serif;
    border: none;
    border-radius: 20px;
    /* Pill shape */
    padding: 0 16px;
    height: 40px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s, box-shadow 0.2s, color 0.2s;
    position: relative;
    overflow: hidden;
}

button:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* Filled Button (High emphasis) */
.btn-filled,
.action-btn {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-filled:hover,
.action-btn:hover:not(:disabled) {
    background-color: var(--md-sys-color-primary-container);
    /* Check contrast, or use elevation overlay */
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--md-sys-elevation-1);
}

/* Tonal Button (Medium emphasis) */
.btn-tonal,
.theme-btn {
    background-color: transparent;
    /* Changed from secondary-container */
    color: var(--md-sys-color-on-surface);
    /* Changed for better visibility */
}

.btn-tonal:hover,
.theme-btn:hover:not(.active) {
    background-color: rgba(103, 80, 164, 0.08);
    /* Subtle hover */
}

.theme-btn.active {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

/* Text Button (Low emphasis) */
.btn-text,
.nav-btn,
.font-btn {
    background-color: transparent;
    color: var(--md-sys-color-primary);
}

.btn-text:hover,
.nav-btn:hover:not(:disabled),
.font-btn:hover {
    background-color: rgba(103, 80, 164, 0.08);
    /* Primary opacity 8% */
}

/* Pastel Buttons */
.btn-pastel-blue {
    background-color: rgba(100, 181, 246, 0.15);
    color: #64B5F6;
}

.btn-pastel-blue:hover {
    background-color: rgba(100, 181, 246, 0.25);
}

.btn-pastel-green {
    background-color: rgba(129, 199, 132, 0.15);
    color: #81C784;
}

.btn-pastel-green:hover {
    background-color: rgba(129, 199, 132, 0.25);
}

.btn-pastel-purple {
    background-color: rgba(244, 143, 177, 0.15);
    color: #F48FB1;
}

.btn-pastel-purple:hover {
    background-color: rgba(244, 143, 177, 0.25);
}

.btn-pastel-red {
    background-color: rgba(229, 115, 115, 0.15);
    color: #E57373;
}

.btn-pastel-red:hover {
    background-color: rgba(229, 115, 115, 0.25);
}

.btn-pastel-orange {
    background-color: rgba(255, 183, 77, 0.15);
    color: #FFB74D;
}

.btn-pastel-orange:hover {
    background-color: rgba(255, 183, 77, 0.25);
}

.btn-pastel-cyan {
    background-color: rgba(77, 208, 225, 0.15);
    color: #4DD0E1;
}

.btn-pastel-cyan:hover {
    background-color: rgba(77, 208, 225, 0.25);
}

/* Icon Button (Square/Circle) */
.icon-btn {
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Override icon-btn size for font controls */
.font-size-controls .icon-btn.font-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
}

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

/* Navigation Bar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    width: 100%;
    box-shadow: 0 1px 0 var(--md-sys-color-outline-variant);
    /* Subtle separator */
    gap: 16px;
    z-index: 10;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--md-sys-color-primary);
}

.app-logo .material-symbols-outlined {
    font-size: 28px;
}

.app-title {
    font-size: 22px;
    font-weight: 400;
    /* Regular */
    margin: 0;
    color: var(--md-sys-color-on-surface);
}

.object-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--md-sys-color-surface-variant);
    padding: 4px;
    border-radius: 24px;
    /* Pill container */
}

.object-counter {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    min-width: 100px;
    text-align: center;
    font-weight: 500;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.font-size-controls,
.theme-switcher {
    display: flex;
    gap: 2px;
    background-color: var(--md-sys-color-surface-variant);
    padding: 4px;
    border-radius: 24px;
}

.theme-switcher .theme-btn {
    height: 32px;
    width: 32px;
    /* Circle */
    padding: 0;
    font-size: 12px;
    border-radius: 50%;
}

/* All font buttons - unified style */
.font-size-controls .font-btn,
.font-size-controls button {
    height: 24px !important;
    width: 24px !important;
    min-height: 24px !important;
    min-width: 24px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
}

.font-size-controls .font-btn .material-symbols-outlined,
.font-size-controls button .material-symbols-outlined {
    font-size: 16px !important;
}

.action-btn {
    height: 40px;
    font-size: 14px;
    border-radius: 20px;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: var(--md-sys-color-background);
}

/* Resizer */
.resizer {
    width: 1px;
    cursor: col-resize;
    background-color: var(--md-sys-color-outline-variant);
    position: relative;
    z-index: 5;
    transition: width 0.2s, background-color 0.2s;
}

.resizer:hover {
    width: 4px;
    background-color: var(--md-sys-color-primary);
}

/* Panes */
.left-pane,
.right-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--md-sys-color-background);
}

.left-pane {
    width: 50%;
    min-width: 300px;
}

.right-pane {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background-color: var(--md-sys-color-background);
    min-height: 56px;
    /* Seamless header */
    /* If you want a separated look: use surface-container-low */
}

.pane-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--md-sys-color-primary);
}

.pane-title-group .material-symbols-outlined {
    font-size: 20px;
}

.pane-title-group h2 {
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: var(--md-sys-color-on-background);
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    /* Live Indicator - Green */
    color: #81C784;
    background-color: rgba(129, 199, 132, 0.15);
    padding: 4px 12px;
    border-radius: 12px;
}

.indicator-dot {
    font-size: 10px !important;
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.add-prop-btn {
    height: auto;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    background-color: rgba(129, 199, 132, 0.15);
    color: #81C784;
    border-radius: 12px;
}

.add-prop-btn:hover {
    background-color: rgba(129, 199, 132, 0.25);
    box-shadow: var(--md-sys-elevation-1);
}

.delete-prop-btn-header {
    height: auto;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    background-color: rgba(229, 115, 115, 0.15);
    color: #E57373;
    border-radius: 12px;
}

.delete-prop-btn-header:hover {
    background-color: rgba(229, 115, 115, 0.25);
    box-shadow: var(--md-sys-elevation-1);
}


/* Form Container */
.form-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: var(--editor-background);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 5px;
    border: 2px solid var(--md-sys-color-background);
    /* border to create padding effect */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline);
}

/* Placeholder */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--md-sys-color-outline);
    text-align: center;
}

.placeholder-icon {
    font-size: 64px;
    color: var(--md-sys-color-surface-variant);
    margin-bottom: 16px;
}

.placeholder p {
    font-size: 16px;
    margin-bottom: 8px;
}

.placeholder-hint {
    font-size: 14px !important;
    opacity: 0.7;
}

/* Form Fields */
.field-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.field-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* MD3 Outlined Text Field Style */
.field-input,
.array-item-input {
    background-color: transparent;
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline);
    padding: 12px 16px;
    border-radius: 4px;
    /* Standard text field radius */
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    transition: all 0.2s;
    height: 48px;
    /* Touch target size */
    width: 100%;
}

.field-input:focus,
.array-item-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 11px 15px;
    /* Adjust for border width change */
}

.field-input:hover,
.array-item-input:hover {
    border-color: var(--md-sys-color-on-surface);
}


/* Nested Objects */
.nested-object {
    position: relative;
    margin: 12px 0;
    padding-left: 0;
    /* Handled by guide */
}

.nested-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--md-sys-color-surface);
    /* Clean look */
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
    border: 1px solid transparent;
}

.nested-header:hover {
    background-color: var(--md-sys-color-surface-variant);
}

.collapse-arrow {
    font-size: 20px;
    transition: transform 0.2s;
    color: var(--md-sys-color-on-surface-variant);
}

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

.nested-title {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    display: flex;
    align-items: center;
}

.add-nested-prop {
    background-color: transparent;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline-variant);
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

.nested-header:hover .add-nested-prop {
    opacity: 1;
}

.add-nested-prop:hover {
    background-color: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
}

.nested-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
    position: relative;
}

.collapsed .nested-content {
    display: none;
}

.collapsed .nested-content-wrapper {
    display: none;
}

/* Indentation Guides */
.indent-guide {
    position: absolute;
    width: 2px;
    background-color: var(--indent-guide);
    pointer-events: none;
}


/* JSON Preview Pane */
.preview-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--preview-background);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.json-preview {
    padding: 24px;
    overflow: auto;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    background-color: transparent;
    color: transparent;
    caret-color: var(--md-sys-color-on-surface-variant);
    -webkit-text-fill-color: transparent;
    border: none;
    resize: none;
    outline: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    margin: 0;
    box-sizing: border-box;
}

.json-preview.error {
    border-left: 4px solid var(--md-sys-color-error);
}

/* Syntax Highlight Overlay */
.json-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 24px;
    margin: 0;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    background-color: var(--preview-background);
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
    overflow: auto;
    white-space: pre;
    word-wrap: break-word;
    z-index: 1;
    box-sizing: border-box;
}

/* JSON Syntax Colors */
.json-key {
    color: var(--json-key, var(--nest-color-2));
}

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

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

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

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

/* Dialogs */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Scrim */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.dialog-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.dialog {
    background-color: var(--md-sys-color-surface);
    border-radius: 28px;
    /* MD3 dialog radius */
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--md-sys-elevation-3);
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: scaleUp 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleUp {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--md-sys-color-on-surface);
}

.dialog-header .material-symbols-outlined {
    font-size: 24px;
    color: var(--md-sys-color-primary);
}

.dialog h3 {
    margin: 0;
    font-size: 24px;
    /* Headline Small */
    font-weight: 400;
}

.dialog-path {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    font-family: 'Roboto Mono', monospace;
    background-color: var(--md-sys-color-surface-variant);
    padding: 4px 8px;
    border-radius: 4px;
    align-self: flex-start;
}

.dialog label {
    display: block;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 4px;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.dialog input {
    width: 100%;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline);
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 16px;
    font-family: 'Roboto', sans-serif;
}

.dialog input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 11px 15px;
}

.dialog-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Horizontal Array Inputs */
.array-inputs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.array-item-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.array-item-input {
    min-width: 80px;
    height: 40px;
}

.btn-array-add {
    background-color: transparent;
    border: 1px dashed var(--md-sys-color-outline);
    color: var(--md-sys-color-on-surface-variant);
    width: 32px;
    height: 32px;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-array-add:hover {
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-primary-container);
}

.btn-array-delete {
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    position: absolute;
    right: -8px;
    top: -8px;
    display: none;
    /* Show on hover */
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: var(--md-sys-elevation-1);
}

.array-item-wrapper:hover .btn-array-delete {
    display: flex;
    animation: scaleUp 0.1s ease-out;
}

.btn-array-delete:hover {
    background-color: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        overflow-y: auto;
    }

    .left-pane,
    .right-pane {
        width: 100%;
        height: 50%;
    }

    .resizer {
        height: 1px;
        width: 100%;
        cursor: row-resize;
    }

    .resizer:hover {
        height: 4px;
    }
}

@media (max-width: 768px) {
    .field-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .navbar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-left,
    .nav-right {
        justify-content: center;
    }
}

/* ===================================
   TABLE VIEW STYLES
   =================================== */

/* View Mode Toggle */
.view-mode-toggle {
    display: flex;
    gap: 2px;
    background-color: var(--md-sys-color-surface-variant);
    padding: 4px;
    border-radius: 24px;
}

.view-mode-btn {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 16px;
    background-color: transparent;
    color: var(--md-sys-color-on-surface-variant);
    transition: all 0.2s ease;
}

.view-mode-btn .material-symbols-outlined {
    font-size: 16px;
}

.view-mode-btn.active {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.view-mode-btn:hover:not(.active) {
    background-color: rgba(103, 80, 164, 0.08);
}

/* Table View Pane */
.table-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--md-sys-color-background);
    width: 100%;
}

.table-container {
    flex: 1;
    overflow: auto;
    background-color: var(--editor-background);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.table-actions {
    display: flex;
    gap: 12px;
    padding: 12px 24px;
    background-color: var(--md-sys-color-surface);
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* Data Table (Spreadsheet-like) */
.data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    table-layout: auto;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    white-space: nowrap;
    min-width: 100px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* Sticky Header */
.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.data-table th:hover {
    background-color: var(--md-sys-color-secondary-container);
}

/* Sort Indicator */
.sort-indicator {
    margin-left: 6px;
    font-size: 14px;
    vertical-align: middle;
    opacity: 0.8;
}

.sort-indicator.hidden {
    visibility: hidden;
}

/* Index Column */
.data-table .index-col {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
    min-width: 60px;
    max-width: 70px;
    text-align: center;
    position: sticky;
    left: 0;
    z-index: 5;
    border-right: 2px solid var(--md-sys-color-outline-variant);
}

.data-table th.index-col {
    z-index: 15;
    cursor: default;
}

.data-table th.index-col:hover {
    background-color: var(--md-sys-color-surface-variant);
}

/* Select Column */
.data-table .select-col {
    min-width: 40px;
    max-width: 40px;
    text-align: center;
    padding: 10px 8px;
}

/* Alternating Rows */
.data-table tbody tr:nth-child(odd) {
    background-color: var(--md-sys-color-surface);
}

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

/* Hover Effect on Rows */
.data-table tbody tr:hover {
    background-color: rgba(208, 188, 255, 0.08);
}

.data-table tbody tr:hover .index-col {
    background-color: rgba(208, 188, 255, 0.12);
}

/* Hover Effect on Data Cells */
.data-table td:not(.index-col):not(.select-col) {
    cursor: text;
    transition: background-color 0.1s ease;
}

.data-table td:not(.index-col):not(.select-col):hover {
    background-color: rgba(208, 188, 255, 0.15);
}

/* Editable Cell Input */
.cell-input {
    width: 100%;
    min-width: 80px;
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    border: 2px solid var(--md-sys-color-primary);
    padding: 6px 10px;
    font-size: inherit;
    font-family: inherit;
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
}

.cell-input:focus {
    box-shadow: 0 0 0 3px rgba(208, 188, 255, 0.3);
}

/* Selected Row */
.data-table tbody tr.selected {
    background-color: rgba(208, 188, 255, 0.18) !important;
}

.data-table tbody tr.selected .index-col {
    background-color: rgba(208, 188, 255, 0.25);
}

/* Row Checkbox */
.row-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--md-sys-color-primary);
}

/* Empty State */
.table-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
}

.table-empty-state .material-symbols-outlined {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Column Header Tooltip Styling */
.data-table th[title] {
    position: relative;
}

/* Cell Type Indicators */
.cell-null {
    color: var(--json-null);
    font-style: italic;
    opacity: 0.7;
}

.cell-array,
.cell-object {
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.cell-boolean-true {
    color: #81C784;
}

.cell-boolean-false {
    color: #E57373;
}

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

.cell-empty {
    color: var(--md-sys-color-outline);
    font-style: italic;
}

/* Responsive adjustments for table view */
@media (max-width: 1024px) {
    .view-mode-toggle {
        order: -1;
        margin-bottom: 8px;
    }
}

@media (max-width: 768px) {
    .table-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
        min-width: 80px;
    }
}

/* Save Notification Toast */
.save-notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.save-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.save-notification .material-symbols-outlined {
    color: #81C784;
}