* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    padding: 10px;
    background-color: #f5f5f7;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.json-formatter {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: 95vh;
    display: flex;
    flex-direction: column;
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    min-height: 36px;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
}

.search-input-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-row, .replace-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

#searchInput, #replaceInput {
    padding: 4px 8px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-size: 13px;
    width: 200px;
    height: 28px;
}

#searchInput:focus, #replaceInput:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.2);
}

#searchCount {
    color: #86868b;
    font-size: 12px;
    min-width: 60px;
}

.case-sensitive {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #86868b;
    font-size: 13px;
    cursor: pointer;
}

.case-sensitive input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* 高亮搜索结果 */
.search-highlight {
    background-color: #e4e4e4;
    color: #000000;
    border-radius: 2px;
}

/* 当前选中的搜索结果 */
.search-highlight-current {
    background-color: #ffeb3b;
    color: #000000;
    border-radius: 2px;
}

.editor {
    flex: 1;
    min-height: 0;
    position: relative;
    background: white;
    border-radius: 8px;
    border: 1px solid #d2d2d7;
    overflow: hidden;
}

.editor-wrapper {
    position: relative;
    height: 100%;
    display: flex;
}

.line-numbers {
    height: 100%;
    padding: 0 4px;
    background-color: #f8f9fa;
    border-right: 1px solid #e4e4e4;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    color: #6e7681;
    text-align: right;
    user-select: none;
    width: 70px;
    white-space: pre-wrap;
    overflow: hidden;
    display: flex;
}

.line-numbers-content {
    padding: 12px 4px;
    flex: 1;
}

/* 创建一个容器来包裹文本区域和高亮区域 */
.text-wrapper {
    position: relative;
    flex: 1;
    height: 100%;
}

textarea, #highlighting {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 12px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre;
    overflow: auto;
    box-sizing: border-box;
    border: none;
    tab-size: 4;
    -moz-tab-size: 4;
}

textarea {
    border-radius: 8px;
    resize: none;
    background: transparent;
    color: transparent;
    caret-color: black;
    z-index: 1;
}

textarea:focus {
    outline: none;
}

#highlighting {
    background: transparent;
    z-index: 2;
    pointer-events: none;
}

/* 语法高亮样式 */
.string { 
    color: #28a745; /* 字符串使用绿色 */
}
.number { 
    color: #0071e3; /* 数字使用蓝色 */
}
.boolean { 
    color: #9c27b0; /* 布尔值使用紫色 */
}
.null { 
    color: #e83e8c; /* null使用粉色 */
}
.key { 
    color: #d63384; /* 键名使用深粉色 */
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f5f5f7;
    color: #1d1d1f;
}

button:hover {
    opacity: 0.9;
    background-color: #e4e4e4;
}

#formatBtn {
    padding: 10px 20px;
    background-color: #f5f5f7;
}

.error-message {
    color: #ff3b30;
    margin-bottom: 10px;
    display: none;
}

@media (max-width: 768px) {
    .json-formatter {
        min-height: auto;
    }
    
    .editor-content {
        min-height: 300px;
        max-height: 300px;
    }
}

/* 修改滚动条样式 */
.editor-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.editor-wrapper::-webkit-scrollbar-thumb {
    background: #d1d1d1;
    border-radius: 5px;
}

.editor-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

#replaceAllBtn {
    padding: 4px 8px;
    font-size: 13px;
    background-color: #f5f5f7;
    height: 28px;
}

#replaceBtn {
    padding: 4px 8px;
    font-size: 13px;
    background-color: #f5f5f7;
    height: 28px;
}

/* 折叠按钮样式 */
.fold-button {
    display: inline-block;
    width: 20px;
    cursor: pointer;
    user-select: none;
    color: #666;
    position: relative;
    z-index: 3;
}

.fold-button:hover {
    color: #000;
}

/* 括号样式 */
.bracket {
    color: #666;
}

/* 逗号样式 */
.comma {
    color: #666;
}

/* 修改折叠块样式 */
.block-start {
    display: inline;
}

.block-content[style*="display: none"] ~ .block-ellipsis {
    display: inline !important;
}

.block-ellipsis {
    color: #666;
    margin: 0 2px;
    font-style: italic;
}

/* 确保折叠按钮可点击 */
#highlighting .fold-button {
    pointer-events: auto;
}

#foldAllBtn {
    display: none; /* 隐藏折叠按钮 */
}

/* 添加按钮激活状态的样式 */
button.active {
    background-color: #0071e3 !important; /* 使用苹果风格的蓝色 */
    color: white !important;
}

/* 确保激活状态的hover效果也合适 */
button.active:hover {
    background-color: #0077ED !important; /* 稍微亮一点的蓝色 */
    opacity: 1;
} 