/* 顶部工具栏样式 */
.top-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-toolbar .action-buttons {
    display: flex;
    gap: 10px;
}

.top-toolbar .format-options {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    border-radius: 6px;
}

.top-toolbar .format-options label {
    display: flex;
    align-items: center;
    margin: 0;
    font-weight: 500;
    color: #555;
}


.top-toolbar .format-options input[type="number"] {
    width: 70px;
    margin-left: 8px;
    padding: 6px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    transition: border-color 0.3s;
}

.top-toolbar .format-options input[type="number"]:focus {
    border-color: #4299e1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}


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

.tool-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
}

.tab-button {
    background-color: #f5f5f5;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    margin-right: 5px;
    border-radius: 6px 6px 0 0;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-button.active {
    background-color: #4299e1;
    color: white;
    font-weight: 600;
}

.tab-button:hover:not(.active) {
    background-color: #e6f7ff;
}


.io-container {
    flex: 1;
    display: flex;
    gap: 25px;
    min-height: 0;
}

.io-container .input-section,
.io-container .output-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

.input-section label,
.output-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}



#json-input:focus,
#json-output:focus {
    border-color: #4299e1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

#json-input {
    flex: 1;
    width: 100%;
    max-height: none; /* 移除最大高度限制 */
    padding: 15px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-family: 'Consolas', 'Courier New', monospace;
    resize: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    overflow-y: auto;
}

.output-header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.output-actions {
    display: flex;
    gap: 10px;
}

.output-header .left-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

#pretty .output-header label {
    margin-bottom: 0;
    font-weight: bold;
}

.output-header .ant-btn {
    position: absolute;
    top: -7px;
    right: 5px;
    padding: 6px 10px;
    font-size: 12px;
    background-color: #f0f0f0;
    border-color: #d9d9d9;
}

.ant-btn {
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.ant-btn:hover {
    background-color: #e6f7ff;
    border-color: #4299e1;
    color: #4299e1;
}

.ant-btn.primary {
    background-color: #4299e1;
    border-color: #4299e1;
    color: white;
}

.ant-btn.primary:hover {
    background-color: #40a9ff;
    border-color: #40a9ff;
}


/* 文本域样式 */
#pretty .input-section textarea,
#pretty .output-section #json-output-container {
    padding: 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    resize: vertical;
}

#pretty .output-section #json-output-container {
    background-color: #f9f9f9;
}

#pretty .input-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

#pretty .input-section textarea {
    background-color: #fff;
}


#pretty .toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

#pretty .format-options {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0px;
    border-radius: 4px;
}

#pretty .format-options label {
    display: flex;
    align-items: center;
    margin: 0;
}

#pretty .format-options input[type="number"] {
    width: 50px;
    margin-left: 5px;
    padding: 4px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
}



#pretty .output-section label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

#pretty .output-section textarea {
    width: 100%;
    min-height: 300px;
    padding: 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    background-color: #f9f9f9;
}

#pretty .error-message {
    margin-top: 15px;
    padding: 10px;
    background-color: #fff2f0;
    border: 1px solid #ffccc7;
    border-radius: 4px;
    color: #ff4d4f;
}



/* JSON高亮样式 */
.json-key {
    color: #003399;
    cursor: pointer;
    position: relative;
}

.json-key:hover {
    background-color: rgba(0, 102, 204, 0.1);
    border-radius: 2px;
}


.json-string {
    color: #008800; /* 绿色 */
}

.json-number {
    color: #ff6600; /* 橙红色 */
}

.json-boolean {
    color: #cc0099; /* 蓝色 */
}

.json-null {
    color: #9900cc; /* 粉色 */
}

.json-punctuation {
    color: #333; /* 黑色 */
}

/* 输出区域容器 */
#json-output-container {
    width: 100%;
    flex: 1; /* 使用弹性布局 */
    padding: 15px;
    min-height: 200px; /* 设置最小高度而非固定高度 */
    max-height: none; /* 移除最大高度限制 */
    height: auto; /* 自动高度 */
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background-color: #fafafa;
    font-family: 'Consolas', 'Courier New', monospace;
    overflow: auto;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    line-height: 1.4;
}


/* 可折叠区域样式 */
.json-line {
    display: block;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap !important; /* 改为 pre-wrap 支持自动换行 */
    word-wrap: break-word !important;
}

/* 控制折叠内容显示 */
.json-line[data-collapsible-parent] {
    display: block;
}


/* 可折叠区域样式 */
.collapsible {
    position: relative;
}

.toggle-btn {
    cursor: pointer;
    margin: 0 5px;
    user-select: none;
    color: #ff0000;
    transition: all 0.2s ease;
    width: 16px;
    text-align: center;
}

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

.collapsible .toggle-btn {
    cursor: pointer;
    margin: 0 4px;
    user-select: none;
    transition: transform 0.2s ease;
    vertical-align: middle;
}

.collapsible .collapsed-placeholder {
    color: #999;
    margin: 0 5px;
    display: none;
    font-style: italic;
}

.collapsible[data-collapsed="true"] .toggle-btn {
    transform: rotate(-90deg);
}

element.style {
    margin-right: 5px !important;
}

/* 当父级折叠时隐藏子元素 */
.collapsible[data-collapsed="true"] > .collapsible-children {
    display: none !important;
}

.collapsible[data-collapsed="true"] .collapsed-placeholder {
    display: inline !important;
}

/* 折叠提示文本样式 */
.collapsible .collapsed-placeholder {
    font-size: 0.9em;
}

/* 可点击的key样式 */
.clickable-key {
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

.clickable-key:hover {
    background-color: rgba(0, 51, 153, 0.1);
    border-radius: 2px;
}

.clickable-key:active {
    background-color: rgba(0, 51, 153, 0.2);
}
