/* ==============================================================
   Lotse-Chat Design
   ==============================================================
   Diese Datei wird nach dem LibreChat-Design geladen und überschreibt es.
   Nach Änderungen neu bauen:  docker compose up -d --build
   Danach im Browser einmal neu laden (Strg+Umschalt+R / Cmd+Umschalt+R).

   FARBEN werden als drei Zahlen "Rot Grün Blau" ohne Kommas angegeben,
   z. B. #E2001A  ->  226 0 26.  Umrechnen: jeder Farbwähler zeigt RGB an.

   Markenfarbe Telekom-Magenta #E20074 = 226 0 116.
   Alle übrigen Werte sind die LibreChat-Standardwerte.
   ============================================================== */


/* --------------------------------------------------------------
   1. Schrift
   --------------------------------------------------------------
   Eigene Schrift: .woff2-Dateien in design/schriften/ legen und den
   @font-face-Block unten aktivieren. Externe Schriften (Google Fonts o. Ä.)
   blockiert LibreChat aus Sicherheitsgründen, deshalb lokal ablegen.
   Die Telekom-Hausschrift ist TeleNeo. Sobald die Dateien in
   design/schriften/ liegen, diesen Block aktivieren und unten
   --lotse-schrift auf 'TeleNeo', Inter, sans-serif setzen.

@font-face {
  font-family: 'TeleNeo';
  src: url('schriften/TeleNeo-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'TeleNeo';
  src: url('schriften/TeleNeo-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
*/

html:root {
  --lotse-schrift: Inter, sans-serif; /* mit Schriftdateien: 'TeleNeo', Inter, sans-serif */
  --theme-font-family: var(--lotse-schrift);
}
html:root body {
  font-family: var(--lotse-schrift);
}


/* --------------------------------------------------------------
   2. Formen
   -------------------------------------------------------------- */
html:root {
  --theme-control-radius: 0.75rem;   /* Buttons, Eingabefelder */
  --theme-surface-radius: 1rem;      /* Karten, Menüs */
  --theme-large-surface-radius: 1.5rem; /* Dialoge, Eingabebox */
  --radius: 0.5rem;                  /* kleinere Elemente */
}


/* --------------------------------------------------------------
   3. Farben im hellen Modus
   --------------------------------------------------------------
   Die High-Contrast-Modi für Barrierefreiheit bleiben bewusst unverändert. */
html:root:not(.dark):not(.high-contrast) {
  /* Markenfarbe: Hervorhebungen, aktive Elemente (Magenta, 4,7:1 auf Weiß) */
  --accent-primary: 226 0 116;
  --accent-primary-hover: 192 0 99;   /* #C00063 */

  /* Senden-Button und Bestätigen */
  --surface-submit: 226 0 116;
  --surface-submit-hover: 192 0 99;

  /* Hintergründe */
  --surface-primary: 255 255 255;    /* Hauptfläche */
  --surface-chat: 255 255 255;       /* Chatverlauf */
  --presentation: 255 255 255;       /* Chatbereich */
  --surface-primary-alt: 247 247 248;  /* Nebenflächen, z. B. Seitenleiste */
  --surface-secondary: 247 247 248;  /* Eingabebox, Karten */
  --surface-tertiary: 236 236 236;   /* Nutzer-Nachrichten, Buttons */
  --surface-hover: 227 227 227;      /* Hover */
  --surface-active: 251 229 241;     /* ausgewählter Chat, zartes Magenta #FBE5F1 */
  --surface-dialog: 255 255 255;     /* Dialoge */
  --header-primary: 255 255 255;     /* Kopfzeile */

  /* Texte */
  --text-primary: 33 33 33;
  --text-secondary: 66 66 66;
  --text-tertiary: 89 89 89;

  /* Links */
  --link: 226 0 116;
  --link-hover: 192 0 99;

  /* Rahmen */
  --border-light: 227 227 227;
  --border-medium: 205 205 205;
  --border-heavy: 153 150 150;

  /* Fokus-Rahmen (Tastaturbedienung) */
  --ring-primary: 226 0 116;
}


/* --------------------------------------------------------------
   4. Farben im dunklen Modus
   -------------------------------------------------------------- */
html:root.dark:not(.high-contrast) {
  /* Helleres Magenta, damit es auf Dunkel gut lesbar ist (#FF5CAE, 6,8:1) */
  --accent-primary: 255 92 174;
  --accent-primary-hover: 255 122 193;

  /* Button-Fläche bleibt Original-Magenta, weiße Schrift darauf 4,7:1 */
  --surface-submit: 226 0 116;
  --surface-submit-hover: 192 0 99;

  --surface-primary: 13 13 13;
  --surface-chat: 47 47 47;
  --presentation: 33 33 33;
  --surface-primary-alt: 23 23 23;
  --surface-secondary: 33 33 33;
  --surface-tertiary: 47 47 47;
  --surface-hover: 57 57 57;
  --surface-active: 74 24 50;        /* dunkles Magenta #4A1832 */
  --surface-dialog: 18 18 18;
  --header-primary: 47 47 47;

  --text-primary: 236 236 236;
  --text-secondary: 205 205 205;
  --text-tertiary: 153 150 150;

  --link: 255 102 179;
  --link-hover: 255 140 199;

  --border-light: 47 47 47;
  --border-medium: 66 66 66;
  --border-heavy: 89 89 89;

  --ring-primary: 255 92 174;
}


/* --------------------------------------------------------------
   5. Senden-Button in Magenta
   --------------------------------------------------------------
   LibreChat färbt ihn sonst schwarz bzw. weiß. */
html:root:not(.high-contrast) #send-button {
  background-color: rgb(var(--surface-submit));
}
html:root:not(.high-contrast) #send-button:not(:disabled):hover {
  background-color: rgb(var(--surface-submit-hover));
}
html:root:not(.high-contrast) #send-button svg {
  color: rgb(255 255 255);
}


/* --------------------------------------------------------------
   6. Telekom-Akzente im Chat
   --------------------------------------------------------------
   Gezielte Regeln für LibreChat-Elemente. Sie hängen an data-testid und
   festen Klassen, die nach einem LibreChat-Update kurz zu prüfen sind. */

/* Magenta-Leiste oben über die ganze Breite */
html:root:not(.high-contrast) body::after {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  background: rgb(226 0 116);
  z-index: 1000;
  pointer-events: none;
}

/* Eingabefeld: Magenta-Rahmen, sobald man hineinklickt */
html:root:not(.high-contrast) [data-testid='composer-surface']:focus-within {
  border-color: rgb(var(--accent-primary));
  box-shadow: 0 0 0 1px rgb(var(--accent-primary));
}

/* Sprechblase der Nutzerin bzw. des Nutzers: zartes Magenta */
html:root:not(.high-contrast) .user-turn [data-testid='message-body'].bg-surface-tertiary {
  background-color: rgb(var(--lotse-blase));
}
html:root:not(.high-contrast):not(.dark) {
  --lotse-blase: 251 229 241; /* #FBE5F1 */
}
html:root.dark:not(.high-contrast) {
  --lotse-blase: 74 24 50;    /* #4A1832 */
}

/* Ausgewählter Chat in der Seitenleiste: Magenta-Hintergrund und -Strich */
html:root:not(.high-contrast) [data-testid='convo-item']:has([aria-current='page']) {
  background-color: rgb(var(--lotse-blase));
}
html:root:not(.high-contrast) [data-testid='convo-item']:has([aria-current='page'])::before {
  background-color: rgb(var(--accent-primary));
}
html:root:not(.high-contrast) [data-testid='convo-item'] [aria-current='page'] {
  background-color: transparent;
}

/* Links in Antworten */
html:root:not(.high-contrast) .markdown a {
  color: rgb(var(--link));
}
html:root:not(.high-contrast) .markdown a:hover {
  color: rgb(var(--link-hover));
}


/* --------------------------------------------------------------
   7. Eigene Regeln
   --------------------------------------------------------------
   Hier kannst du beliebiges CSS ergänzen. Klassennamen findest du mit
   Rechtsklick > "Untersuchen" im Browser. Achtung: LibreChat ändert seine
   Klassennamen manchmal bei Updates, Variablen oben sind stabiler.

   Beispiel: Logo auf der Anmeldeseite größer
   img[src="assets/logo.svg"] { height: 4rem; width: auto; }
*/

/* Startseite: Zeile "Kontakt: <Name>" unter der Begrüßung ausblenden.
   LibreChat zeigt dort den Namen des Kontos, das den Lotse-Agenten angelegt
   hat (das Admin-Konto). Das sollen andere Nutzer nicht sehen. */
.animate-fadeIn.mt-2.max-w-md.text-text-secondary {
  display: none;
}


/* --------------------------------------------------------------
   8. T-Credits in der Kopfzeile
   --------------------------------------------------------------
   Guthaben rechts oben, eingefügt von lotse.js. */
#lotse-credits {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid rgb(var(--border-light));
  border-radius: 9999px;
  background-color: rgb(var(--surface-primary));
  color: rgb(var(--text-primary));
  font-size: 0.875rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#lotse-credits .lotse-credits-zahl {
  font-weight: 700;
  color: rgb(var(--accent-primary));
}
#lotse-credits .lotse-credits-name {
  font-weight: 400;
  color: rgb(var(--text-secondary));
}
/* Guthaben aufgebraucht */
#lotse-credits.lotse-credits-leer .lotse-credits-zahl {
  color: rgb(var(--text-secondary));
}

/* --------------------------------------------------------------
   9. Hinweis im Bereich „Erinnerungen“
   --------------------------------------------------------------
   Steht in der Seitenleiste über dem Suchfeld. Der Bereich wird an
   seinem Suchfeld (#memory-search) erkannt. Nach einem LibreChat-Update
   prüfen, ob der Selektor noch passt. */
div[role="region"]:has(#memory-search)::before {
  content: "Alle deine Daten werden in Deutschland gespeichert";
  display: block;
  margin: 0 0.75rem 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  /* festes Magenta, damit Weiß auch im dunklen Design gut lesbar bleibt */
  background-color: #E20074;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
}
/* Auf Englisch (alle Sprachen außer Deutsch, gesetzt von lotse.js) */
html[data-lotse-sprache="en"] div[role="region"]:has(#memory-search)::before {
  content: "All your data is stored in Germany";
}


/* --------------------------------------------------------------
   10. Sprachumschalter in der Kopfzeile
   --------------------------------------------------------------
   "DE | EN" rechts oben neben den T-Credits, eingefügt von lotse.js.
   Gleiche Form wie die T-Credits, die aktive Sprache in Magenta. */
#lotse-sprache {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.125rem;
  height: 2.25rem;
  padding: 0 0.375rem;
  border: 1px solid rgb(var(--border-light));
  border-radius: 9999px;
  background-color: rgb(var(--surface-primary));
  font-size: 0.875rem;
  white-space: nowrap;
}
#lotse-sprache .lotse-sprache-strich {
  color: rgb(var(--text-tertiary));
}
#lotse-sprache .lotse-sprache-knopf {
  padding: 0.125rem 0.375rem;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: rgb(var(--text-secondary));
  font: inherit;
  font-weight: 400;
  cursor: pointer;
}
#lotse-sprache .lotse-sprache-knopf:hover {
  color: rgb(var(--text-primary));
}
#lotse-sprache .lotse-sprache-knopf[aria-pressed="true"] {
  color: rgb(var(--accent-primary));
  font-weight: 700;
  cursor: default;
}

/* --------------------------------------------------------------
   11. Schnellwahl der Modelle in der Kopfzeile
   --------------------------------------------------------------
   Runde Icons statt der Auswahlliste von LibreChat, eingefügt von
   lotse.js (Abschnitt 4). Das aktive Icon hat einen Magenta-Ring.
   Die alte Liste wird nur ausgeblendet, wenn die Schnellwahl läuft
   (Klasse lotse-schnellwahl-an an <html>). */
html.lotse-schnellwahl-an .lotse-alte-auswahl {
  display: none !important;
}
#lotse-schnellwahl {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.375rem;
  /* Platz für den Ring, damit er nicht abgeschnitten wird */
  padding: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
#lotse-schnellwahl::-webkit-scrollbar {
  display: none;
}
#lotse-schnellwahl .lotse-sw-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgb(var(--border-light));
  border-radius: 9999px;
  background-color: rgb(var(--surface-primary));
  color: rgb(var(--text-primary));
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
#lotse-schnellwahl .lotse-sw-icon:hover {
  transform: scale(1.06);
}
#lotse-schnellwahl .lotse-sw-icon:focus-visible {
  outline: 2px solid rgb(var(--accent-primary));
  outline-offset: 2px;
}
#lotse-schnellwahl .lotse-sw-icon.lotse-sw-aktiv {
  border-color: rgb(var(--accent-primary));
  box-shadow: 0 0 0 2px rgb(var(--accent-primary));
}
#lotse-schnellwahl .lotse-sw-bild {
  width: 1.75rem;
  height: 1.75rem;
}
/* Auf dem Handy reicht der Platz neben T-Credits und DE | EN nicht:
   die Icons stehen in einer eigenen Zeile unter der Kopfzeile */
@media (max-width: 767px) {
  #lotse-schnellwahl {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    justify-content: center;
    gap: 0.25rem;
    background-image: linear-gradient(to bottom, rgb(var(--presentation)), rgb(var(--presentation) / 0));
  }
  #lotse-schnellwahl .lotse-sw-icon {
    width: 2rem;
    height: 2rem;
  }
  #lotse-schnellwahl .lotse-sw-bild {
    width: 1.5rem;
    height: 1.5rem;
  }
}

/* Bild eines Profils, in der Leiste und in der Karte */
.lotse-sw-bild {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 700;
}
.lotse-sw-bild img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lotse-sw-bild svg {
  width: 70%;
  height: 70%;
}
.lotse-sw-bild.lotse-sw-logo-anthropic {
  background-color: #d09a74;
  color: #191919;
}

/* Karte beim Darüberfahren: Name, Beschreibung, bei Gruppen die Modelle */
#lotse-schnellwahl-karte {
  position: fixed;
  z-index: 100;
  display: flex;
  width: max-content;
  min-width: 13rem;
  max-width: min(20rem, calc(100vw - 1rem));
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.375rem;
  border: 1px solid rgb(var(--border-light));
  border-radius: 0.75rem;
  background-color: rgb(var(--surface-primary));
  color: rgb(var(--text-primary));
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
  font-size: 0.875rem;
}
#lotse-schnellwahl-karte[hidden] {
  display: none;
}
#lotse-schnellwahl-karte .lotse-sw-titel {
  padding: 0.25rem 0.5rem 0.125rem;
  font-weight: 700;
}
#lotse-schnellwahl-karte .lotse-sw-punkt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
#lotse-schnellwahl-karte .lotse-sw-punkt:hover,
#lotse-schnellwahl-karte .lotse-sw-punkt:focus-visible {
  outline: none;
  background-color: rgb(var(--surface-hover));
}
#lotse-schnellwahl-karte .lotse-sw-punkt[aria-checked="true"] {
  background-color: rgb(var(--lotse-blase));
}
#lotse-schnellwahl-karte .lotse-sw-punkt .lotse-sw-bild {
  width: 1.5rem;
  height: 1.5rem;
}
#lotse-schnellwahl-karte .lotse-sw-texte {
  display: flex;
  min-width: 0;
  flex-direction: column;
}
#lotse-schnellwahl-karte .lotse-sw-name {
  font-weight: 600;
}
#lotse-schnellwahl-karte .lotse-sw-beschreibung {
  color: rgb(var(--text-secondary));
  font-size: 0.8125rem;
}
