/* ===== J.A.R.V.I.S-Chat: Denkstufe, Aktivitaetsfenster, Antwort Wort fuer Wort (Umbau 2026-11-10) =====
   Aufbau wie Ultron (B&P public/css/ultron.css 601-751, 873-884) bzw. F.R.I.D.A.Y., Farben im J.A.R.V.I.S-Design: Gold
   auf Creme (style.css --primary #b8924d, --primary-hover #8a6d34, --primary-light #f7efe0) statt Ultron-Cyan. Klassen mit
   Praefix ai- wie die uebrigen Chat-Stile (style.css .ai-md*, .ai-mark*, index.html .ai-chat-knopf). Geladen nach
   style.css (index.html, ?v={{VERSION}}). */

@keyframes jarvis-atmen {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
@keyframes jarvis-tippen {
  0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ===== Zeile mit Chatkarte und Aktivitaetsfenster =====
   Die Zeile ist so hoch wie die Chatkarte (Werte aus dem style-Attribut der Zeile, renderAiChatTab) - das gestreckte
   Aktivitaetsfenster wird dadurch nie hoeher als der Chat, seine Liste scrollt fuer sich, die Seite scrollt nicht mit.
   Der Abstand nach unten (vorher margin-bottom der Karte) sitzt jetzt an der Zeile. */
.ai-chat-zeile { display: flex; gap: 12px; align-items: stretch; height: var(--ai-chat-hoehe, auto); min-height: var(--ai-chat-min, 0); margin-bottom: 20px; }
.card.ai-chat-karte { margin-bottom: 0; }

/* ===== Suchleiste ueber dem Chat (Vorgabe Ben 2026-11-17, wie Vision 1faa614) =====
   Trefferanzeige ("1 / 3", "Kein Treffer") im Suchfeld links vom ✕: vorher stand sie als leerer 70-px-Platzhalter
   zwischen Feld und Pfeilen - die Pfeile hatten dadurch einen viel zu grossen Abstand. Der rechte Innenabstand des Felds
   kommt aus --ai-suche-rechts (style-Attribut des Felds) und wird nur bei sichtbarer Anzeige breiter. */
.ai-chat-suche-info {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
}
.ai-chat-suche:has(.ai-chat-suche-info:not(:empty)) { --ai-suche-rechts: 104px; }

/* Schnelltexte: Auswahlfeld im Stil der Suchleiste, Liste darunter, "+" daneben. */
.ai-schnell { position: relative; flex: 0 1 180px; min-width: 110px; }
.ai-schnell-feld {
  width: 100%;
  padding: 6px 26px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--card-bg, #fff);
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-schnell-feld::after { content: '▾'; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; }
.ai-schnell-feld:focus-visible, .ai-schnell-feld[aria-expanded="true"] { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(184, 146, 77, .18); }
.ai-schnell-liste {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 340px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
  padding: 4px;
  z-index: 50;
}
.ai-schnell-liste[hidden] { display: none; }
.ai-schnell-eintrag { display: flex; align-items: center; border-radius: 6px; }
.ai-schnell-eintrag:hover { background: var(--primary-light, #f7efe0); }
.ai-schnell-wort {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: none;
  text-align: left;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-schnell-weg {
  flex: 0 0 auto;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 4px;
}
.ai-schnell-weg:hover { color: #dc2626; background: rgba(220, 38, 38, .08); }
.ai-schnell-leer { padding: 8px 10px; font-size: 12px; color: var(--text-muted); white-space: normal; width: 220px; }
.ai-schnell-neu { flex: 0 0 auto; }

/* ===== Denkstufe unter dem Eingabefeld (ersetzt den Gruendlich-Schalter) =====
   Kleiner Segment-Umschalter "Denken: Niedrig | Mittel | Hoch"; die gewaehlte Stufe in vollem Gold wie frueher die aktive
   Gruendlich-Pill. Darf umbrechen, damit schmale Fenster nie seitlich scrollen. */
.ai-optionen { flex-wrap: wrap; align-items: center; }
.ai-denkstufe { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0; }
.ai-denkstufe-titel { font-size: 12px; font-weight: 600; color: var(--text-muted, #6b5d4a); margin-right: 6px; }
.ai-denkstufe-knopf {
  padding: 3px 11px;
  border: 1px solid var(--border, #e5dccc);
  background: #fff;
  color: var(--text-muted, #6b5d4a);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s, border-color .15s;
}
.ai-denkstufe-knopf:first-of-type { border-radius: 999px 0 0 999px; }
.ai-denkstufe-knopf:last-of-type { border-radius: 0 999px 999px 0; }
.ai-denkstufe-knopf:hover:not(:disabled) { border-color: var(--primary, #b8924d); color: var(--primary-hover, #8a6d34); }
.ai-denkstufe-knopf:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(184, 146, 77, .3); }
.ai-denkstufe-knopf:disabled { opacity: .55; cursor: not-allowed; }
.ai-denkstufe-knopf.ai-denkstufe-an {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #d4b06a 0%, #b8924d 55%, #8a6d34 100%);
  box-shadow: 0 2px 8px rgba(138, 109, 52, .35);
}

/* ===== Aktivitaetsfenster =====
   Schmales Panel rechts neben der Chatkarte: was J.A.R.V.I.S gerade tut (Schritte mit Symbol, Text und mitlaufender
   Zeit, Zwischennotizen, Nachdenken). Nicht im Chatverlauf. Nach dem Lauf klappt es zum Knopf "Aktivität" unter dem
   Eingabefeld zu. Schmale Fenster: ein Streifen ueber dem Chat - nie seitliches Scrollen. */
.ai-aktivitaet {
  flex: 0 0 272px;
  max-width: 272px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border, #e5dccc);
  border-radius: 10px;
  background: var(--card-bg, #fff);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(138, 109, 52, .08);
}
.ai-aktivitaet[hidden] { display: none; }
.ai-akt-kopf {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border, #e5dccc);
  background: var(--primary-light, #f7efe0);
}
.ai-akt-titel { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .3px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-akt-titel-laeuft { color: var(--primary-hover, #8a6d34); }
.ai-akt-zeit, .ai-akt-dauer { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ai-akt-zu { border: none; background: none; cursor: pointer; color: var(--text-muted); font-size: 13px; line-height: 1; padding: 2px 4px; font-family: inherit; }
.ai-akt-zu:hover { color: var(--text); }
/* Modus, Runde, Groesse der Systemanweisung und Zahl der Werkzeuge unter dem Titel. */
.ai-akt-info { padding: 4px 10px; font-size: 11px; color: var(--text-muted); border-bottom: 1px solid var(--border, #e5dccc); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ai-akt-info[hidden] { display: none; }
.ai-akt-liste { list-style: none; margin: 0; padding: 8px 10px; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 5px; }
.ai-akt-leer { font-size: 12px; color: var(--text-muted); }
.ai-akt-schritt { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; line-height: 1.35; }
.ai-akt-symbol { flex: 0 0 18px; text-align: center; }
.ai-akt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.ai-akt-laeuft .ai-akt-symbol { animation: jarvis-atmen 1.2s ease-in-out infinite; }
.ai-akt-laeuft .ai-akt-text { font-weight: 600; }
.ai-akt-fehler .ai-akt-text { color: var(--danger, #b03a2e); }
/* Kein Fehler, aber nicht wie angezeigt gelaufen (Suchbudget, Zeitdeckel, Verbindung abgerissen). */
.ai-akt-hinweis .ai-akt-text { color: var(--warning, #d97706); }
.ai-akt-notiz, .ai-akt-denken {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
  margin-left: 24px;
  padding: 3px 0 3px 8px;
  border-left: 2px solid rgba(184, 146, 77, .45);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 140px;
  overflow-y: auto;
}
.ai-akt-denken { border-left-color: rgba(138, 109, 52, .55); font-style: italic; }
.ai-akt-notiz-titel { display: block; font-size: 10.5px; font-weight: 700; font-style: normal; letter-spacing: .3px; text-transform: uppercase; opacity: .8; }
.ai-aktivitaet-knopf {
  margin-left: auto;
  padding: 3px 11px;
  border: 1px solid var(--border, #e5dccc);
  border-radius: 999px;
  background: #fff;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ai-aktivitaet-knopf[hidden] { display: none; }
.ai-aktivitaet-knopf:hover { border-color: var(--primary, #b8924d); color: var(--primary-hover, #8a6d34); }

/* ===== Antwort Wort fuer Wort ===== */
/* Wartende Blase ohne Text (Wartehinweis), mit Text normal; blinkender Schreibstrich am Ende, Tipp-Punkte beim Warten. */
.ai-blase-denkt { opacity: .7; font-style: italic; }
.ai-strom-cursor { display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: text-bottom; background: var(--primary, #b8924d); animation: jarvis-atmen 1s ease-in-out infinite; }
.ai-tipp-punkte { display: inline-flex; gap: 3px; margin-left: 7px; vertical-align: middle; }
.ai-tipp-punkte i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d4b06a;
  animation: jarvis-tippen 1.2s ease-in-out infinite;
}
.ai-tipp-punkte i:nth-child(2) { background: var(--primary, #b8924d); animation-delay: .15s; }
.ai-tipp-punkte i:nth-child(3) { background: var(--primary-hover, #8a6d34); animation-delay: .3s; }

@media (max-width: 900px) {
  /* In der Spalte gilt die Hoehe fuer die ganze Zeile, die Karte fuellt den Rest - der Streifen des Aktivitaetsfensters
     macht die Karte kleiner, statt Eingabe und Denkstufe unter den Fensterrand zu schieben. */
  .ai-chat-zeile { flex-direction: column; height: var(--ai-chat-hoehe, auto); min-height: var(--ai-chat-min, 0); }
  .ai-chat-zeile > .card.ai-chat-karte { flex: 1 1 auto; height: auto !important; min-height: 240px !important; }
  .ai-aktivitaet { order: -1; flex: 0 0 auto; max-width: none; width: 100%; max-height: 170px; box-sizing: border-box; }
}
/* Ticker: Knopf "↓ Neueste" - erscheint, wenn der Nutzer im laufenden Lauf hochgescrollt hat; Klick springt ans Ende, dort
   laeuft die Liste wieder mit. Nur auf dem Desktop sichtbar. */
.ai-akt-neueste { display: none; }
@media (min-width: 901px) {
  /* Das Fenster ist auf die Hoehe der Zeile (= Chatkarte) gestreckt; Kopf und Info-Zeile bleiben oben, nur die Liste scrollt. */
  .ai-aktivitaet { position: relative; align-self: stretch; min-height: 0; }
  .ai-akt-kopf, .ai-akt-info { flex-shrink: 0; }
  /* Der Titel mit Grund ("Beendet nach 304 s - Rundengrenze erreicht") passt nicht in die schmale Kopfzeile - der Grund steht
     in einer eigenen Zeile, die umbrechen darf; den vollen Text traegt zusaetzlich der Tooltip (title). */
  .ai-akt-titel-grund { display: block; white-space: normal; overflow-wrap: anywhere; font-weight: 600; letter-spacing: 0; line-height: 1.3; }
  .ai-akt-titel-trenner { display: none; }
  /* In der begrenzten Liste behalten Schritte, Nachdenken und Zwischennotizen ihre Hoehe. */
  .ai-akt-liste > li { flex-shrink: 0; }
  .ai-akt-neueste:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    z-index: 2;
    padding: 4px 12px;
    border: none;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #d4b06a 0%, #b8924d 55%, #8a6d34 100%);
    box-shadow: 0 2px 10px rgba(138, 109, 52, .35);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
  }
  .ai-akt-neueste:hover { filter: brightness(1.08); }
  .ai-akt-neueste:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(184, 146, 77, .35); }
}
@media (prefers-reduced-motion: reduce) {
  .ai-akt-laeuft .ai-akt-symbol, .ai-strom-cursor, .ai-tipp-punkte i { animation: none !important; }
}
