/* ================================================================
   SchergenDiff – Styles
   Gleiche Farbwelt wie die übrigen Werkzeuge.
   ================================================================ */

:root {
  --bg:            #0e1016;
  --surface:       rgba(255, 255, 255, .045);
  --surface-2:     rgba(255, 255, 255, .075);
  --line:          rgba(255, 255, 255, .10);
  --line-soft:     rgba(255, 255, 255, .06);
  --text:          #e8ebf2;
  --text-dim:      #98a1b5;
  --accent:        #7aa2ff;
  --accent-strong: #5b86ff;
  --ok:            #2fd68b;
  --warn:          #ffc861;
  --off:           #ff5468;
  --radius:        16px;
  --shadow:        0 18px 45px rgba(0, 0, 0, .45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  /* Farben der Gegenüberstellung */
  --add-bg:  rgba(47, 214, 139, .10);
  --add-ln:  rgba(47, 214, 139, .45);
  --del-bg:  rgba(255, 84, 104, .10);
  --del-ln:  rgba(255, 84, 104, .45);
  --mod-bg:  rgba(255, 200, 97, .09);
  --mod-ln:  rgba(255, 200, 97, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

kbd {
  font: inherit;
  font-size: .78em;
  font-weight: 600;
  padding: .1em .4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-dim);
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 700px at 12% -10%, #26304a 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #2a2140 0%, transparent 55%);
}

/* ----------------------------------------------------------------
   Buttons, Kopfzeile, Gerüst
   ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: .5rem .9rem;
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover  { background: var(--surface-2); border-color: rgba(255,255,255,.18); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: #0b1020;
  font-weight: 650;
}
.btn--primary:hover { filter: brightness(1.06); }
.btn--ghost { background: transparent; }
.btn--sm    { padding: .3rem .6rem; font-size: .84rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(14, 16, 22, .72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar__brand { display: flex; align-items: center; gap: .6rem; font-weight: 650; }
.topbar__logo  { font-size: 1.25rem; }
.topbar__right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.topbar__note  {
  color: var(--text-dim);
  font-size: .8rem;
  padding: .3rem .7rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(1.2rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem) 3rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem clamp(1rem, 2vw, 1.3rem) 1.2rem;
  margin-bottom: clamp(.9rem, 2vw, 1.2rem);
}
.card--input { box-shadow: var(--shadow); }
.card__head  { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .8rem; }
.card__title { font-size: 1.05rem; }

.hint { color: var(--text-dim); font-size: .82rem; }
.dim  { color: var(--text-dim); }

/* ----------------------------------------------------------------
   Eingabe
   ---------------------------------------------------------------- */
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.pane {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: .6rem;
  transition: border-color .15s, background .15s;
}
.pane.is-over { border-color: var(--accent); background: rgba(122, 162, 255, .08); }

.pane__head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .45rem; }
.pane__side {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.pane__name {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--accent);
  overflow-wrap: anywhere;
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  padding: .7rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .3);
  color: var(--text);
  font: inherit;
  font-family: var(--mono);
  font-size: .84rem;
  line-height: 1.55;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, .18);
}

/* Umgebrochene Eingabe: lange Zeilen bleiben im Feld sichtbar, statt
   waagerecht davonzulaufen. Ohne den Schalter bleibt es beim Rollen –
   das braucht, wer Spalten untereinander ausrichten will. */
.panes--wrap textarea {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}
textarea::placeholder { color: var(--text-dim); }

.options {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem 1.4rem;
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line-soft);
}
.check { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .88rem; }
.check input { accent-color: var(--accent); flex: none; }
.check em { font-style: normal; color: var(--text-dim); font-family: var(--mono); font-size: .88em; }

.actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.actions .hint { margin-left: auto; }

/* ----------------------------------------------------------------
   Zusammenfassung
   ---------------------------------------------------------------- */
#results[hidden] { display: none; }

.summary {
  border-radius: 12px;
  padding: .65rem 1rem;
  margin-bottom: clamp(.9rem, 2vw, 1.2rem);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: .92rem;
}
.summary--same { border-color: rgba(47,214,139,.45); background: rgba(47,214,139,.12); color: #8ae9bf; }
.summary--diff { border-color: rgba(255,200,97,.45); background: rgba(255,200,97,.12); color: #ffdca0; }
.summary .dim  { color: inherit; opacity: .7; }

.jump { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.jump__info {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--text-dim);
  min-width: 4.5ch;
  text-align: center;
}
.card__head .btn--ghost { margin-left: .3rem; }

.legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .7rem; font-size: .8rem; color: var(--text-dim); }
.legend__item { display: flex; align-items: center; gap: .4rem; }
.swatch { width: 13px; height: 13px; border-radius: 4px; border: 1px solid var(--line); }
.swatch--add { background: var(--add-bg); border-color: var(--add-ln); }
.swatch--del { background: var(--del-bg); border-color: var(--del-ln); }
.swatch--mod { background: var(--mod-bg); border-color: var(--mod-ln); }

/* ----------------------------------------------------------------
   Gegenüberstellung
   ---------------------------------------------------------------- */
.diff {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: auto;
  max-height: 70vh;
  font-family: var(--mono);
  font-size: .84rem;
  line-height: 1.6;
}

.row {
  display: grid;
  grid-template-columns: 4.5ch minmax(0, 1fr) 4.5ch minmax(0, 1fr);
  border-bottom: 1px solid var(--line-soft);
  min-width: max-content;
}
.row:last-child { border-bottom: 0; }

.cell__num {
  padding: .1rem .5rem;
  align-self: stretch;
  text-align: right;
  color: var(--text-dim);
  opacity: .6;
  background: rgba(0, 0, 0, .2);
  border-right: 1px solid var(--line-soft);
  user-select: none;
  font-variant-numeric: tabular-nums;
  position: sticky;
  left: 0;
}
.cell__text {
  padding: .1rem .7rem;
  white-space: pre;
  overflow-wrap: normal;
}
.row > .cell__num:nth-child(3) { border-left: 1px solid var(--line); position: static; }

/* Umgebrochene Darstellung: keine waagerechte Rollerei mehr.
   Beide Seiten einer Reihe wachsen gemeinsam, die Zuordnung bleibt. */
.diff--wrap .row { min-width: 0; }
.diff--wrap .cell__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.diff--wrap .cell__num { align-self: start; }

.row--same .cell__text { color: var(--text-dim); }

.row--mod { background: var(--mod-bg); }
.row--mod .cell__num { box-shadow: inset 2px 0 0 var(--mod-ln); }
.row--add { background: var(--add-bg); }
.row--add .cell__num { box-shadow: inset 2px 0 0 var(--add-ln); }
.row--del { background: var(--del-bg); }
.row--del .cell__num { box-shadow: inset 2px 0 0 var(--del-ln); }

.row.is-focus { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Feinvergleich innerhalb der Zeile */
/* Die Markierung muss sich klar vom Zeilenton abheben – sonst sieht es
   aus, als sei die ganze Zeile geändert. */
.mark {
  background: rgba(255, 200, 97, .42);
  color: #fff6e2;
  border-radius: 3px;
  padding: 0 .1em;
  box-shadow: 0 0 0 1px rgba(255, 200, 97, .5);
}
.row--add .mark { background: rgba(47, 214, 139, .28); color: #b6f2d6; }
.row--del .mark { background: rgba(255, 84, 104, .28); color: #ffd0d6; }

/* Zusammengeklappte Strecken */
.row--fold {
  grid-template-columns: 1fr;
  background: rgba(255, 255, 255, .02);
  min-width: 0;
}
.fold {
  width: 100%;
  background: none;
  border: 0;
  color: var(--text-dim);
  font: inherit;
  font-family: var(--mono);
  font-size: .8rem;
  padding: .3rem .7rem;
  text-align: left;
  cursor: pointer;
}
.fold:hover { color: var(--accent); background: rgba(122, 162, 255, .07); }

/* ----------------------------------------------------------------
   Fußzeile und Meldung
   ---------------------------------------------------------------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  color: var(--text-dim);
  font-size: .8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}
.foot__sep { opacity: .5; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 140%);
  background: #1c2130;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .6rem 1rem;
  font-size: .87rem;
  box-shadow: var(--shadow);
  transition: transform .25s ease, opacity .25s;
  opacity: 0;
  z-index: 60;
  max-width: min(90vw, 460px);
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { border-color: rgba(255, 84, 104, .5); color: #ffc3ca; }

@media (max-width: 860px) {
  .panes { grid-template-columns: 1fr; }
  .row { grid-template-columns: 4ch minmax(0, 1fr) 4ch minmax(0, 1fr); font-size: .78rem; }
  .topbar__note, .actions .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
