/* JSON格式化工具样式 */
.json-section {
    min-height: 100vh;
    padding: 120px 0 80px;
    background: var(--dark-bg);
}

.json-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 40px rgba(0,0,0,.1);
    backdrop-filter: blur(10px);
}

.json-container h2 {
    text-align: center;
    margin-bottom: .5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2.5rem;
    font-weight: 700;
}

.json-subtitle {
    text-align: center;
    color: var(--text-gray);
    margin-bottom: 2.5rem;
    font-size: 1.2rem;
}

/* 操作按钮 */
.json-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.action-btn {
    padding: .8rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--dark-bg);
    color: var(--text-light);
    cursor: pointer;
    transition: all .3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.action-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
}

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

/* 工作区 */
.json-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    min-height: 500px;
}

.input-panel,
.output-panel {
    background: var(--dark-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.panel-header h3 {
    margin: 0;
    color: var(--text-light);
    font-size: 1.1rem;
    font-weight: 600;
}

.panel-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-gray);
    cursor: pointer;
    border-radius: 6px;
    transition: all .3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.view-toggle {
    display: flex;
    background: var(--dark-bg);
    border-radius: 6px;
    padding: 2px;
}

.toggle-btn {
    padding: .4rem .8rem;
    border: none;
    background: transparent;
    color: var(--text-gray);
    cursor: pointer;
    border-radius: 4px;
    transition: all .3s ease;
    font-size: .85rem;
}

.toggle-btn.active {
    background: var(--accent-color);
    color: white;
}

/* 文本区域 */
#json-input {
    flex: 1;
    width: 100%;
    padding: 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: .95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

.output-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.formatted-view,
.tree-view {
    height: 100%;
    padding: 1.5rem;
    margin: 0;
    background: transparent;
    color: var(--text-light);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: .95rem;
    line-height: 1.6;
    overflow: auto;
}

.formatted-view.hidden,
.tree-view.hidden {
    display: none;
}

/* JSON语法高亮 */
.json-string { color: #98c379; }
.json-number { color: #d19a66; }
.json-boolean { color: #56b6c2; }
.json-null { color: #e06c75; }
.json-key { color: #e5c07b; }
.json-brace { color: #abb2bf; }
.json-bracket { color: #abb2bf; }
.json-comma { color: #abb2bf; }
.json-colon { color: #abb2bf; }

/* 树形视图 */
.json-tree-item {
    margin: .2rem 0;
    cursor: pointer;
    user-select: none;
}

.json-tree-key {
    color: #e5c07b;
    font-weight: 600;
}

.json-tree-value {
    margin-left: .5rem;
}

.json-tree-expand {
    display: inline-block;
    width: 16px;
    text-align: center;
    cursor: pointer;
    color: var(--text-gray);
}

.json-tree-expand:hover {
    color: var(--accent-color);
}

.json-tree-children {
    margin-left: 1.5rem;
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
}

/* 信息栏 */
.input-info,
.output-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .8rem 1.5rem;
    background: rgba(0,0,0,.2);
    border-top: 1px solid var(--border-color);
    font-size: .85rem;
    color: var(--text-gray);
}

/* 错误面板 */
.error-panel {
    background: rgba(231, 76, 60, .1);
    border: 1px solid rgba(231, 76, 60, .3);
    border-radius: 12px;
    margin-bottom: 2rem;
    animation: fadeIn .5s ease;
}

.error-panel.hidden {
    display: none;
}

.error-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(231, 76, 60, .2);
    border-bottom: 1px solid rgba(231, 76, 60, .3);
    border-radius: 12px 12px 0 0;
}

.error-header i {
    color: #e74c3c;
    margin-right: .5rem;
}

.error-header span {
    color: var(--text-light);
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: .2rem;
    border-radius: 4px;
    transition: all .3s ease;
}

.close-btn:hover {
    background: rgba(231, 76, 60, .3);
    color: white;
}

.error-content {
    padding: 1.5rem;
    color: #e74c3c;
    font-family: monospace;
    font-size: .9rem;
    line-height: 1.5;
}

/* 设置 */
.json-settings {
    background: linear-gradient(135deg, rgba(0,198,255,.05), rgba(0,198,255,.02));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.json-settings h3 {
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 600;
}

.setting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.setting-item label {
    color: var(--text-gray);
    font-weight: 500;
}

.setting-item select,
.setting-item input[type="checkbox"] {
    padding: .4rem .8rem;
    border: 1px solid var(--border-color);
    background: var(--dark-bg);
    color: var(--text-light);
    border-radius: 6px;
}

/* 返回链接 */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-top: 2rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all .3s ease;
}

.back-link:hover {
    gap: .8rem;
    color: #00a8e8;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .json-container {
        padding: 2rem;
        margin: 0 1rem;
    }
    
    .json-workspace {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        min-height: 400px;
    }
    
    .json-actions {
        justify-content: stretch;
    }
    
    .action-btn {
        flex: 1;
        justify-content: center;
    }
    
    .setting-grid {
        grid-template-columns: 1fr;
    }
}