:root {
    --accent: #8b5cf6;
    --accent-bright: #a78bfa;
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.15);
    --success: #10b981;
    --error: #ef4444;
    --bg-primary: #0a0e27;
    --bg-secondary: #020308;
    --text-primary: #e5e7eb;
    --text-secondary: #94a3b8;
    --node-bg: rgba(139, 92, 246, 0.1);
}

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

body {
    font-family: system-ui, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background 0.3s ease;
}

body.light-mode {
    --glass: rgba(0, 0, 0, 0.05);
    --border: rgba(0, 0, 0, 0.15);
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --node-bg: rgba(139, 92, 246, 0.08);
}

.editor-heading h2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 800;
    line-height: 1.2;
}

.gradient-text {
    font-size: clamp(1.0rem, 5vw, 2rem);
    background: linear-gradient(135deg, #6c5ce7, #00cec9, #a29bfe);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    padding-bottom: 0px;
    animation: gradientShift 5s ease infinite;
    transition: transform 0.3s ease, filter 0.3s ease;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* HEADER */
header {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-direction: column;
    align-items: center;
}

.header-controls {
    display: flex;
    gap: 12px;
    width: 60%;
    align-items: center;
}

.header-controls input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.header-controls input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* BUTTONS */
button {
    padding: 10px 18px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), var(--accent-bright));
    color: white;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.35);
}

button.secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

button.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

button.icon-btn {
    padding: 8px;
    min-width: 36px;
    justify-content: center;
}

button.icon-btn i {
    font-size: 16px;
}

/* LAYOUT */
.container {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 12px;
    min-height: 0;
}

/* LANGUAGE PANEL */
.language-panel {
    width: 160px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.language-title {
    padding: 12px;
    font-weight: bold;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border-bottom: 1px solid var(--border);
}

#languageList {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

#languageList li {
    padding: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

#languageList li i {
    font-size: 14px;
    opacity: 0.7;
}

#languageList li.active,
#languageList li:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-bright);
    border-left-color: var(--accent);
}

/* PANELS */
.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--glass);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
}

.panel:hover {
    border-color: rgba(139, 92, 246, 0.3);
}

.panel-title {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(139, 92, 246, 0.15);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

textarea {
    flex: 1;
    padding: 16px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: "JetBrains Mono", monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    overflow: auto;
}

/* TREE VIEW */
.tree-container {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.tree-node {
    margin: 4px 0;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
}

.tree-node-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
    user-select: none;
}

.tree-node-content:hover {
    background: var(--node-bg);
}

.tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent);
    font-size: 12px;
    transition: all 0.2s ease;
}

.tree-toggle:hover {
    background: rgba(139, 92, 246, 0.3);
}

.tree-key {
    color: var(--accent-bright);
    font-weight: 600;
}

.tree-colon {
    color: var(--text-secondary);
}

.tree-value {
    color: #f0abfc;
}

.tree-value.string {
    color: #5eead4;
}

.tree-value.number {
    color: #fbbf24;
}

.tree-value.boolean {
    color: #f87171;
}

.tree-value.null {
    color: #94a3b8;
}

.tree-children {
    margin-left: 20px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
    display: none;
}

.tree-children.expanded {
    display: block;
}

/* RESIZER */
#resizer {
    width: 5px;
    cursor: col-resize;
    background: linear-gradient(180deg, transparent, var(--accent), transparent);
    opacity: 0.5;
    transition: opacity 0.2s ease;
    border-radius: 2px;
}

#resizer:hover {
    opacity: 1;
    background: var(--accent);
}

/* STATUS */
.status {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.04);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status i {
    font-size: 14px;
}

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

.status.error {
    color: var(--error);
}

.status.warning {
    color: #f59e0b;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-bright);
}

/* ANIMATIONS */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* TOOLTIPS */
[tooltip] {
    position: relative;
}

[tooltip]:before {
    content: attr(tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 1000;
}

[tooltip]:hover:before {
    opacity: 1;
}