* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.view-tabs {
    display: flex;
    gap: 5px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: #f8f9fa;
    color: #6c757d;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-btn.active {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn i {
    font-size: 0.9rem;
}

.btn-primary {
    background: #28a745;
    color: white;
}

.btn-primary:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-success {
    background: #17a2b8;
    color: white;
}

.btn-success:hover {
    background: #138496;
    transform: translateY(-2px);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex: 1;
}

.input-panel, .output-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-header h3 {
    color: #495057;
    font-size: 1.2rem;
}

.output-options {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.output-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: #6c757d;
}

.output-options select {
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

#jsonInput {
    flex: 1;
    border: none;
    padding: 20px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    background: #fafbfc;
}

#jsonInput:focus {
    background: white;
}

.view-content {
    flex: 1;
    padding: 20px;
    overflow: auto;
    display: none;
}

.view-content.active {
    display: block;
}

#jsonOutput {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    overflow: auto;
    margin: 0;
    border: 1px solid #e9ecef;
}

.input-status, .output-status {
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status {
    font-weight: 500;
}

.status.valid {
    color: #28a745;
}

.status.invalid {
    color: #dc3545;
}

.status.empty {
    color: #6c757d;
}

.stats {
    font-size: 0.9rem;
    color: #6c757d;
}

/* 树形视图样式 */
.tree-node {
    margin-left: 20px;
    border-left: 2px solid #e9ecef;
    padding-left: 15px;
    margin-bottom: 5px;
}

.tree-node:last-child {
    border-left-color: transparent;
}

.tree-key {
    font-weight: 600;
    color: #007bff;
}

.tree-value {
    margin-left: 10px;
}

.tree-value.string {
    color: #28a745;
}

.tree-value.number {
    color: #ffc107;
}

.tree-value.boolean {
    color: #dc3545;
}

.tree-value.null {
    color: #6c757d;
}

.tree-toggle {
    cursor: pointer;
    user-select: none;
    display: inline-block;
    width: 16px;
    text-align: center;
    margin-right: 5px;
    color: #6c757d;
}

.tree-toggle:hover {
    color: #007bff;
}

/* Excel 样式表格 */
.excel-table-container {
    width: 100%;
    overflow: auto;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: 13px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.excel-table thead {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    border-bottom: 2px solid #2c5aa0;
}

.excel-header {
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    color: white;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    z-index: 10;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    letter-spacing: 0.3px;
}

.excel-header:last-child {
    border-right: none;
}

.excel-header:first-child {
    width: 35%;
}

.excel-header:nth-child(2) {
    width: 45%;
}

.excel-header:last-child {
    width: 20%;
}

.excel-row {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f3f6;
}

.excel-row:nth-child(odd) {
    background-color: #fafbfc;
}

.excel-row:nth-child(even) {
    background-color: #ffffff;
}

.excel-row:hover {
    background-color: #e3f2fd !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.excel-row.array-container {
    background: linear-gradient(90deg, #fff3e0 0%, #ffe0b2 100%);
    border-left: 4px solid #ff9800;
}

.excel-row.array-container:hover {
    background: linear-gradient(90deg, #ffe0b2 0%, #ffcc02 100%);
    box-shadow: 0 3px 6px rgba(255, 152, 0, 0.2);
}

.excel-row.object-container {
    background: linear-gradient(90deg, #e8f5e8 0%, #c8e6c9 100%);
    border-left: 4px solid #4caf50;
}

.excel-row.object-container:hover {
    background: linear-gradient(90deg, #c8e6c9 0%, #a5d6a7 100%);
    box-shadow: 0 3px 6px rgba(76, 175, 80, 0.2);
}

.excel-cell {
    padding: 10px 16px;
    border-right: 1px solid #e8eaed;
    vertical-align: top;
    word-break: break-word;
    max-width: 350px;
    line-height: 1.4;
    font-size: 13px;
}

.excel-cell:last-child {
    border-right: none;
}

.key-cell {
    font-weight: 500;
    color: #1565c0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    background-color: rgba(21, 101, 192, 0.04);
    position: relative;
}

.key-cell.expandable {
    font-weight: 600;
    color: #6a1b9a;
    background-color: rgba(106, 27, 154, 0.06);
    border-left: 4px solid currentColor;
}

.key-cell.expandable::before {
    content: "📁";
    margin-right: 6px;
    font-size: 14px;
}

.key-cell.level-1 {
    padding-left: 32px;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.08) 0%, transparent 100%);
}

.key-cell.level-2 {
    padding-left: 48px;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.08) 0%, transparent 100%);
}

.key-cell.level-3 {
    padding-left: 64px;
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.08) 0%, transparent 100%);
}

.key-cell.level-4 {
    padding-left: 80px;
    background: linear-gradient(90deg, rgba(233, 30, 99, 0.08) 0%, transparent 100%);
}

.key-cell.level-5 {
    padding-left: 96px;
    background: linear-gradient(90deg, rgba(156, 39, 176, 0.08) 0%, transparent 100%);
}

.value-cell {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    color: #24292e;
    background-color: #fafbfc;
}

.string-value {
    color: #032f62;
    background: linear-gradient(90deg, #f0fff4 0%, transparent 100%);
    border-left: 3px solid #28a745;
    padding-left: 13px;
}

.string-value::before {
    content: "📝";
    margin-right: 6px;
    font-size: 12px;
}

.number-value {
    color: #005cc5;
    font-weight: 600;
    background: linear-gradient(90deg, #f6f8ff 0%, transparent 100%);
    border-left: 3px solid #0366d6;
    padding-left: 13px;
}

.number-value::before {
    content: "🔢";
    margin-right: 6px;
    font-size: 12px;
}

.boolean-value {
    color: #6f42c1;
    font-weight: 600;
    background: linear-gradient(90deg, #f8f4ff 0%, transparent 100%);
    border-left: 3px solid #8b5cf6;
    padding-left: 13px;
}

.boolean-value::before {
    content: "✅";
    margin-right: 6px;
    font-size: 12px;
}

.null-value {
    color: #6a737d;
    font-style: italic;
    background: linear-gradient(90deg, #f6f8fa 0%, transparent 100%);
    border-left: 3px solid #959da5;
    padding-left: 13px;
}

.null-value::before {
    content: "∅";
    margin-right: 6px;
    font-size: 14px;
    font-weight: bold;
}

.array-value {
    color: #e36209;
    font-weight: 600;
    background: linear-gradient(90deg, #fff8f0 0%, transparent 100%);
    border-left: 3px solid #fb8500;
    padding-left: 13px;
}

.array-value::before {
    content: "📋";
    margin-right: 6px;
    font-size: 12px;
}

.object-value {
    color: #22863a;
    font-weight: 600;
    background: linear-gradient(90deg, #f0fff4 0%, transparent 100%);
    border-left: 3px solid #28a745;
    padding-left: 13px;
}

.object-value::before {
    content: "📦";
    margin-right: 6px;
    font-size: 12px;
}

.type-cell {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    min-width: 80px;
}

.type-string {
    color: #1f883d;
    background-color: rgba(31, 136, 61, 0.1);
}

.type-number {
    color: #0969da;
    background-color: rgba(9, 105, 218, 0.1);
}

.type-boolean {
    color: #8250df;
    background-color: rgba(130, 80, 223, 0.1);
}

.type-null {
    color: #656d76;
    background-color: rgba(101, 109, 118, 0.1);
}

.type-array {
    color: #d1242f;
    background-color: rgba(209, 36, 47, 0.1);
}

.type-object {
    color: #0969da;
    background-color: rgba(9, 105, 218, 0.1);
}

/* 响应式表格 */
@media (max-width: 768px) {
    .excel-table-container {
        font-size: 12px;
    }
    
    .excel-cell {
        padding: 6px 8px;
    }
    
    .excel-header {
        padding: 8px 12px;
    }
    
    .key-cell.level-1 {
        padding-left: 20px;
    }
    
    .key-cell.level-2 {
        padding-left: 28px;
    }
    
    .key-cell.level-3 {
        padding-left: 36px;
    }
    
    .key-cell.level-4 {
        padding-left: 44px;
    }
}

/* 旧表格样式（保留以防兼容性问题） */
.json-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.json-table th,
.json-table td {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}

.json-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
}

.json-table td.path {
    font-family: 'Courier New', monospace;
    color: #007bff;
    font-weight: 500;
}

.json-table td.type {
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.json-table td.type.string {
    color: #28a745;
}

.json-table td.type.number {
    color: #ffc107;
}

.json-table td.type.boolean {
    color: #dc3545;
}

.json-table td.type.null {
    color: #6c757d;
}

.json-table td.type.object {
    color: #17a2b8;
}

.json-table td.type.array {
    color: #6f42c1;
}

.json-table td.value {
    font-family: 'Courier New', monospace;
    max-width: 300px;
    word-break: break-all;
}

.footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-tabs, .action-buttons {
        justify-content: center;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 动画效果 */
.view-content {
    transition: opacity 0.3s ease;
}

.btn {
    transition: all 0.3s ease;
}

.btn:active {
    transform: translateY(0);
}

/* 语法高亮 */
.json-key {
    color: #007bff;
    font-weight: 600;
}

.json-string {
    color: #28a745;
}

.json-number {
    color: #ffc107;
}

.json-boolean {
    color: #dc3545;
}

.json-null {
    color: #6c757d;
}

.json-punctuation {
    color: #495057;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #f5c6cb;
}
