/* style.css —— 补充样式（Tailwind 之外的少量增强） */

textarea {
  line-height: 1.6;
  tab-size: 2;
}

/* 左侧隐藏工具栏 */
.tool-dock {
  transform: translateY(-50%);
}

.tool-dock-panel {
  animation: toolDockIn 0.18s ease;
}

@keyframes toolDockIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* CodeMirror JSON 编辑器 */
.json-editor-shell {
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.json-editor-shell .CodeMirror {
  height: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #334155;
  border: 0;
}

.json-editor-shell .CodeMirror-gutters {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

.json-editor-shell .CodeMirror-linenumber {
  color: #94a3b8;
}

.json-editor-shell .CodeMirror-foldgutter {
  width: 1.1em;
}

.json-editor-shell .CodeMirror-foldgutter-open,
.json-editor-shell .CodeMirror-foldgutter-folded {
  color: #64748b;
  cursor: pointer;
}

.json-editor-shell .CodeMirror-selected {
  background: rgba(99, 102, 241, 0.18) !important;
}

.json-editor-shell .CodeMirror-focused .CodeMirror-selected {
  background: rgba(99, 102, 241, 0.24) !important;
}

.json-editor-shell .CodeMirror-matchingbracket {
  color: #4f46e5 !important;
  background: #eef2ff;
  font-weight: 700;
}

.json-editor-shell .CodeMirror-dialog {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  color: #475569;
  font-size: 12px;
  padding: 8px 10px;
}

.json-editor-shell .CodeMirror-dialog input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  outline: none;
}

.json-editor-shell .CodeMirror-dialog input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 1px #a5b4fc;
}

/* 滚动条美化 */
#diffResult::-webkit-scrollbar,
.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler,
.CodeMirror-vscrollbar::-webkit-scrollbar,
.CodeMirror-hscrollbar::-webkit-scrollbar,
textarea::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#diffResult::-webkit-scrollbar-thumb,
.CodeMirror-vscrollbar::-webkit-scrollbar-thumb,
.CodeMirror-hscrollbar::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
#diffResult::-webkit-scrollbar-thumb:hover,
.CodeMirror-vscrollbar::-webkit-scrollbar-thumb:hover,
.CodeMirror-hscrollbar::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 加载状态 */
.compare-spin {
  display: inline-block;
  animation: compareSpin 0.9s linear infinite;
}

@keyframes compareSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 差异节点 hover 高亮 */
.diff-node > div:hover {
  background-color: rgba(99, 102, 241, 0.04);
}

/* 折叠图标 */
.toggle-icon {
  transition: transform 0.15s ease;
  user-select: none;
}

.node-children {
  transition: all 0.2s ease;
}

/* 步骤导航：未激活的圆点默认底色（防止 JS 执行前无样式闪烁） */
.step-dot {
  background-color: #e2e8f0;
  color: #64748b;
}
.step-item:hover .step-dot {
  filter: brightness(0.97);
}
/* 步骤面板切换的淡入动画 */
.step-panel:not(.hidden) {
  animation: stepFade 0.25s ease;
}
@keyframes stepFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Git Diff 风格双栏对齐结果 */
.split-diff {
  min-width: 980px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}

.split-diff-header,
.split-diff-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.split-diff-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
}

.split-diff-header-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.split-diff-left-title {
  background: #ecfdf5;
  color: #047857;
}

.split-diff-right-title {
  background: #fff1f2;
  color: #be123c;
}

.split-diff-row {
  border-bottom: 1px solid #e2e8f0;
}

.split-diff-row:last-child {
  border-bottom: 0;
}

.split-diff-row:hover .split-diff-cell {
  background-image: linear-gradient(rgba(99, 102, 241, 0.05), rgba(99, 102, 241, 0.05));
}

.split-diff-cell {
  min-width: 0;
  padding: 0;
  border-right: 1px solid #e2e8f0;
  background: #ffffff;
}

.split-diff-cell:last-child {
  border-right: 0;
}

.split-diff-cell-parent {
  background: #ffffff;
}

.split-diff-cell-same {
  background: #f8fafc;
}

.split-diff-cell-old,
.split-diff-cell-removed {
  background: #ecfdf5;
}

.split-diff-cell-new,
.split-diff-cell-added {
  background: #fff1f2;
}

.split-diff-cell-empty {
  background: #f8fafc;
}

.split-diff-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
}

.split-diff-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
  line-height: 1.55;
  word-break: break-word;
}

.split-diff-content {
  min-width: 0;
  flex: 1 1 auto;
}

.split-diff-toggle,
.split-diff-toggle-placeholder {
  width: 16px;
  min-width: 16px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  color: #94a3b8;
}

.split-diff-toggle {
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}

.split-diff-toggle:hover {
  color: #4f46e5;
}

.split-diff-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
}

.split-diff-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  white-space: nowrap;
}

.split-diff-pre {
  margin-top: 6px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
  color: #475569;
}

.split-diff-empty-text {
  color: #cbd5e1;
  font-style: italic;
}

#fillDiffLeft .split-diff,
#fillDiffRight .split-diff {
  min-width: 900px;
}

/* 差异结果全屏态：对比选项栏 + 结果区一起铺满视口 */
#diffFullscreenWrap:fullscreen,
#diffFullscreenWrap.fs-active {
  width: 100vw;
  height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#diffFullscreenWrap.fs-active .fs-option-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.25);
}

#diffFullscreenWrap.fs-active #diffResult {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: auto;
  overflow: auto;
  padding: 24px;
  background: #ffffff;
}
