/* Core 9UY Utility Background */
:root {
  --bg: #0a0a0a;
  --bg-panel: rgba(17, 24, 39, 0.5); /* bg-gray-900/50 */
  --fg: #d4d4d8;
  --accent: #10b981; /* green-500 base */
  --accent-secondary: #3b82f6;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #1f2937; /* gray-800 */
  --border-hover: #374151; /* gray-700 */
  --text-muted: #9ca3af;
}

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    -webkit-font-smoothing: antialiased;
}

.scanline {
    position: fixed;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.15) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 50;
    opacity: 0.2;
}

/* Header Pattern */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

.back-link, .feedback-link {
    color: var(--text-muted);
    transition: color 0.2s;
    text-decoration: none;
    display: flex;
}
.back-link:hover, .feedback-link:hover {
    color: #ffffff;
}

.app-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #ffffff;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    font-size: 0.625rem;
    color: rgba(16, 185, 129, 0.8);
    text-transform: uppercase;
    letter-spacing: -0.05em;
}
.status-indicator.error {
    color: rgba(239, 68, 68, 0.8);
}
.status-indicator.active {
    animation: blink 2s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Main Container */
.app-container {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

/* Layout */
.split-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
    height: 100%;
}

@media (min-width: 900px) {
    .split-layout {
        flex-direction: row;
    }
}

.editor-panel, .inspector-panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 400px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.editor-panel:hover, .inspector-panel:hover {
    border-color: var(--border-hover);
}

/* Toolbars */
.toolbar, .import-bar, .inspector-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
    flex-wrap: wrap;
}

.inspector-header {
    justify-content: space-between;
}
.inspector-header h2 {
    font-size: 0.875rem;
    margin: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toolbar-divider {
    width: 1px;
    height: 1.25rem;
    background-color: var(--border);
    margin: 0 0.5rem;
}

.icon-button {
    background: transparent;
    color: var(--fg);
    border: 1px solid transparent;
    border-radius: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s;
    text-transform: uppercase;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
    color: #fff;
}
.icon-button i {
    width: 14px;
    height: 14px;
}

.import-bar input[type="text"] {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    color: #fff;
    padding: 0.375rem 0.75rem;
    font-family: inherit;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    min-width: 120px;
}

.import-bar input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

.file-import-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}
.file-input-hidden {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
    height: 100%;
    width: 100%;
}

/* Editor */
.editor-wrapper {
    flex: 1;
    position: relative;
    display: flex;
}

textarea {
    flex: 1;
    background: transparent;
    color: #e5e7eb;
    border: none;
    padding: 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    white-space: pre;
    tab-size: 2;
}

textarea::placeholder {
    color: var(--border-hover);
}

.validation-msg {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.validation-msg.valid {
    color: var(--accent);
}
.validation-msg.invalid {
    color: var(--danger);
}

/* Inspector Tree */
.inspector-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
}

.placeholder-text {
    color: var(--border-hover);
    text-align: center;
    margin-top: 2rem;
    font-style: italic;
}

/* Tree view styling */
.tree-node {
    margin-left: 1rem;
    position: relative;
}
.tree-node.root {
    margin-left: 0;
}

.tree-key {
    color: #38bdf8; /* light blue */
    cursor: pointer;
}
.tree-key:hover {
    text-decoration: underline;
}

.tree-value.string { color: #10b981; } /* green */
.tree-value.number { color: #f59e0b; } /* yellow */
.tree-value.boolean { color: #ec4899; } /* pink */
.tree-value.null { color: var(--text-muted); font-style: italic; }

.tree-type {
    font-size: 0.65rem;
    color: var(--border-hover);
    margin-left: 0.5rem;
    text-transform: uppercase;
}

details {
    padding: 2px 0;
}

summary {
    cursor: pointer;
    list-style: none; /* Hide default arrow */
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}
summary::-webkit-details-marker {
    display: none;
}
summary::before {
    content: "▶";
    font-size: 0.6rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    display: inline-block;
    width: 12px;
}
details[open] > summary::before {
    transform: rotate(90deg);
}

.tree-bracket {
    color: var(--text-muted);
}
.tree-item-count {
    color: var(--border-hover);
    font-size: 0.75rem;
    margin-left: 0.5rem;
    user-select: none;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}
