* {
    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;
    padding: 20px;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    padding: 20px;
    height: calc(100vh - 140px);
}

.left-panel, .middle-panel, .right-panel {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.panel-header {
    background: #fff;
    padding: 15px 20px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 18px;
    color: #495057;
    font-weight: 600;
}

.button-group {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

textarea {
    flex: 1;
    padding: 15px;
    border: none;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    resize: none;
    background: white;
    color: #333;
    line-height: 1.6;
}

textarea:focus {
    outline: none;
}

.tree-container {
    flex: 1;
    padding: 15px;
    overflow: auto;
    background: white;
}

/* 搜索框样式 */
.search-container {
    padding: 15px 20px 10px 20px;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 16px;
    color: #6c757d;
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 10px 40px 10px 38px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#searchInput::placeholder {
    color: #adb5bd;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.clear-search-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.clear-search-btn.hidden {
    display: none;
}

.search-stats {
    margin-top: 8px;
    font-size: 13px;
    color: #6c757d;
    text-align: center;
}

.search-stats.hidden {
    display: none;
}

/* 树状结构样式 */
.tree-node {
    margin: 5px 0;
    user-select: none;
}

.tree-node-content {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.tree-node-content:hover {
    background: #e9ecef;
}

.tree-node-content.selected {
    background: #667eea;
    color: white;
}

.tree-node-content.selected .node-key,
.tree-node-content.selected .node-type {
    color: white;
}

.tree-node-content.highlight {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
}

.tree-node-content.highlight .node-value {
    font-weight: 600;
}

.toggle-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    line-height: 16px;
    color: #6c757d;
}

.toggle-icon.expanded::before {
    content: '▼';
}

.toggle-icon.collapsed::before {
    content: '▶';
}

.toggle-icon.no-children {
    visibility: hidden;
}

.node-icon {
    margin-right: 6px;
    font-size: 14px;
}

.node-key {
    font-weight: 600;
    color: #495057;
    margin-right: 6px;
}

.node-separator {
    margin: 0 4px;
    color: #adb5bd;
}

.node-value {
    color: #28a745;
}

.node-value.string {
    color: #fd7e14;
}

.node-value.number {
    color: #007bff;
}

.node-value.boolean {
    color: #6f42c1;
}

.node-value.null {
    color: #6c757d;
}

.node-type {
    margin-left: 8px;
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

.tree-children {
    margin-left: 24px;
    border-left: 1px dashed #dee2e6;
    padding-left: 8px;
}

.tree-children.collapsed {
    display: none;
}

/* 右键菜单样式 */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 160px;
}

.context-menu.hidden {
    display: none;
}

.context-menu ul {
    list-style: none;
    padding: 6px 0;
}

.context-menu li {
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
    color: #495057;
}

.context-menu li:hover {
    background: #f8f9fa;
    color: #667eea;
}

.context-menu .menu-separator {
    height: 1px;
    background: #dee2e6;
    margin: 6px 0;
    padding: 0;
    cursor: default;
}

.context-menu .menu-separator:hover {
    background: #dee2e6;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
    }

    .left-panel, .middle-panel, .right-panel {
        min-height: 400px;
    }
}

/* 对话框样式 */
.dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.dialog.hidden {
    display: none;
}

.dialog-content {
    background: white;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.dialog-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-header h3 {
    margin: 0;
    font-size: 18px;
    color: #495057;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.dialog-body {
    padding: 20px;
}

.dialog-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
}

.dialog-body input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.dialog-body input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dialog-footer {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Toast通知样式 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    animation: slideIn 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
