/* JSON 查看器样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    transition: background 0.3s ease;
}

body.drag-over {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.container {
    width: 100%;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 1.3rem;
    margin-bottom: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.header-desc {
    color: #999;
    font-size: 0.85rem;
}

.header-formats {
    color: #bbb;
    font-size: 0.8rem;
}

/* 文件输入区域 */
.file-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.btn-file {
    gap: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.btn-file:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.35);
}

.file-input-icon {
    font-size: 1rem;
}

.file-input-text {
    white-space: nowrap;
}

.file-info {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 500;
}

.file-info span {
    margin-right: 0;
}

/* 工具栏 */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-primary {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.btn-secondary:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.35);
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* 状态栏 */
.status-bar {
    margin-bottom: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.status-success {
    background: rgba(40, 167, 69, 0.9);
    color: white;
}

.status-error {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.status-info {
    background: rgba(23, 162, 184, 0.9);
    color: white;
}

/* 内容区域 */
.content-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
    min-height: calc(100vh - 300px);
    width: 100%;
}

/* 仅预览模式：单列全宽 */
.content-wrapper.preview-only {
    grid-template-columns: 1fr;
}

.editor-panel,
.preview-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 350px);
    width: 100%;
}

.panel-header {
    background: rgba(102, 126, 234, 0.1);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 600;
}

.panel-actions {
    display: flex;
    gap: 5px;
}

#jsonEditor {
    flex: 1;
    padding: 20px;
    border: none;
    outline: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: transparent;
    color: #333;
    width: 100%;
    min-height: 400px;
    height: 100%;
}

#jsonEditor::placeholder {
    color: #999;
    font-style: italic;
}

#jsonPreview {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: transparent;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
}

.empty-preview {
    color: #999;
    font-style: italic;
    text-align: center;
    margin-top: 50px;
}

.error-message {
    background: #ffe6e6;
    border: 1px solid #ff9999;
    border-radius: 8px;
    padding: 15px;
    color: #cc0000;
    margin: 20px 0;
}

.error-message code {
    display: block;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
}

/* JSON 查看器样式 */
.json-viewer {
    color: #333;
}

.json-object,
.json-array {
    position: relative;
    margin-left: 20px;
}

.json-item {
    margin-left: 20px;
    margin-top: 4px;
}

.json-key {
    color: #881391;
    font-weight: 600;
}

.json-string {
    color: #0b7500;
}

.json-number {
    color: #1c00cf;
}

.json-boolean {
    color: #0d22aa;
    font-weight: 600;
}

.json-null {
    color: #808080;
    font-style: italic;
}

.json-bracket {
    color: #333;
    font-weight: 600;
}

.json-comma {
    color: #333;
}

.json-toggle {
    position: absolute;
    left: -18px;
    top: 0;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 3px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    transition: all 0.2s ease;
}

.json-toggle:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
}

.json-content {
    margin-left: 5px;
}

.json-object.collapsed .json-content,
.json-array.collapsed .json-content {
    display: none;
}

.json-object.collapsed .json-bracket:last-child,
.json-array.collapsed .json-bracket:last-child {
    margin-left: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        gap: 4px;
        padding: 10px 16px;
    }

    .header h1 {
        font-size: 1.1rem;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1rem;
    }
    
    .btn-file .file-input-text {
        font-size: 0.85rem;
    }
    
    .panel-header {
        padding: 10px 15px;
    }
    
    #jsonEditor,
    #jsonPreview {
        padding: 15px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editor-panel,
.preview-panel {
    animation: fadeIn 0.5s ease-out;
}

/* 加载状态 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


