/* Text compare: only what the shared tools.css does not cover */

/* ---------- Editors ---------- */
.editors {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .editors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.editor-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.editor-head .card-title {
  margin-bottom: 0;
}

.editor {
  min-height: 12rem;
  line-height: 1.75;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (min-width: 900px) {
  .editor {
    min-height: 16rem;
  }
}

/* ---------- Result header ---------- */
.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.result-head .card-title {
  margin-bottom: 0;
}

.view-toggle {
  min-width: 12rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-box {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 0.25rem;
}

.legend-box--added {
  background: var(--success);
}

.legend-box--removed {
  background: var(--danger);
}

.legend-box--modified {
  background: var(--warning);
}

/* ---------- Diff ---------- */
.diff-view {
  display: grid;
  gap: 0.75rem;
}

/* Which panels are visible depends on the chosen view */
.diff-view[data-view="split"] .diff-panel--unified,
.diff-view[data-view="unified"] .diff-panel--left,
.diff-view[data-view="unified"] .diff-panel--right {
  display: none;
}

@media (min-width: 900px) {
  .diff-view[data-view="split"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.diff-panel {
  min-width: 0;
}

.diff-title {
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
}

.diff-content {
  max-height: 70dvh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.9375rem;
}

.diff-line {
  display: grid;
  grid-template-columns: 2.75rem 1.25rem minmax(0, 1fr);
  align-items: start;
  min-height: 1.9rem;
  direction: ltr;
  border-inline-start: 3px solid transparent;
}

.diff-no,
.diff-sign {
  padding: 0.2rem 0.25rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.7;
  text-align: center;
  user-select: none;
}

.diff-text {
  padding: 0.2rem 0.5rem;
  line-height: 1.7;
  text-align: start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.diff-line--added {
  border-color: var(--success);
  background: var(--success-soft);
}

.diff-line--removed {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.diff-line--modified {
  border-color: var(--warning);
  background: var(--warning-soft);
}

.diff-line--empty {
  background: repeating-linear-gradient(
    135deg,
    transparent 0 6px,
    var(--surface-3) 6px 7px
  );
  opacity: 0.6;
}

.diff-line mark {
  padding: 0.05rem 0.15rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, currentColor 22%, transparent);
  color: inherit;
}

.diff-line--added .diff-sign {
  color: var(--success);
}

.diff-line--removed .diff-sign {
  color: var(--danger);
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
}

.stat-value--added {
  color: var(--success);
}

.stat-value--removed {
  color: var(--danger);
}

.stat-value--modified {
  color: var(--warning);
}

.stat-label {
  color: var(--muted);
  font-size: 0.8125rem;
}
