/* LLM-Rat - dunkle Chat-Oberflaeche */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg-leiste: #171a23;
  --bg-blase-user: #2b3a67;
  --bg-blase-rat: #1c2029;
  --bg-eingabe: #1c2029;
  --rand: #2a2f3d;
  --text: #e8eaf0;
  --text-gedimmt: #9aa1b5;
  --akzent: #6c8cff;
  --akzent-warm: #d4a94e;
  --fehler: #e06c75;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
}

.versteckt { display: none !important; }

/* ---------- Login ---------- */
.login-wrap {
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--bg-leiste);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 40px 36px;
  width: 340px;
  text-align: center;
  display: flex; flex-direction: column; gap: 14px;
}
.login-logo { font-size: 44px; }
.login-box h1 { font-size: 22px; font-weight: 600; }
.login-hinweis { color: var(--text-gedimmt); font-size: 13px; }
.login-box input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--rand); border-radius: 8px;
  padding: 11px 12px; font-size: 15px; outline: none;
}
.login-box input:focus { border-color: var(--akzent); }
.login-box button {
  background: var(--akzent); color: #fff; border: none;
  border-radius: 8px; padding: 11px; font-size: 15px; cursor: pointer;
}
.login-box button:hover { filter: brightness(1.1); }
.login-fehler { color: var(--fehler); font-size: 13px; min-height: 18px; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; }

.seitenleiste {
  width: 260px; flex-shrink: 0;
  background: var(--bg-leiste);
  border-right: 1px solid var(--rand);
  display: flex; flex-direction: column;
}
.seitenleiste.zu { display: none; }

.neu-btn {
  margin: 12px; padding: 10px;
  background: transparent; color: var(--text);
  border: 1px solid var(--rand); border-radius: 8px;
  font-size: 14px; cursor: pointer; text-align: left;
}
.neu-btn:hover { border-color: var(--akzent); }

.gespraechsliste { flex: 1; overflow-y: auto; padding: 0 8px; }
.gespraech-eintrag {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--text-gedimmt); font-size: 13px;
  cursor: pointer; margin-bottom: 2px;
}
.gespraech-eintrag:hover { background: rgba(255,255,255,.05); color: var(--text); }
.gespraech-eintrag.aktiv { background: rgba(108,140,255,.15); color: var(--text); }
.gespraech-eintrag .titel {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gespraech-eintrag .loeschen {
  visibility: hidden; background: none; border: none;
  color: var(--text-gedimmt); cursor: pointer; font-size: 13px;
}
.gespraech-eintrag:hover .loeschen { visibility: visible; }
.gespraech-eintrag .loeschen:hover { color: var(--fehler); }

.gedaechtnis-btn {
  margin: 8px 12px; padding: 9px 10px;
  background: transparent; color: var(--text-gedimmt);
  border: 1px solid var(--rand); border-radius: 8px;
  font-size: 13px; cursor: pointer; text-align: left;
}
.gedaechtnis-btn:hover { border-color: var(--akzent-warm); color: var(--text); }

/* ---------- Gedächtnis-Fenster ---------- */
.fenster-hg {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.fenster {
  background: var(--bg-leiste);
  border: 1px solid var(--rand); border-radius: 14px;
  width: min(760px, 100%); max-height: 85vh;
  display: flex; flex-direction: column;
}
.fenster-kopf {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--rand);
  font-weight: 600;
}
.fenster-zu {
  background: none; border: none; color: var(--text-gedimmt);
  font-size: 16px; cursor: pointer;
}
.fenster-zu:hover { color: var(--text); }
.fenster-hinweis {
  padding: 12px 18px 0; color: var(--text-gedimmt);
  font-size: 12.5px; line-height: 1.5;
}
#gedaechtnis-text {
  flex: 1; margin: 12px 18px;
  min-height: 320px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--rand); border-radius: 8px;
  padding: 12px; font-size: 13.5px; line-height: 1.55;
  font-family: ui-monospace, Consolas, monospace;
  resize: vertical; outline: none;
}
#gedaechtnis-text:focus { border-color: var(--akzent); }
.fenster-fuss {
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  padding: 0 18px 16px;
}
.fenster-status { color: var(--text-gedimmt); font-size: 13px; }
#gedaechtnis-speichern {
  background: var(--akzent); color: #fff; border: none;
  border-radius: 8px; padding: 9px 20px; font-size: 14px; cursor: pointer;
}
#gedaechtnis-speichern:hover { filter: brightness(1.1); }

.gemerkt {
  color: var(--akzent-warm); font-size: 13.5px; line-height: 1.5;
}

.leiste-fuss {
  padding: 12px; font-size: 11px; color: var(--text-gedimmt);
  border-top: 1px solid var(--rand); text-align: center;
}

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

.kopf {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rand);
}
.leiste-toggle {
  background: none; border: none; color: var(--text-gedimmt);
  font-size: 18px; cursor: pointer;
}
.kopf-titel { font-weight: 600; }
.kopf-modelle { color: var(--text-gedimmt); font-size: 12px; margin-left: auto; }

/* ---------- Chat ---------- */
.chat {
  flex: 1; overflow-y: auto;
  padding: 24px 0 12px;
}
.chat-innen, .nachricht { max-width: 820px; margin: 0 auto; padding: 0 20px; }

.leer-hinweis {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  color: var(--text-gedimmt); text-align: center; line-height: 1.6;
}
.leer-logo { font-size: 56px; }

.nachricht { margin-bottom: 18px; }
.blase {
  padding: 12px 16px; border-radius: 12px; line-height: 1.55;
  overflow-wrap: break-word;
}
.nachricht.user .blase {
  background: var(--bg-blase-user);
  margin-left: 15%;
  border-bottom-right-radius: 4px;
}
.nachricht.rat .blase {
  background: var(--bg-blase-rat);
  border: 1px solid var(--rand);
  border-bottom-left-radius: 4px;
}
.autor {
  font-size: 12px; color: var(--akzent-warm);
  margin-bottom: 6px; font-weight: 600;
}

/* Markdown in Blasen */
.blase p, .blase ul, .blase ol, .blase pre, .blase table, .blase blockquote { margin-bottom: 10px; }
.blase :last-child { margin-bottom: 0; }
.blase ul, .blase ol { padding-left: 22px; }
.blase h1, .blase h2, .blase h3 { margin: 14px 0 8px; font-size: 1.05em; }
.blase code {
  background: rgba(255,255,255,.08); padding: 1px 5px;
  border-radius: 4px; font-size: .9em;
}
.blase pre {
  background: #10131a; border: 1px solid var(--rand);
  padding: 12px; border-radius: 8px; overflow-x: auto;
}
.blase pre code { background: none; padding: 0; }
.blase table { border-collapse: collapse; display: block; overflow-x: auto; }
.blase th, .blase td { border: 1px solid var(--rand); padding: 6px 10px; }
.blase blockquote { border-left: 3px solid var(--rand); padding-left: 12px; color: var(--text-gedimmt); }
.blase a { color: var(--akzent); }

/* Fortschritt der Ratsstufen */
.fortschritt {
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13px; color: var(--text-gedimmt);
}
.stufe-zeile { display: flex; align-items: center; gap: 8px; }
.stufe-zeile .punkt {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rand); flex-shrink: 0;
}
.stufe-zeile.laeuft .punkt { background: var(--akzent); animation: puls 1s infinite; }
.stufe-zeile.fertig .punkt { background: #6fbf73; }
@keyframes puls { 50% { opacity: .3; } }

/* Aufklappbare Details (Einzelmeinungen / Bewertungen) */
details.rat-details {
  margin-top: 10px; border-top: 1px solid var(--rand); padding-top: 8px;
}
details.rat-details summary {
  cursor: pointer; color: var(--text-gedimmt); font-size: 13px;
  user-select: none;
}
details.rat-details summary:hover { color: var(--text); }
.detail-block {
  margin-top: 10px; border: 1px solid var(--rand);
  border-radius: 8px; overflow: hidden;
}
.detail-kopf {
  background: rgba(255,255,255,.04); padding: 7px 12px;
  font-size: 12px; font-weight: 600; color: var(--akzent-warm);
}
.detail-text { padding: 10px 12px; font-size: 13.5px; line-height: 1.5; }
.ausfall { color: var(--fehler); font-size: 13px; margin-top: 6px; }

/* ---------- Eingabe ---------- */
.eingabe-wrap { padding: 12px 20px 18px; }
.eingabe {
  max-width: 820px; margin: 0 auto;
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--bg-eingabe);
  border: 1px solid var(--rand); border-radius: 14px;
  padding: 10px 12px;
}
.eingabe:focus-within { border-color: var(--akzent); }
.eingabe textarea {
  flex: 1; background: none; border: none; outline: none; resize: none;
  color: var(--text); font-size: 15px; font-family: inherit;
  line-height: 1.5; max-height: 200px;
}
.eingabe button {
  background: var(--akzent); color: #fff; border: none;
  border-radius: 9px; width: 38px; height: 38px;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.eingabe button:disabled { opacity: .4; cursor: default; }

@media (max-width: 700px) {
  .seitenleiste { position: fixed; z-index: 10; height: 100vh; }
  .nachricht.user .blase { margin-left: 5%; }
}
