/* ===== F.R.I.D.A.Y. - Reiter Gedaechtnis, Konsolidierung, Lauf-Protokoll, Admin-Historie =====
   Gehoert zu public/js/friday-gedaechtnis.js. Aufbau, Knoepfe und Ablaeufe wie bei J.A.R.V.I.S
   (Immo_v2); gewollt anders ist nur die Optik: etwas mehr "KI-Look" mit Verlaufskanten, Glas
   und einem dunklen HUD-Band in den Fenstern (Bauplan 10.4).
   Die Farben kommen aus friday.css (:root --fr-*). Jede Stelle hat einen Rueckfallwert, damit
   der Reiter auch dann lesbar bleibt, wenn friday.css (noch) nicht geladen ist.
   Alle Klassen tragen den Praefix friday-g-, damit nichts mit style.css oder friday.css
   zusammenstoesst. */

/* ----- Reiter: Kopf mit Einleitung und Knoepfen ----- */
.friday-g-kopf {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.friday-g-einleitung {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  flex: 1;
  min-width: 260px;
}
.friday-g-knoepfe {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* "Erfahrungen konsolidieren (n)": Verlaufsrand, pulsiert sanft - es wartet Arbeit. */
.btn.friday-g-knopf-kons {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card-bg, #fff), var(--card-bg, #fff)) padding-box,
    var(--fr-verlauf, linear-gradient(135deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%)) border-box;
  color: var(--text);
  font-weight: 600;
  animation: friday-g-puls 2.8s ease-in-out infinite;
}
.btn.friday-g-knopf-kons:hover {
  background:
    linear-gradient(rgba(34, 211, 238, 0.08), rgba(139, 92, 246, 0.08)) padding-box,
    var(--fr-verlauf, linear-gradient(135deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%)) border-box;
}
@keyframes friday-g-puls {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
  50% { box-shadow: 0 0 14px 0 rgba(56, 189, 248, 0.35); }
}

/* ----- Zaehlerkarte als kleines HUD ----- */
.card.friday-g-zaehler {
  position: relative;
  overflow: hidden;
  padding: 15px 18px 12px;
  margin-bottom: 14px;
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid var(--fr-rand, rgba(129, 140, 248, 0.35));
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(34, 211, 238, 0.08), transparent 55%),
    radial-gradient(120% 160% at 100% 100%, rgba(139, 92, 246, 0.08), transparent 55%),
    var(--card-bg, #fff);
}
.card.friday-g-zaehler::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--fr-verlauf, linear-gradient(135deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%));
}
.friday-g-feld-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.friday-g-feld-wert {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.friday-g-verlaufstext {
  background: var(--fr-verlauf, linear-gradient(135deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.friday-g-zaehler-hinweis {
  flex: 1;
  min-width: 220px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ----- Filterkarte ----- */
.card.friday-g-filterkarte {
  padding: 14px 16px;
  margin-bottom: 14px;
}
/* Suche zuerst und breit: sie ist der haeufigste Griff, die Filter daneben die Ausnahme. */
.friday-g-filterraster {
  display: grid;
  grid-template-columns: 2.6fr 1fr 1.4fr 1.4fr 0.7fr;
  gap: 10px;
  align-items: end;
}
.friday-g-filterraster .form-group { margin: 0; }
.friday-g-schalter {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-size: 12px;
  flex-wrap: wrap;
}
.friday-g-schalter label { cursor: pointer; }
@media (max-width: 1100px) {
  .friday-g-filterraster { grid-template-columns: 1fr 1fr; }
  .friday-g-filterraster > .form-group:first-child { grid-column: 1 / -1; }
}

/* ----- Tabelle ----- */
.friday-g-anzahl {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.card.friday-g-tabellenkarte {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--fr-rand, rgba(129, 140, 248, 0.35));
}
.friday-g-tabellenkarte th.friday-g-sortiert { color: var(--fr-violett, var(--primary)); }
.friday-g-tabellenkarte tr.friday-g-gruppe td {
  background: var(--bg);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 10px;
  border-top: 2px solid var(--border);
  box-shadow: inset 3px 0 0 var(--fr-violett, #8b5cf6);
}
.friday-g-gruppe-anzahl { font-weight: 400; color: var(--text-muted); }

/* Nummer (R17, F31 ...) als kleine Plakette - so spricht F.R.I.D.A.Y. ueber den Eintrag. */
.friday-g-nr {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 8px;
  border-radius: 999px;
  color: #3730a3;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.16), rgba(139, 92, 246, 0.18));
  border: 1px solid var(--fr-rand, rgba(129, 140, 248, 0.35));
}
.friday-g-typ {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.friday-g-status-aktiv {
  color: #065f46;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
/* Leuchtender Punkt vor "Aktiv" */
.friday-g-status-aktiv::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 1px;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.75);
}
.friday-g-leer {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ----- Formular (Modal) ----- */
.modal.friday-g-modal .modal-header {
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%) 1;
}
.friday-g-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.friday-g-bezug { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.friday-g-drei { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: end; }
.friday-g-zwei .form-group,
.friday-g-bezug .form-group,
.friday-g-drei .form-group { margin: 0; }
/* style.css gibt jedem input in einer .form-group volle Breite und Innenabstand - fuer die
   Haekchen "Immer im Chat" und "Vertraulich" waere das ein 100 % breites Kaestchen. */
.friday-g-drei .form-group input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin: 0 4px 0 0;
  vertical-align: -2px;
  box-shadow: none;
}
.friday-g-hilfe {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.friday-g-typ-hinweis {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 10px;
  padding: 5px 9px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.08), rgba(139, 92, 246, 0.06));
  box-shadow: inset 3px 0 0 var(--fr-cyan, #22d3ee);
}
.friday-g-typ-hinweis:empty { display: none; }
.friday-g-verlauf {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.friday-g-verlauf summary { cursor: pointer; }
.friday-g-verlauf-zeile {
  padding: 3px 0;
  border-top: 1px solid var(--border);
}
@media (max-width: 700px) {
  .friday-g-zwei, .friday-g-bezug, .friday-g-drei { grid-template-columns: 1fr; }
}

/* ----- Konsolidierung ----- */
.card.friday-g-kons {
  padding: 14px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--fr-rand, rgba(129, 140, 248, 0.35));
  box-shadow: inset 4px 0 0 var(--fr-blau, #3b82f6), var(--shadow);
}
.card.friday-g-laden {
  padding: 16px 18px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--fr-rand, rgba(129, 140, 248, 0.35));
}
.friday-g-laden-text {
  font-size: 13px;
  color: var(--text-muted);
}
.card.friday-g-kons-fehler {
  padding: 14px 18px;
  margin-bottom: 14px;
  color: var(--danger);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.friday-g-kons-kopf {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.friday-g-kons-karte {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
  background: var(--card-bg, #fff);
}
.friday-g-kons-karte.friday-g-erledigt { opacity: 0.7; }
.friday-g-kons-vergleich { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.friday-g-kons-raster { display: grid; grid-template-columns: 1fr 1fr 1.4fr 1.4fr; gap: 8px; margin-top: 8px; }
.friday-g-kons-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.friday-g-kons-vorher {
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f9fafb;
}
/* Die Felder der Karten stehen nicht in einer .form-group - eigene, gleich aussehende Optik. */
.friday-g-kons-karte textarea,
.friday-g-kons-karte input[type="text"],
.friday-g-kons-karte select {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--text);
}
.friday-g-kons-karte textarea { resize: vertical; line-height: 1.5; }
.friday-g-kons-karte textarea:focus,
.friday-g-kons-karte input[type="text"]:focus,
.friday-g-kons-karte select:focus {
  outline: none;
  border-color: var(--fr-blau, var(--primary));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
@media (max-width: 900px) {
  .friday-g-kons-vergleich { grid-template-columns: 1fr; }
  .friday-g-kons-raster { grid-template-columns: 1fr 1fr; }
}

/* ----- Fenster (Lauf-Protokoll, Historie) ----- */
.friday-g-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 16, 32, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}
.friday-g-fenster {
  background: var(--card-bg, #fff);
  border-radius: 14px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--fr-rand, rgba(129, 140, 248, 0.35));
}
.friday-g-fenster-lauf { max-width: 860px; max-height: 88vh; }
.friday-g-fenster-hist { max-width: 900px; height: 88vh; }

/* Dunkles HUD-Band mit feinem Raster und Verlaufskante */
.friday-g-hud {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  flex: 0 0 auto;
  color: var(--fr-text-hell, #e6ecff);
  background-color: var(--fr-nacht, #0b1020);
  background-image:
    linear-gradient(rgba(129, 140, 248, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 140, 248, 0.09) 1px, transparent 1px),
    radial-gradient(120% 200% at 0% 0%, rgba(34, 211, 238, 0.18), transparent 60%),
    linear-gradient(135deg, var(--fr-nacht, #0b1020), var(--fr-nacht-2, #121a36));
  background-size: 18px 18px, 18px 18px, 100% 100%, 100% 100%;
}
.friday-g-hud::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--fr-verlauf, linear-gradient(135deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%));
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}
.friday-g-hud-text { flex: 1; min-width: 0; }
.friday-g-hud-titel {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 1.5px;
  background: linear-gradient(90deg, #67e8f9 0%, #93c5fd 50%, #c4b5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.friday-g-hud-unter {
  font-size: 11px;
  color: rgba(230, 236, 255, 0.72);
  letter-spacing: 0.3px;
}
.friday-g-hud .btn.btn-secondary {
  background: var(--fr-glas, rgba(255, 255, 255, 0.06));
  color: var(--fr-text-hell, #e6ecff);
  border: 1px solid var(--fr-rand, rgba(129, 140, 248, 0.35));
}
.friday-g-hud .btn.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: var(--fr-glow, 0 0 18px rgba(56, 189, 248, 0.45));
}

/* Lauf-Protokoll */
.friday-g-lauf-kopf {
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 22px 8px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
}
.friday-g-lauf-inhalt {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  font-size: 13px;
  padding: 8px 22px;
}
.friday-g-block { margin: 6px 0; }
.friday-g-block > summary { cursor: pointer; font-weight: 600; }
.friday-g-block > pre {
  margin: 6px 0 0;
  padding: 8px 10px 8px 13px;
  background: var(--bg);
  border-radius: 6px;
  box-shadow: inset 3px 0 0 var(--fr-cyan, #22d3ee);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}
.friday-g-block-fehler > summary { color: var(--danger); }
.friday-g-fuss {
  display: flex;
  justify-content: flex-end;
  padding: 12px 22px 16px;
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
}
.friday-g-hinweis-leer { color: var(--text-muted); padding: 6px 0; }

/* Admin-Historie */
.friday-g-werkzeugleiste {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.friday-g-eingabe {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
}
.friday-g-eingabe:focus {
  outline: none;
  border-color: var(--fr-blau, var(--primary));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.friday-g-suchfeld { position: relative; flex: 0 1 300px; min-width: 150px; }
.friday-g-suchfeld .friday-g-eingabe { width: 100%; padding: 6px 28px 6px 30px; }
.friday-g-suchfeld-lupe {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.55;
  pointer-events: none;
}
.friday-g-suchfeld-leeren {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
}
.friday-g-info { font-size: 12px; color: var(--text-muted); min-width: 70px; }
.friday-g-luecke { flex: 1 1 auto; }
.friday-g-hist-liste {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.friday-g-hist-leer { margin: auto; color: var(--text-muted); font-size: 13px; }
.friday-g-hist-fehler { color: var(--danger); font-size: 13px; }
.friday-g-zeile { display: flex; flex-direction: column; }
.friday-g-zeile-nutzer { align-items: flex-end; }
.friday-g-zeile-ki { align-items: flex-start; }
.friday-g-zeile-kopf { font-size: 10px; color: var(--text-muted); margin-bottom: 2px; }
.friday-g-entfernt { color: var(--fr-violett, var(--primary)); }
.friday-g-blase {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.friday-g-blase-nutzer {
  border-bottom-right-radius: 4px;
  background: var(--fr-verlauf, linear-gradient(135deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%));
  color: #fff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
}
.friday-g-blase-ki {
  border-bottom-left-radius: 4px;
  color: var(--text);
  border: 1px solid var(--fr-rand, rgba(129, 140, 248, 0.35));
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.06), rgba(139, 92, 246, 0.06)),
    var(--card-bg, #fff);
  box-shadow: inset 3px 0 0 var(--fr-cyan, #22d3ee);
}
.friday-g-schritte-rahmen { max-width: 80%; }

/* Tagestrenner wie im Messenger */
.friday-g-tag {
  display: flex;
  justify-content: center;
  margin: 6px 0 2px;
}
.friday-g-tag > span {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

/* Werkzeugschritte unter einer Antwort - eingeklappt, grau */
.friday-g-schritte {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.friday-g-schritte > summary { cursor: pointer; user-select: none; }
.friday-g-schritte-liste { padding: 4px 0 2px; }
.friday-g-schritt {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  word-break: break-word;
}
.friday-g-schritt-fehler { color: var(--danger); }
.friday-g-schritt-dauer { color: var(--text-muted); }

/* Suchtreffer */
.friday-g-mark {
  background: rgba(34, 211, 238, 0.3);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.friday-g-mark-aktiv {
  background: #8b5cf6;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}
.friday-g-blase-nutzer .friday-g-mark { background: rgba(255, 255, 255, 0.35); color: #fff; }
.friday-g-blase-nutzer .friday-g-mark-aktiv {
  background: #fff;
  color: #4c1d95;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Sprungziel aus dem Gedaechtnis ("Nachricht"): leuchtet 2 s auf. */
.friday-g-hervorgehoben {
  outline: 3px solid var(--fr-cyan, #22d3ee);
  outline-offset: 3px;
  border-radius: 12px;
  box-shadow: var(--fr-glow, 0 0 18px rgba(56, 189, 248, 0.45));
  transition: outline-color 0.4s, box-shadow 0.4s;
}

@media (prefers-reduced-motion: reduce) {
  .btn.friday-g-knopf-kons { animation: none; }
}
