body {
  font-family: Arial, sans-serif;
  margin: 20px;
  background: #f4f4f4;
  overflow-x: hidden;
}
.container {
  max-width: 1200px;
  margin: auto;
}
h1 {
  text-align: center;
  color: #333;
}
.tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #ccc;
  flex-wrap: wrap;
}
.tab-button {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  border-bottom: 3px solid transparent;
  color: black;
  font-weight: normal;
  white-space: nowrap;
}
.tab-button.active {
  border-bottom-color: #007cba;
  color: #007cba;
  font-weight: bold;
}
.tab-content {
  display: none;
  background: white;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 5px;
  margin-top: 10px;
  overflow: hidden;
}
.tab-content.active {
  display: block;
}

textarea {
  width: 100%;
  padding: 10px;
  font-family: monospace;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
  max-height: 300px;
  min-height: 100px;
}
.control-group {
  margin: 15px 0;
}
label {
  display: inline-block;
  width: 120px;
  font-weight: bold;
  margin-bottom: 5px;
}
input[type="text"] {
  padding: 5px 10px;
  margin: 0 10px;
  font-size: 14px;
  border: 1px solid #aaa;
  border-radius: 3px;
  width: 200px;
  box-sizing: border-box;
}
button {
  padding: 8px 16px;
  margin: 5px;
  font-size: 14px;
  cursor: pointer;
  background: #007cba;
  color: white;
  border: none;
  border-radius: 4px;
  transition: background-color 0.2s;
}
button:hover {
  background: #005a87;
}
button:disabled {
  background: #ccc;
  cursor: not-allowed;
}
#result, #arrayResult, #jsonParseResult {
  margin-top: 20px;
  padding: 15px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: monospace;
  font-size: 14px;
  white-space: pre-wrap;
  min-height: 100px;
  max-height: 500px;
  overflow: auto;
  word-break: break-word;
}
#copyJsonButton {
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  margin-bottom: 10px;
  display: none;
}
#copyJsonButton:hover {
  background: #218838;
}
.json-parser-layout {
  display: flex;
  gap: 20px;
  min-height: 500px;
  flex-wrap: nowrap;
}
.json-parser-left, .json-parser-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 350px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.json-parser-left h3, .json-parser-right h3 {
  margin-top: 0;
}
.json-parser-left p {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}
#jsonParserInput {
  flex: 1;
  padding: 12px;
  font-family: monospace;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  resize: none;
  min-height: 250px;
  box-sizing: border-box;
  background: #fafafa;
}
#jsonParserInput:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0,124,186,0.2);
}
.beian {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-top: 30px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}
.beian a {
  color: #999;
  text-decoration: none;
}
.beian a:hover {
  text-decoration: underline;
}

/* 表格相关样式 */
.table-controls {
  margin: 10px 0;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.table-controls select {
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 3px;
}
.virtual-table-container {
  max-height: 600px;
  overflow: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin: 10px 0;
}
.virtual-table-container table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.virtual-table-container th,
.virtual-table-container td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
  word-wrap: break-word;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.virtual-table-container th {
  background: #f0f0f0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.virtual-table-container tr:nth-child(even) {
  background: #f9f9f9;
}
.virtual-table-container tr:hover {
  background: #f0f8ff;
}
.pagination {
  display: flex;
  justify-content: center;
  margin: 15px 0;
  gap: 5px;
  flex-wrap: wrap;
}
.pagination button {
  padding: 5px 10px;
  font-size: 12px;
  min-width: 30px;
}
.pagination button.active {
  background: #005a87;
  font-weight: bold;
}

.json-result-container {
  max-height: 400px;
  overflow: auto;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  body {
    margin: 10px;
  }
  .tabs {
    flex-direction: column;
  }
  .tab-button {
    width: 100%;
    text-align: center;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  .tab-button.active {
    border-left-color: #007cba;
    border-bottom: none;
  }
  .json-comparison-layout {
    flex-direction: column;
    gap: 15px;
  }
  .json-parser-layout {
    flex-direction: column;
    gap: 15px;
  }
  .json-parser-left, .json-parser-right {
    min-width: auto;
    padding: 15px;
  }
  .json-parser-left, .json-parser-right {
    min-width: auto;
  }
  textarea {
    font-size: 16px; /* 移动端字体放大 */
  }
}

/* 加载状态 */
.loading {
  opacity: 0.6;
  pointer-events: none;
}
.loading::after {
  content: " ⏳";
}

/* 性能警告 */
.performance-warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 10px;
  border-radius: 4px;
  margin: 10px 0;
  font-size: 14px;
}

/* 大数据量提示 */
.large-data-warning {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
  padding: 10px;
  border-radius: 4px;
  margin: 10px 0;
  font-size: 14px;
}

/* 滚动条样式 */
::-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: #a8a8a8;
}

/* JSON 对比布局样式 */
.json-comparison-layout {
  display: flex;
  gap: 20px;
  margin: 15px 0;
}
.json-comparison-left, .json-comparison-right {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.json-comparison-left textarea, .json-comparison-right textarea {
  flex: 1;
  padding: 12px;
  font-family: monospace;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  resize: none;
  min-height: 250px;
  box-sizing: border-box;
  background: #fafafa;
}
.json-comparison-left textarea:focus, .json-comparison-right textarea:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0,124,186,0.2);
}

/* JSON 树形查看器样式 */
.tree-controls {
  margin: 15px 0;
}

.tree-controls label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.tree-controls textarea {
  min-height: 120px;
  font-family: monospace;
}

.tree-search-controls {
  margin: 15px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 5px;
  border: 1px solid #e9ecef;
}

.tree-search-controls input {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
}

.tree-search-controls button {
  margin: 5px;
}

.tree-container {
  flex: 1;
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fafafa;
  overflow: auto;
  font-family: monospace;
  font-size: 13px;
  min-height: 300px;
  margin-top: 0;
}

.tree-message {
  color: #6c757d;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.tree-node {
  padding: 4px 8px;
  margin: 2px 0;
  border-radius: 3px;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  position: relative;
}

/* 层级连接线 */
.tree-node::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 12px;
  height: 1px;
  background: #dee2e6;
  transform: translateY(-50%);
}

/* 根节点不显示连接线 */
.tree-node[style*="padding-left: 0px"]::before {
  display: none;
}

/* 子节点连接线 */
.tree-node:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 100%;
  background: #dee2e6;
  transform: translateY(-50%);
}

.tree-node:hover {
  background-color: #f8f9fa;
}

.node-toggle {
  cursor: pointer;
  font-weight: bold;
  color: #495057;
  min-width: 16px;
  text-align: center;
  user-select: none;
}

.node-key {
  font-weight: bold;
  color: #22863a;
}

.node-value-type {
  color: #6f42c1;
  font-size: 11px;
  background: #f1f3f4;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
}

.node-value {
  color: #e36209;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-path {
  color: #6c757d;
  font-size: 11px;
  margin-left: auto;
  opacity: 0.7;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-match-badge {
  color: #dc3545;
  font-weight: bold;
  margin-left: 8px;
}

/* 搜索高亮样式 */
.tree-node[data-search-match="true"] {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
}

/* 响应式调整 */
@media (max-width: 1024px) {
  .tree-node {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  
  .node-path {
    margin-left: 0;
    max-width: 100%;
  }
  
  .tree-search-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  .tree-search-controls input {
    width: 100%;
    margin-bottom: 10px;
  }
}