/* JSON 美化专用样式 */

/* 顶部工具栏：多组分段开关 */
.format-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-bottom: 20px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 分段开关容器 */
.seg-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  border-radius: 8px;
}

.seg-group .seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.seg-group .seg-btn:hover {
  color: var(--text);
}

.seg-group .seg-btn.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.seg-group .seg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 让主内容占满视口剩余高度 */
main.container {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding-bottom: 24px;
}

/* 左右分栏 */
.json-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.json-pane {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  min-height: 0;
}

/* 面板标题：徽章 + 标题 */
.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.pane-head .badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-soft-border);
}

.pane-head .badge.dst {
  background: var(--accent-2-soft);
  color: var(--accent-2);
  border: 1px solid var(--accent-2-soft);
}

.pane-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

/* 文本域右上角悬浮复制按钮：聚焦时显示 */
.field-input {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.field-input .copy-corner {
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.field-input:focus-within .copy-corner {
  opacity: 1;
  pointer-events: auto;
}

/* 纯图标按钮 */
.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* 输入文本域占满 pane 剩余高度；右侧预留复制按钮空间 */
.field-input textarea {
  display: block;
  flex: 1;
  min-height: 0;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 48px 12px 14px;
  resize: none;
}

/* 输出为只读，弱化背景以区分 */
.field-input textarea[readonly] {
  background: var(--code-bg);
}

/* 文本域容器占满面板剩余高度 */
.field-textarea {
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

/* 错误提示 */
.error-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--error);
  background: var(--error-soft);
  border: 1px solid var(--error-soft-border);
  border-radius: 8px;
  padding: 8px 12px;
  word-break: break-all;
}

/* 响应式：窄屏收拢为单栏 */
@media (max-width: 760px) {
  .json-grid {
    grid-template-columns: 1fr;
  }
}
