.jsonRenderer {
  width: 100%;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  font-size: 13px;
  line-height: 1.6;
  background-color: #f8f9fa;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  padding: 16px;
  margin: 8px 0;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  word-wrap: break-word;
  word-break: break-all;

  &:hover {
    border-color: #d0d7de;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  }
}

.copyAllButton {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease;

  .jsonRenderer:hover & {
    opacity: 1;
  }

  .@{antPrefix}-btn {
    padding: 4px 8px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #6a737d;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

    &:hover {
      background: #fff;
      color: #24292e;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }
  }
}

.jsonObject,
.jsonArray {
  position: relative;
  margin: 4px 0;
}

.objectHeader,
.arrayHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.objectContent,
.arrayContent {
  margin-left: 32px; // 调整内容缩进，为按钮预留空间
  border-left: 2px solid #e1e4e8;
  padding-left: 12px;
  position: relative;
}

.objectFooter,
.arrayFooter {
  margin-top: 4px;
  margin-left: 28px; // 与开始括号对齐（20px按钮宽度 + 8px间距）
  display: flex;
  align-items: center;
}

.objectItem,
.arrayItem {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0;
  padding: 2px 0;
  min-height: 24px;
  width: 100%;
  box-sizing: border-box;

  &:hover {
    background-color: #f6f8fa;
    border-radius: 4px;
  }
}

.valueContainer {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  position: relative;
  padding-right: 24px; // 为悬停的复制按钮预留空间
  min-width: 0; // 允许flex项目收缩
  overflow: hidden; // 防止内容溢出
}

.jsonValue {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0; // 允许flex项目收缩
  position: relative;
  overflow: hidden; // 防止内容溢出
}

.typeIcon {
  color: #6a737d;
  font-size: 12px;
  flex-shrink: 0;
}

.objectKey {
  color: #032f62;
  font-weight: 500;
  flex-shrink: 0;
  min-width: 0;
  word-break: break-all;
  white-space: normal;
  overflow-wrap: break-word;
}

.arrayIndex {
  color: #6a737d;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  min-width: 40px;
}

.colon {
  color: #24292e;
  font-weight: bold;
  flex-shrink: 0;
}

.comma {
  color: #24292e;
  font-weight: bold;
  margin-left: 4px;
  flex-shrink: 0;
}

.brace,
.bracket {
  color: #24292e;
  font-weight: bold;
  font-size: 14px;
}

.objectInfo,
.arrayInfo {
  color: #6a737d;
  font-size: 12px;
  font-style: italic;
  margin-left: 8px;
}

.emptyObject,
.emptyArray {
  color: #6a737d;
  font-style: italic;
  font-size: 12px;
}

// 值类型样式
.stringValue {
  color: #032f62;
  background-color: #f1f8ff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #dbeafe;
  word-break: break-all;
  white-space: normal;
  overflow-wrap: break-word;
}

.numberValue {
  color: #005cc5;
  font-weight: 500;
  background-color: #f0f8ff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
}

.booleanValue {
  color: #d73a49;
  font-weight: bold;
  background-color: #fef2f2;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #fecaca;
}

.nullValue {
  color: #6a737d;
  font-style: italic;
  background-color: #f6f8fa;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #d0d7de;
}

.undefinedValue {
  color: #6a737d;
  font-style: italic;
  background-color: #f6f8fa;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #d0d7de;
}

.unknownValue {
  color: #e36209;
  background-color: #fff8f0;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #fed7aa;
}

// 按钮样式
.expandButton {
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #6a737d;

  &:hover {
    background-color: #f6f8fa;
    color: #24292e;
  }
}

.copyButton {
  position: absolute;
  right: -24px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #6a737d;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;

  .jsonValue:hover &,
  .objectHeader:hover &,
  .arrayHeader:hover & {
    opacity: 1;
  }

  &:hover {
    background-color: #f6f8fa;
    color: #24292e;
  }
}

// 响应式设计
@media (max-width: 768px) {
  .jsonRenderer {
    font-size: 12px;
    padding: 12px;
  }

  .objectContent,
  .arrayContent {
    margin-left: 16px;
    padding-left: 8px;
  }

  .objectItem,
  .arrayItem {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .arrayIndex {
    min-width: auto;
  }
}

// // 深色主题支持
// @media (prefers-color-scheme: dark) {
//   .jsonRenderer {
//     background-color: #0d1117;
//     border-color: #30363d;
//     color: #c9d1d9;
//   }

//   .objectContent,
//   .arrayContent {
//     border-left-color: #30363d;
//   }

//   .objectItem:hover,
//   .arrayItem:hover {
//     background-color: #161b22;
//   }

//   .stringValue {
//     background-color: #0d1117;
//     border-color: #30363d;
//     color: #58a6ff;
//   }

//   .numberValue {
//     background-color: #0d1117;
//     border-color: #30363d;
//     color: #79c0ff;
//   }

//   .booleanValue {
//     background-color: #0d1117;
//     border-color: #30363d;
//     color: #ff7b72;
//   }

//   .nullValue,
//   .undefinedValue {
//     background-color: #161b22;
//     border-color: #30363d;
//     color: #8b949e;
//   }

//   .unknownValue {
//     background-color: #0d1117;
//     border-color: #30363d;
//     color: #ffa657;
//   }

//   .expandButton:hover,
//   .copyButton:hover {
//     background-color: #161b22;
//     color: #c9d1d9;
//   }
// }
