/* CSS Variables for theming */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --code-bg: #1e293b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Main content */
main {
    flex: 1;
}

/* Editor container */
.editor-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.editor-panel {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Textarea input */
#jsonInput {
    width: 100%;
    height: 400px;
    padding: 1rem 1.25rem;
    border: none;
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background: var(--card-bg);
    color: var(--text-color);
}

#jsonInput:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

#jsonInput::placeholder {
    color: var(--text-muted);
}

/* Output area */
.output-area {
    height: 400px;
    padding: 1rem 1.25rem;
    overflow: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background: var(--code-bg);
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.output-area .placeholder-text {
    color: var(--text-muted);
}

/* Syntax highlighting */
.json-key {
    color: #93c5fd;
}

.json-string {
    color: #86efac;
}

.json-number {
    color: #fcd34d;
}

.json-boolean {
    color: #f9a8d4;
}

.json-null {
    color: #a78bfa;
}

.json-bracket {
    color: #e2e8f0;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
    border-color: var(--secondary-color);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-icon {
    font-size: 1rem;
}

/* Status message */
.status-message {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-message.hidden {
    display: none;
}

.status-message.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-message.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-message.info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Features section */
.features {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.features h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.features ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.features li {
    padding: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.features li strong {
    color: var(--text-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 900px) {
    .editor-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .controls {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        padding: 0;
    }

    #jsonInput,
    .output-area {
        height: 300px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .panel-header {
        padding: 0.75rem 1rem;
    }

    #jsonInput,
    .output-area {
        padding: 0.75rem 1rem;
        height: 250px;
    }

    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .features {
        padding: 1rem;
    }

    .features ul {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar styling */
.output-area::-webkit-scrollbar,
#jsonInput::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.output-area::-webkit-scrollbar-track,
#jsonInput::-webkit-scrollbar-track {
    background: transparent;
}

.output-area::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

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

.output-area::-webkit-scrollbar-thumb:hover,
#jsonInput::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}
