* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 5px 15px;
}

header {
    text-align: center;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
}

h1 {
    color: #2c3e50;
    font-size: 2.2rem;
    margin-bottom: 2px;
}

.main-content {
    display: flex;
    gap: 20px;
    height: calc(100vh - 150px);
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.editor-header-input {
    padding: 5px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-header-output{
    padding: 5px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h2 {
    font-size: 1.2rem;
    color: #495057;
}

.controls {
    display: flex;
    gap: 10px;
}

button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

button:active {
    background-color: #004085;
}

#clear-btn {
    background-color: #6c757d;
}

#clear-btn:hover {
    background-color: #5a6268;
}

#copy-btn {
    background-color: #28a745;
    padding: 5px 15px;
}

#copy-btn:hover {
    background-color: #218838;
}

.editor {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
}


textarea {
    flex: 1;
    border: none;
    padding: 15px;
    font-family: 'inherit';
    resize: none;
    outline: none;
    line-height: 1.5;
    background-color: #fafafa;
    color: #333;
    border-radius: 4px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 深色主题下的文本域样式 */
body.dark-theme textarea {
    background-color: #2d2d44;
    color: #e0e0e0;
    border-color: #3a3a55;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 新增稳定的折叠按钮样式 */
.toggle-btn {
    cursor: pointer;
    font-size: 0.8rem;
    margin: 0 4px;
    color: #6c757d;
    user-select: none;
    transition: transform 0.2s ease;
}

.toggle-btn:hover {
    color: #007bff;
    transform: scale(1.1);
}

.collapsible-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.collapsible-content[data-collapsed="true"] {
    display: none;
}

.collapsible-content[data-collapsed="false"] {
    display: block;
}

.place-space[place-collapsed="true"] {
    display: none;
}

.place-space[place-collapsed="false"] {
    display: inline-block;
}

/* 深色主题下的折叠按钮样式 */
body.dark-theme .toggle-btn {
    color: #a0a0a0;
}

body.dark-theme .toggle-btn:hover {
    color: #4fc3f7;
}

/* 优化输出区域样式 */
#output-json {
    flex: 1;
    padding: 10px;
    font-family: 'Consolas', 'Monaco', 'Lucida Console', monospace;
    font-size: 0.9rem;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.2;
    word-break: break-all;
}

.json-key {
    color: #92278f;
    font-weight: bold;
    font-size: 15px;
}

.json-string {
    color: #3ab54a;
    font-weight: bold;
    font-size: 15px;
}

.json-number {
    color: #1750eb;
    font-weight: bold;
    font-size: 15px;
}

.json-boolean {
    color: #ff0078;
    font-weight: bold;
    font-size: 15px;
}

.json-null {
    color: #7d00ff;
    font-weight: bold;
    font-size: 15px;
}

.collapsible {
    cursor: pointer;
}

.collapsible:after {
    content: '－';
    font-size: 0.8rem;
    margin-left: 5px;
    color: #6c757d;
}

.collapsed:after {
    content: '＋';
}

.collapsed ~ .children {
    display: none;
}

.error {
    color: #dc3545;
    font-weight: bold;
}

/* 新增工具栏样式 */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 0px;
    padding: 5px;
    background-color: #f1f3f5;
    border-radius: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* 主题切换样式 */
.theme-switch {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #495057;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 错误提示样式 */
.error-message {
    color: #dc3545;
    font-size: 0.9rem;
    height: 20px;
    line-height: 15px;
}

/* 深色主题样式 */
body.dark-theme {
    background-color: #1a1a2e;
    color: #e0e0e0;
}

body.dark-theme .editor-container {
    background-color: #212134;
}

body.dark-theme .editor-header {
    background-color: #2a2a40;
    border-bottom-color: #3a3a55;
}

body.dark-theme h1, body.dark-theme h2 {
    color: #e0e0e0;
}

body.dark-theme .toolbar {
    background-color: #2a2a40;
}

body.dark-theme textarea, body.dark-theme #output-json {
    background-color: #2d2d44;
    color: #e0e0e0;
}

body.dark-theme .theme-switch {
    color: #e0e0e0;
}

/* 按钮样式优化 */
#compress-btn {
    background-color: #fd7e14;
}

#compress-btn:hover {
    background-color: #e67e22;
}

#validate-btn {
    background-color: #28a745;
}

#validate-btn:hover {
    background-color: #218838;
}

.array-count {
    color: #888;
    font-style: italic;
    font-size: 0.9em;
}

.array-index {
    color: #888;
    font-size: 0.9em;
}

body.dark-theme .array-count,
body.dark-theme .array-index {
    color: #aaa;
}

/* 在文件末尾添加以下样式 */

.history-content {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px;
    min-height: 30px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.history-tag {
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    border-radius: 15px;
    padding: 2px 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

.history-tag:hover {
    background-color: #dee2e6;
}

.history-name {
    margin-right: 5px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-close {
    font-weight: bold;
    color: #6c757d;
}

.history-close:hover {
    color: #dc3545;
}

.history-rename-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.8rem;
    width: 100px;
}

/* 深色主题样式 */
body.dark-theme .history-content {
    background-color: #2a2a40;
    border-bottom-color: #3a3a55;
}

body.dark-theme .history-tag {
    background-color: #343a40;
    color: #e0e0e0;
}

body.dark-theme .history-tag:hover {
    background-color: #495057;
}

body.dark-theme .history-close {
    color: #adb5bd;
}

body.dark-theme .history-close:hover {
    color: #ff6b6b;
}

/* 选中的历史记录项样式 */
.history-tag-selected {
    background-color: #007bff !important;
    color: white !important;
}

.history-tag-selected .history-close {
    color: white !important;
}

/* 深色主题下的选中样式 */
body.dark-theme .history-tag-selected {
    background-color: #4fc3f7 !important;
    color: #212134 !important;
}

body.dark-theme .history-tag-selected .history-close {
    color: #212134 !important;
}

/* 选中的历史记录项样式 */
.history-tag-selected {
    background-color: #007bff !important;
    color: white !important;
}

.history-tag-selected .history-close {
    color: white !important;
}

/* 深色主题下的选中样式 */
body.dark-theme .history-tag-selected {
    background-color: #4fc3f7 !important;
    color: #212134 !important;
}

body.dark-theme .history-tag-selected .history-close {
    color: #212134 !important;
}

/* Filter expression input styling */
.filter-expression-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin: 10px 0;
    text-align: left;
}

#filter-expression {
    /* width: 50%; */
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Lucida Console', monospace;
    font-size: 0.9rem;
    box-sizing: border-box;
}

body.dark-theme #filter-expression {
    background-color: #2d2d44;
    color: #e0e0e0;
    border-color: #3a3a55;
}
