:root {
    --primary-color: #2563eb;
    --background-color: #f8fafc;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
                "Helvetica Neue", Arial, "Noto Sans", sans-serif, 
                "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #64748b;
    font-size: 1.1rem;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background-color: #f1f5f9;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn.primary:hover {
    background-color: #1d4ed8;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    height: 100%;
    min-height: 600px;
}

#json-input {
    width: 100%;
    min-height: 600px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    border: none;
    resize: vertical;
}

#json-input:focus {
    outline: none;
}

#results_header {
    margin-top: 2rem;
    padding: 1rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

#results_header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-color);
}

.hide {
    display: none;
}

#loadSpinner {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .controls {
        flex-wrap: wrap;
    }

    .btn {
        flex: 1;
    }
}

#results-container {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.375rem;
}

#results-container .success {
    color: #16a34a;
    background-color: #f0fdf4;
    padding: 1rem;
    border-radius: 0.375rem;
    border: 1px solid #86efac;
}

#results-container .error {
    color: #dc2626;
    background-color: #fef2f2;
    padding: 1rem;
    border-radius: 0.375rem;
    border: 1px solid #fecaca;
    white-space: pre-wrap;
    font-family: monospace;
}

/* 添加分栏布局样式 */
.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1.2fr);
    gap: 1rem;
    margin-top: 1rem;
}

.input-panel,
.output-panel {
    min-height: 600px;
    max-height: 800px;
    display: flex;
    flex-direction: column;
}

.input-panel h3,
.output-panel h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    align-self: center;
}

.controls-panel .btn {
    width: 120px;
    text-align: center;
    position: relative;
    padding-right: 2rem;
}

.controls-panel .btn::after {
    content: '→';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.2s;
}

.controls-panel .btn:hover::after {
    transform: translate(3px, -50%);
}

#json-input,
#json-output,
.json-output {
    flex: 1;
    min-height: 600px;
    max-height: 800px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    resize: none;
    background-color: white;
    overflow: auto;
}

#json-output {
    background-color: #f8fafc;
}

#json-input:focus,
#json-output:focus {
    outline: none;
    border-color: var(--primary-color);
}

#results_header {
    margin-top: 1rem;
}

#loadSpinner {
    display: none;
    margin: 1rem auto;
}

/* 响应式布局 */
@media (max-width: 1024px) {
    .container {
        padding: 0.5rem;
    }

    .split-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 0.5rem;
    }

    .input-panel,
    .output-panel {
        min-height: 300px;
        max-height: 500px;
    }

    #json-input,
    #json-output,
    .json-output,
    .jsoneditor-container,
    .editor-container {
        min-height: 300px;
        max-height: 500px;
    }
}

/* 添加 JSON Editor 相关样式 */
.jsoneditor-container {
    width: 100%;
    height: 100%;
    max-height: 800px;
    overflow: auto;
}

/* 在现有样式基础上添加错误消息样式 */
.error-message {
    background-color: #fef2f2;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin: 1rem auto;
    max-width: 800px;
    text-align: left;
    border: 1px solid #fecaca;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 修改输出相关样式 */
.json-output {
    width: 100%;
    height: 100%;
    min-height: 600px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    border: none;
    resize: none;
    background-color: #f8fafc;
}

.jsoneditor-container {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

/* 确保容器高度正确 */
.editor-container {
    height: 100%;
    min-height: 600px;
    max-height: 800px;
    overflow: hidden;
}

/* 添加语言切换按钮样式 */
.lang-switch {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background-color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    background-color: #f1f5f9;
}