.workspace-format .format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px 0 12px;
}

@media (max-width: 900px) {
  .workspace-format .format-grid {
    grid-template-columns: 1fr;
  }
}

.json-input {
  min-height: 360px;
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
}

.panel-actions {
  display: flex;
  gap: 6px;
}

.btn-tiny {
  padding: 2px 10px;
  font-size: 12px;
  border: 1px solid #e5e6eb;
  border-radius: 4px;
  background: #fff;
  color: #4e5969;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tiny:hover {
  border-color: #165DFF;
  color: #165DFF;
  background: #f0f5ff;
}

.input-status {
  margin-top: 8px;
  font-size: 12px;
  min-height: 20px;
}

.input-status.status-ok {
  color: #00B42A;
}

.input-status.status-error {
  color: #F53F3F;
}

.output-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e6eb;
  margin-bottom: 12px;
}

.output-tab {
  padding: 8px 16px;
  font-size: 13px;
  color: #86909c;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.output-tab:hover {
  color: #165DFF;
}

.output-tab.active {
  color: #165DFF;
  border-bottom-color: #165DFF;
  font-weight: 500;
}

.output-content {
  position: relative;
}

.output-view {
  display: none;
}

.output-view.active {
  display: block;
}

.json-output {
  background: #f7f8fa;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  padding: 16px;
  font-size: 13px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  line-height: 1.6;
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre;
  margin: 0;
  color: #1d2129;
}

#json-minified {
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: break-word;
  position: relative;
}

#json-minified::after {
  content: attr(data-length);
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: #86909c;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
}

.json-output .json-key {
  color: #0A6EBE;
}

.json-output .json-string {
  color: #00B42A;
}

.json-output .json-number {
  color: #F77234;
}

.json-output .json-boolean {
  color: #722ED1;
}

.json-output .json-null {
  color: #86909c;
}

.output-empty {
  text-align: center;
  padding: 60px 20px;
  color: #86909c;
}

.output-empty p {
  margin-top: 12px;
  font-size: 14px;
}

.format-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 0 48px;
  flex-wrap: wrap;
}

.indent-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #4e5969;
}

.indent-group label {
  white-space: nowrap;
  min-width: fit-content;
}

.indent-group select {
  padding: 4px 8px;
  border: 1px solid #e5e6eb;
  border-radius: 6px;
  font-size: 13px;
  color: #1d2129;
  background: #fff;
  cursor: pointer;
}

.sort-group {
  font-size: 13px;
}

.json-tree {
  background: #f7f8fa;
  border: 1px solid #e5e6eb;
  border-radius: 8px;
  padding: 12px 16px;
  max-height: 500px;
  overflow-y: auto;
  font-size: 13px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  line-height: 1.8;
}

.tree-node {
  padding-left: 20px;
}

.tree-toggle {
  display: inline-block;
  width: 16px;
  height: 16px;
  cursor: pointer;
  user-select: none;
  text-align: center;
  line-height: 16px;
  font-size: 10px;
  color: #86909c;
  margin-right: 4px;
  vertical-align: middle;
}

.tree-toggle:hover {
  color: #165DFF;
}

.tree-key {
  color: #0A6EBE;
}

.tree-colon {
  color: #86909c;
}

.tree-value-string {
  color: #00B42A;
}

.tree-value-number {
  color: #F77234;
}

.tree-value-boolean {
  color: #722ED1;
}

.tree-value-null {
  color: #86909c;
}

.tree-bracket {
  color: #86909c;
}

.tree-count {
  color: #c9cdd4;
  font-size: 12px;
  margin-left: 4px;
}

.tree-node.collapsed > .tree-children {
  display: none;
}

.mode-tabs {
  display: flex;
  gap: 0;
  padding-top: 24px;
  border-bottom: 2px solid #e5e6eb;
}

.mode-tab {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  color: #86909c;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab:hover {
  color: #165DFF;
}

.mode-tab.active {
  color: #165DFF;
  border-bottom-color: #165DFF;
}

.btn-fullscreen {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #4e5969;
  background: none;
  border: 1px solid #e5e6eb;
  border-radius: 0 0 6px 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: -2px;
}

.btn-fullscreen:hover {
  color: #165DFF;
  border-color: #165DFF;
  background: #f0f5ff;
}

.btn-fullscreen svg {
  flex-shrink: 0;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px 0 16px;
}

@media (max-width: 900px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
}

.compare-col .json-input {
  min-height: 200px;
}

.compare-actions {
  text-align: center;
  padding-bottom: 16px;
}

.compare-result-panel {
  margin-bottom: 48px;
}

.diff-legend {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

.diff-legend-item {
  padding: 2px 8px;
  border-radius: 4px;
}

.diff-legend-item.diff-add {
  background: #e8ffea;
  color: #00B42A;
}

.diff-legend-item.diff-remove {
  background: #ffe8e8;
  color: #F53F3F;
}

.diff-legend-item.diff-change {
  background: #fff7e8;
  color: #FF7D00;
}

.diff-legend-item.diff-same {
  background: #f2f3f5;
  color: #86909c;
}

.diff-stats {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #f2f3f5;
  margin-bottom: 12px;
}

.diff-output {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-line {
  padding: 2px 8px;
  min-height: 22px;
}

.diff-line.diff-line-add {
  background: #e8ffea;
  color: #1d2129;
}

.diff-line.diff-line-remove {
  background: #ffe8e8;
  color: #1d2129;
}

.diff-line.diff-line-change {
  background: #fff7e8;
  color: #1d2129;
}

.diff-line-prefix {
  display: inline-block;
  width: 20px;
  font-weight: 600;
}

@media (max-width: 600px) {
  .mode-tabs { padding-top: 16px; }
  .mode-tab { padding: 10px 16px; font-size: 14px; }
  .json-input { min-height: 200px; }
  .format-actions { padding: 8px 0 32px; }
  .btn-fullscreen span { display: none; }
  .btn-fullscreen { padding: 8px 12px; }
}

/* 全屏模式样式 */
.tool-workspace.fullscreen-mode {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: #fff;
  margin: 0;
  padding: 20px;
  overflow-y: auto;
}

.tool-workspace.fullscreen-mode .container {
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tool-workspace.fullscreen-mode .format-grid,
.tool-workspace.fullscreen-mode .compare-grid {
  flex: 1;
  min-height: 0;
}

.tool-workspace.fullscreen-mode .format-left,
.tool-workspace.fullscreen-mode .format-right,
.tool-workspace.fullscreen-mode .compare-col {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.tool-workspace.fullscreen-mode .panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tool-workspace.fullscreen-mode .tool-input-area {
  flex: 1;
  min-height: 300px;
  resize: vertical;
}

.tool-workspace.fullscreen-mode .output-content {
  flex: 1;
  overflow: auto;
  min-height: 200px;
}

.tool-workspace.fullscreen-mode .json-output,
.tool-workspace.fullscreen-mode .json-tree {
  min-height: 100%;
}

.tool-workspace.fullscreen-mode #json-minified {
  min-height: auto;
  max-height: none;
}

.tool-workspace.fullscreen-mode #json-minified::after {
  background: rgba(247, 248, 250, 0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.tool-workspace.fullscreen-mode .btn-fullscreen svg {
  transform: rotate(180deg);
}

.tool-workspace.fullscreen-mode .format-actions {
  padding-bottom: 20px;
}

/* 全屏模式下隐藏不必要的元素 */
.tool-workspace.fullscreen-mode ~ .tool-security,
.tool-workspace.fullscreen-mode ~ .tool-related {
  display: none;
}