/* ==========================================================================
   tool-code-format.css — 代码格式化 (tool-code-format) 专属样式
   结构: 顶部选项行(语言 / 识别结果 / 缩进) -> 输入框 -> [格式化 | 清空]
         -> 错误提示 -> 结果区(统计 + 输出框 + 复制)
   ★ 颜色 / 圆角 / 阴影一律用 common.css 的 CSS 变量, 不写死色值。
   ========================================================================== */

.cf-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

/* ---------- 顶部选项行 ---------- */
.cf-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.cf-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cf-label {
  font-size: 12.5px;
  color: var(--text-muted);
}
.cf-select {
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}
.cf-select:focus { border-color: var(--brand); }

/* 自动识别结果 */
.cf-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12.5px;
  line-height: 1.6;
}
.cf-badge[hidden] { display: none; }

/* ---------- 输入 / 输出 ---------- */
.cf-input,
.cf-output {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.6;
  tab-size: 4;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.cf-input { min-height: 190px; }
.cf-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cf-input::placeholder,
.cf-output::placeholder { color: var(--text-muted); }

/* ★ 结果窗口高度 = 输入框的 3 倍 (190px -> 570px):
   格式化后的代码通常比输入长, 窗口矮了要一直滚, 看不清整体结构。 */
.cf-output {
  min-height: 570px;
  padding-right: 96px;
  background: #FCFDFF;
  white-space: pre;
  overflow: auto;
}
.cf-output:focus { border-color: var(--brand); }

/* ---------- 操作行 ---------- */
.cf-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cf-actions .cf-clear { margin-left: auto; }
.cf-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- 错误提示 ---------- */
.cf-error {
  padding: 10px 12px;
  border: 1px solid #F6C9C5;
  border-radius: var(--radius);
  background: #FFF6F5;
  color: #B42318;
  font-size: 13px;
  line-height: 1.6;
}
.cf-error[hidden] { display: none; }

/* ---------- 结果区 ---------- */
.cf-out { display: flex; flex-direction: column; gap: 8px; }
.cf-out-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.cf-stats { font-size: 12.5px; color: var(--text-muted); }
.cf-out-box { position: relative; }
.cf-copy { position: absolute; top: 8px; right: 8px; font-size: 12.5px; }

/* ---------- 窄屏 ---------- */
@media (max-width: 640px) {
  .cf-wrap { padding: 14px; }
  .cf-actions .cf-clear { margin-left: 0; }
  .cf-out-box { display: flex; flex-direction: column; }
  .cf-output { padding-right: 14px; }
  .cf-copy { position: static; align-self: flex-end; margin-top: 8px; }
}
