/* Text diff - two input areas, an options toolbar, and a live diff in either a
   side-by-side or unified view. Reuses base .btn-outline / .seg; all colors come
   from theme tokens (--good for additions, --bad for removals) so it tracks the
   light/dark theme. */

/* Inputs: side by side on wide screens, stacked on narrow. */
.td-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .td-panes { grid-template-columns: 1fr; } }

.td-pane { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.td-pane-label { font-size: 14px; color: var(--muted); font-weight: 600; }

.td-area {
    width: 100%; box-sizing: border-box; min-height: 200px; resize: vertical;
    font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
    font-size: 14px; line-height: 1.5; tab-size: 4; padding: 12px;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px;
    white-space: pre; overflow: auto;
}
.td-area:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* Options toolbar: case / whitespace / view controls plus swap + clear. */
.td-toolbar {
    display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
    margin: 16px 0; justify-content: space-between;
}
.td-control { display: flex; flex-direction: column; gap: 6px; }
.td-control-label { font-size: 14px; color: var(--muted); font-weight: 600; }
.td-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.td-stats {
    margin: 0 0 12px; color: var(--muted); font-size: 14px;
    font-variant-numeric: tabular-nums; min-height: 1.2em;
}

/* Diff surface shared by both views. */
.td-result:empty { display: none; }
.td-diff {
    font-family: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
    font-size: 14px; line-height: 1.5;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--surface); overflow: auto;
}

.td-line { white-space: pre-wrap; word-break: break-word; min-height: 1.5em; padding: 0 12px; }

/* Line-number gutter (side-by-side) and +/- sign (unified). */
.td-ln, .td-sign {
    color: var(--muted); text-align: right; padding: 0 8px; min-width: 0;
    font-variant-numeric: tabular-nums; user-select: none;
    border-right: 1px solid var(--border);
}
.td-sign { text-align: center; }

/* Side-by-side: gutter + content per side, kept aligned by one shared grid. */
.td-split { display: grid; grid-template-columns: auto 1fr auto 1fr; }
.td-split > .td-ln { white-space: nowrap; }

/* Unified: one column of signed lines. */
.td-uline { display: grid; grid-template-columns: auto 1fr; }

/* Row tinting. color-mix layers a faint wash of the status color over the
   surface so it reads in both themes; empty cells (the gap opposite an
   add/remove) get a neutral muted fill. */
.is-add { background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.is-remove { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.is-change { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.is-empty { background: color-mix(in srgb, var(--muted) 8%, var(--surface)); }
.td-ln.is-add, .td-ln.is-remove, .td-ln.is-change { color: var(--text); }

/* Word-level highlight inside a changed line. */
.td-mark-add, .td-mark-remove {
    border-radius: 4px; padding: 0 1px; color: inherit;
}
.td-mark-add { background: color-mix(in srgb, var(--good) 40%, transparent); }
.td-mark-remove { background: color-mix(in srgb, var(--bad) 40%, transparent); }
