:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --error-color: #ef4444;
    --success-color: #10b981;
    --border-color: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #60a5fa, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: calc(100vh - 200px);
    min-height: 500px;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        height: auto;
    }
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

textarea#hexInput {
    flex-grow: 1;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 1.5rem;
    font-family: monospace;
    font-size: 1rem;
    resize: none;
    outline: none;
}

.result-container {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.5);
}

/* JSON Tree Viewer */
.json-tree {
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.json-line {
    white-space: pre-wrap;
    word-break: break-all;
}

details > summary {
    cursor: pointer;
    list-style-position: inside;
}

details > summary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.details-content {
    padding-left: 1.5em;
    border-left: 1px dashed rgba(255, 255, 255, 0.2);
    margin-left: 0.5em;
}

.json-summary-text {
    color: var(--text-secondary);
    font-size: 0.8em;
    font-style: italic;
    margin-left: 0.5em;
}

/* Syntax Highlighting */
.key { color: #93c5fd; }
.string { color: #86efac; }
.number { color: #fca5a5; }
.boolean { color: #fdba74; }
.null { color: #cbd5e1; }

.primary-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover {
    background-color: var(--accent-hover);
}

.primary-btn:active {
    transform: scale(0.98);
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.25rem;
    border-radius: 4px;
}

.icon-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.error-msg {
    padding: 0.75rem 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border-top: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

/* Simple Loader */
.loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
