/* chat (docs/16) — eigene Datei, damit die Bausteine sich nicht in app.css ins Gehege kommen.

   Der Chat sitzt im Dock unter der Karte, und das ist niedrig (150 px samt Reitern).
   Deshalb: links eine schmale Spalte mit den Kanälen, rechts Verlauf und Eingabe;
   jede Nachricht eine Zeile, 13 px. Knöpfe an Nachrichten erscheinen erst beim
   Überfahren — klein, als schwebende Leiste, damit der Text Platz behält. */

.chat-panel {
  flex: 1; min-height: 0; display: flex; position: relative;
  font-family: var(--font); font-size: 13px; line-height: 1.35; color: var(--text);
}

/* ── Kanäle ─────────────────────────────────────────────────────────────── */

.chat-kanaele {
  width: 118px; flex-shrink: 0; display: flex; flex-direction: column; gap: 1px;
  padding: 4px 6px; border-right: 1px solid var(--line); overflow-y: auto;
}
.chat-kanal {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  min-height: 20px; padding: 0 7px; border: 0; border-radius: 5px; background: transparent;
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer;
}
.chat-kanal:hover { background: var(--panel-2); color: var(--text); }
.chat-kanal.an { background: var(--line); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.chat-kanal:focus-visible { outline: 2px solid var(--blau); outline-offset: -2px; }
.chat-kanal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-zahl {
  flex-shrink: 0; min-width: 16px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: #7cc4ff; color: var(--bg); font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.chat-verbindet { padding: 3px 4px; }

/* ── Verlauf ────────────────────────────────────────────────────────────── */

.chat-haupt { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

/* Angepinnt: eine Zeile, aufklappbar, und wegklickbar — im Dock zählt jede Zeile. */
.chat-pin {
  display: flex; align-items: center; gap: 2px; margin: 4px 8px 0; padding: 0 1px 0 0; min-height: 20px;
  border-radius: 6px; background: #122338; border: 1px solid #1f3a5c;
}
.chat-pin-text {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 1px 8px; border: 0;
  background: transparent; color: #cfe3f7; font: inherit; font-size: 12px; text-align: left; cursor: pointer;
}
.chat-pin-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pin.offen .chat-pin-text span { white-space: normal; }
.chat-pin .chat-svg, .chat-eingabe > .chat-ico .chat-svg { width: 13px; height: 13px; flex-shrink: 0; color: #6cb4ff; }

/* „Ignoriert · 2“ unten in der Kanalspalte: ihre Nachrichten sind unsichtbar, also
   geht das Zurücknehmen nur hier. */
.chat-ignoriert {
  margin-top: auto; display: flex; align-items: center; gap: 5px; min-height: 18px; padding: 0 7px;
  border: 0; border-radius: 5px; background: transparent; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer;
}
.chat-ignoriert:hover { background: var(--panel-2); color: var(--text); }
.chat-ignoriert .chat-svg { width: 12px; height: 12px; flex-shrink: 0; }
.chat-ignorierliste { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chat-ignorierliste li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.chat-hinweis {
  display: flex; align-items: center; gap: 6px; margin: 4px 8px 0; padding: 1px 2px 1px 8px;
  border-radius: 6px; background: #12291f; border: 1px solid #1f4a37; color: #bdebd4; font-size: 12px;
}
.chat-hinweis span { flex: 1; min-width: 0; }

/* Umgekehrt gestapelt: das neueste Element steht im Markup zuerst und unten auf
   dem Schirm, die Rolle beginnt unten und bleibt dort, wenn Neues kommt. */
.chat-liste {
  flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column-reverse;
  padding: 2px 6px;
}
.chat-msg {
  position: relative; display: flex; gap: 8px; align-items: baseline;
  padding: 1px 6px; border-radius: 5px;
}
.chat-msg:hover, .chat-msg.an { background: var(--panel-2); }
.chat-zeit { flex-shrink: 0; font-family: var(--mono); font-size: 11px; color: var(--leise, #7f8c99); }
.chat-text { min-width: 0; overflow-wrap: anywhere; }
.chat-name { font-weight: 600; color: #9cc7f0; }
.chat-kreis { color: var(--muted); font-size: 12px; }
.chat-inhalt { margin-left: 5px; }
.chat-mod {
  margin-right: 5px; padding: 0 4px; border-radius: 3px; background: #122338; color: #6cb4ff;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; vertical-align: 1px;
}
.chat-msg.team .chat-name { color: #6cb4ff; }
.chat-msg.erwaehnt { background: rgba(244, 197, 66, .07); box-shadow: inset 2px 0 0 var(--accent); }
.chat-msg.weg .chat-text { font-style: italic; color: var(--muted); }

/* Die drei kleinen Symbole: unsichtbar, bis man über die Zeile fährt (oder mit der
   Tastatur hineinkommt) — dann schwebend am rechten Rand. */
.chat-aktionen {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); z-index: 2;
  display: flex; gap: 1px; padding: 1px; border-radius: 6px;
  background: #111923; border: 1px solid #2c3c52; box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  opacity: 0; pointer-events: none;
}
.chat-msg:hover .chat-aktionen, .chat-msg:focus-within .chat-aktionen, .chat-msg.an .chat-aktionen {
  opacity: 1; pointer-events: auto;
}

.chat-svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.chat-ico {
  width: 24px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: transparent;
  color: #b9c4d2; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.chat-ico:hover { background: #223043; color: var(--text); }
.chat-ico:focus-visible { outline: 2px solid var(--blau); outline-offset: -2px; }
.chat-ico.rot { color: #ff9f97; }
.chat-ico.mehr { background: #223043; }
.chat-ico.mehr .chat-svg { stroke-width: 3.4; }
.chat-ico.klein { width: 20px; height: 18px; }
.chat-ico.klein .chat-svg { width: 12px; height: 12px; }

.chat-leer { margin: 6px 4px; color: var(--muted); font-size: 12.5px; }
.chat-leise { color: var(--muted); font-size: 12px; }

/* ── Eingabe ────────────────────────────────────────────────────────────── */

.chat-eingabe {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px 5px; border-top: 1px solid var(--line);
}
.chat-feld {
  flex: 1; min-width: 0; height: 26px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--line-2, #2b3a4a); background: var(--bg); color: var(--text);
  font: inherit; font-size: 13px;
}
.chat-feld:focus { outline: none; border-color: #4a6488; box-shadow: 0 0 0 2px rgba(108, 180, 255, .12); }
.chat-feld:disabled { opacity: .55; }
.chat-senden {
  flex-shrink: 0; width: 30px; height: 26px; border: 0; border-radius: 6px;
  background: var(--accent); color: #1a1204; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.chat-senden:hover:not(:disabled) { background: #ffd65e; }
.chat-senden:disabled { opacity: .4; cursor: default; }
.chat-senden:focus-visible { outline: 2px solid var(--blau); outline-offset: 1px; }
.chat-rest { flex-shrink: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.chat-rest.warte { color: var(--accent); }
.chat-rest.zu { color: #ff9f97; }
.chat-antwort {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px; max-width: 150px; height: 22px;
  padding: 0 1px 0 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line-2, #2b3a4a);
  color: var(--muted); font-size: 12px;
}
.chat-antwort > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-antwort > .chat-svg { width: 12px; height: 12px; flex-shrink: 0; }

.chat-stumm {
  padding: 5px 10px; border-top: 1px solid #6a2c2c; background: #2a1517; color: #ffd0cb; font-size: 12.5px;
}

.chat-toast {
  position: absolute; right: 10px; bottom: 36px; z-index: 5; max-width: min(440px, 90%);
  padding: 4px 10px; border-radius: 6px; background: #172230; border: 1px solid #3a4c66;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45); font-size: 12.5px;
}
.chat-toast.fehler { background: #2a1517; border-color: #6a2c2c; color: #ffd0cb; }

/* ── Rechtsklick-Menü ───────────────────────────────────────────────────── */

.chat-schleier { position: fixed; inset: 0; z-index: 900; }
.chat-menue {
  position: fixed; z-index: 901; width: 200px; padding: 4px; border-radius: 10px;
  background: #172230; border: 1px solid #3a4c66; box-shadow: 0 16px 36px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column; outline: none;
}
.chat-menue button, .chat-menue a {
  height: 30px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text);
  font: inherit; font-size: 13.5px; text-align: left; display: flex; align-items: center; gap: 8px; cursor: pointer;
  text-decoration: none; box-sizing: border-box;
}
.chat-menue button:hover, .chat-menue button:focus-visible,
.chat-menue a:hover, .chat-menue a:focus-visible { background: #223043; outline: none; }
.chat-menue button .chat-svg, .chat-menue a .chat-svg { color: #95a3b5; }
.chat-menue button.rot, .chat-menue a.rot { color: #ffb3ac; }
.chat-menue button.rot .chat-svg, .chat-menue a.rot .chat-svg { color: #ff9f97; }
.chat-menue button.rot:hover, .chat-menue button.rot:focus-visible,
.chat-menue a.rot:hover, .chat-menue a.rot:focus-visible { background: #2a1517; }
.chat-trenner { height: 1px; margin: 4px 6px; background: #2c3c52; }

/* ── Dialoge (Melden, Löschen, Stummschalten) ───────────────────────────── */

.chat-dialog-schleier { position: fixed; inset: 0; z-index: 950; background: rgba(5, 8, 12, .62); }
.chat-dialog {
  position: fixed; z-index: 951; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(400px, 92vw); max-height: 86dvh; overflow-y: auto; padding: 16px 18px;
  border-radius: 12px; background: #121920; border: 1px solid var(--line-2, #2b3a4a);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .55); font-size: 13.5px; outline: none;
}
.chat-dialog h3 { margin: 0 0 10px; font-family: var(--cond, var(--font)); font-size: 18px; }
.chat-dialog p { margin: 0 0 8px; }
.chat-dialog form { margin: 0; }
.chat-zitat {
  margin: 0 0 12px; padding: 7px 10px; border-left: 3px solid #6a2c2c; border-radius: 4px;
  background: var(--bg); color: #d5dce5; overflow-wrap: anywhere;
}
.chat-wahl { margin: 0 0 10px; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chat-wahl legend { margin-bottom: 6px; padding: 0; font-weight: 600; }
.chat-wahl label, .chat-segment label { position: relative; }
.chat-wahl input, .chat-segment input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.chat-wahl span {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2, #2b3a4a); color: var(--muted);
}
.chat-wahl input:checked + span { border-color: #ff9f97; background: #2a1517; color: #ffb3ac; font-weight: 600; }
.chat-wahl input:focus-visible + span, .chat-segment input:focus-visible + span { outline: 2px solid var(--blau); }
.chat-segment { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 8px 0 10px; }
.chat-segment span {
  display: flex; align-items: center; justify-content: center; height: 30px; border-radius: 7px;
  border: 1px solid var(--line-2, #2b3a4a); color: var(--muted);
}
.chat-segment input:checked + span { border-color: var(--accent); background: #2a2314; color: var(--accent); font-weight: 600; }
.chat-feldzeile { display: flex; flex-direction: column; gap: 4px; margin: 0 0 8px; color: var(--muted); font-size: 12.5px; }
.chat-feldzeile textarea, .chat-feldzeile input {
  padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line-2, #2b3a4a); background: var(--bg);
  color: var(--text); font: inherit; font-size: 13.5px; resize: vertical;
}
.chat-feldzeile textarea:focus, .chat-feldzeile input:focus { outline: none; border-color: #4a6488; }
.chat-vorschlaege { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chat-dialog-knoepfe { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chat-knopf {
  height: 32px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--line-2, #2b3a4a);
  background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chat-knopf:hover:not(:disabled) { background: var(--panel-2); }
.chat-knopf:disabled { opacity: .45; cursor: default; }
.chat-knopf:focus-visible { outline: 2px solid var(--blau); outline-offset: 1px; }
.chat-knopf.klein { height: 26px; padding: 0 9px; font-size: 12px; font-weight: 500; }
.chat-knopf.an { border-color: var(--accent); color: var(--accent); }
.chat-knopf.rot { border-color: #6a2c2c; background: #3a1b1d; color: #ffd0cb; }
.chat-knopf.rot:hover:not(:disabled) { background: #4a2124; }
.chat-knopf.gelb { border-color: var(--accent); background: var(--accent); color: #1a1204; }
.chat-knopf.gelb:hover:not(:disabled) { background: #ffd65e; }
.chat-fehler { margin: 4px 0; color: #ff9f97; font-size: 12.5px; }

/* Schmale Leitstelle: die Kanalspalte wird schmaler, Namen kürzen mit „…“. */
@media (max-width: 1200px) {
  .chat-kanaele { width: 96px; }
}
