:root {
    --bg-dark: #1e1e1e;
    --bg-sidebar: #252526;
    --text-main: #cccccc;
    --border-color: #404040;
    
    /* VS Code Default Dark+ Colors */
    --json-key: #9cdcfe;
    --json-string: #ce9178;
    --json-number: #b5cea8;
    --json-boolean: #569cd6;
    --json-bracket: #d4d4d4;
    --json-comment: #6a9955;
    --json-func: #dcdcaa;
    
    --success: #89d185;
    --danger: #f14c4c;
    --line-number: #858585;
    
    --font-code: 'Fira Code', Consolas, 'Courier New', monospace;
}

body.light-theme {
    --bg-dark: #ffffff;
    --bg-sidebar: #f3f3f3;
    --text-main: #333333;
    --border-color: #d4d4d4;
    
    /* VS Code Light Theme approximations */
    --json-key: #0451a5;
    --json-string: #a31515;
    --json-number: #098658;
    --json-boolean: #0000ff;
    --json-bracket: #000000;
    --json-comment: #008000;
    --json-func: #795e26;
    
    --line-number: #237893;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-code);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 380px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
    transition: background-color 0.3s, border-color 0.3s;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.status-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

body.light-theme .status-container {
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.main-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.json-line {
    display: flex;
    align-items: center;
    min-height: 22px;
    position: relative;
    white-space: pre;
    transition: background-color 0.1s;
}

.json-line:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

body.light-theme .json-line:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.indent-1 { padding-left: 24px; }
.indent-2 { padding-left: 48px; }
.indent-3 { padding-left: 72px; }
.indent-4 { padding-left: 96px; }

/* Syntax Highlights */
.key { color: var(--json-key); transition: color 0.3s; }
.string { color: var(--json-string); transition: color 0.3s; }
.number { color: var(--json-number); transition: color 0.3s; }
.boolean { color: var(--json-boolean); transition: color 0.3s; }
.bracket { color: var(--json-bracket); transition: color 0.3s; }
.colon, .comma { color: var(--text-main); margin-right: 6px; transition: color 0.3s; }
.comment { color: var(--json-comment); font-style: italic; transition: color 0.3s; }

.status-text {
    color: var(--success);
}
.status-text.disconnected {
    color: var(--danger);
}

/* Inputs & Forms */
.json-form {
    display: contents;
}

input {
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-code);
    font-size: 14px;
    padding: 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    transition: border-color 0.2s;
    max-width: 50vw;
}

body.light-theme input {
    border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
}

input:focus {
    border-bottom-color: rgba(255, 255, 255, 0.4);
}

body.light-theme input:focus {
    border-bottom-color: rgba(0, 0, 0, 0.6);
}

input::placeholder {
    color: rgba(206, 145, 120, 0.3);
}

body.light-theme input::placeholder {
    color: rgba(163, 21, 21, 0.4);
}

.input-string { color: var(--json-string); width: 140px; }
.url-input { width: 180px; }
.key-input { width: 150px; }
.search-input { width: 300px; }
.input-number { color: var(--json-number); width: 60px; }

/* Buttons */
.func-btn {
    background: transparent;
    border: none;
    color: var(--json-func);
    font-family: var(--font-code);
    font-size: 14px;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.2s, color 0.3s;
}

.func-btn:hover {
    text-decoration-color: var(--json-func);
    text-shadow: 0 0 8px rgba(220, 220, 170, 0.4);
}

body.light-theme .func-btn:hover {
    text-shadow: none;
    text-decoration-color: var(--json-func);
}

.func-btn.danger {
    color: var(--danger);
}
.func-btn.danger:hover {
    text-decoration-color: var(--danger);
    text-shadow: 0 0 8px rgba(241, 76, 76, 0.4);
}

body.light-theme .func-btn.danger:hover {
    text-shadow: none;
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 16px;
    border-left: 3px solid var(--json-func);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    font-size: 13px;
    animation: slideIn 0.3s ease;
}

body.light-theme .toast {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Expandable list elements inside JSON */
.uid-record-block {
    display: block;
}

.uid-record-line {
    cursor: pointer;
}

.uid-record-line:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

body.light-theme .uid-record-line:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.uid-record-details {
    display: none;
}

.uid-record-block.expanded .uid-record-details {
    display: block;
}

.uid-record-block.expanded .fold-icon {
    transform: rotate(90deg);
}

.fold-icon {
    display: inline-block;
    transition: transform 0.2s;
    color: var(--line-number);
    font-size: 12px;
    margin-right: 4px;
    user-select: none;
}

/* Hide Scrollbars completely for sleek aesthetic */
::-webkit-scrollbar {
    display: none;
}
* {
    scrollbar-width: none; /* Firefox */
}

/* Mobile Menu Overlay & Button */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    backdrop-filter: blur(2px);
}

body.sidebar-open .mobile-overlay {
    display: block;
}

.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

body.light-theme .mobile-menu-btn {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Responsive adjustments */
@media (max-width: 850px) {
    .mobile-menu-btn {
        display: block;
    }

    .app-container {
        height: 100vh;
        overflow: hidden;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 320px;
        max-width: 85vw;
        border-right: 1px solid var(--border-color);
    }
    
    body.sidebar-open .sidebar {
        left: 0;
    }
    
    .main-content {
        padding-top: 80px; /* Room for mobile button */
        width: 100%;
    }
    
    .search-input {
        width: 180px;
    }
}