/* Help-Popover für PrivateAI Admin/Cockpit.
 * Dunkles Theme passt zur Cockpit-Optik, blauer Akzent aus den
 * --ci-*-Variablen. Floatet rechts unten, nicht modal. */

.pai-help-root {
  position: fixed;
  inset: 0;
  pointer-events: none;       /* Hintergrund nicht blockieren */
  z-index: 9000;
}
.pai-help-pop {
  position: absolute;
  right: 24px;
  bottom: 24px;
  width: 420px;
  max-height: calc(100vh - 100px);
  min-height: 0;
  background: var(--card, #1a1d27);
  color: var(--text, #e2e8f0);
  border: 1px solid var(--border, #2d3148);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.55), 0 4px 10px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.pai-help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-raised, #131720);
  border-bottom: 1px solid var(--border, #2d3148);
  gap: 8px;
}
.pai-help-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 600;
  color: var(--ci-accent, #42A5F5);
}
.pai-help-badge {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-muted, #94a3b8);
}
.pai-help-tools { display: flex; gap: 4px; }
.pai-help-tool {
  background: transparent;
  border: 0;
  color: var(--ci-accent, #42A5F5);
  font-size: 14px;
  width: 26px; height: 26px;
  border-radius: 4px;
  cursor: pointer;
}
.pai-help-tool:hover { background: var(--border, #2d3148); }

.pai-help-settings {
  padding: 10px 12px;
  background: var(--bg-raised, #131720);
  border-bottom: 1px solid var(--border, #2d3148);
}
.pai-help-settings-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ci-accent, #42A5F5);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
}
.pai-help-settings-row { display: flex; gap: 4px; }
.pai-help-pref {
  flex: 1;
  background: var(--card, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  color: var(--text, #e2e8f0);
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
}
.pai-help-pref-active {
  background: var(--ci-primary, #1565C0);
  color: #fff;
  border-color: var(--ci-primary, #1565C0);
}
.pai-help-settings-hint {
  font-size: 10.5px;
  color: var(--text-muted, #94a3b8);
  margin-top: 6px;
  line-height: 1.4;
}
.pai-help-settings-hint strong { color: var(--ci-accent, #42A5F5); }

.pai-help-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pai-help-body::-webkit-scrollbar { width: 8px; }
.pai-help-body::-webkit-scrollbar-track { background: transparent; }
.pai-help-body::-webkit-scrollbar-thumb { background: var(--border, #2d3148); border-radius: 4px; }
.pai-help-body::-webkit-scrollbar-thumb:hover { background: var(--ci-primary, #1565C0); }

.pai-help-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 6px;
}
.pai-help-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pai-help-card {
  background: var(--bg-raised, #131720);
  border: 1px solid var(--border, #2d3148);
  color: var(--text, #e2e8f0);
  border-radius: 6px;
  padding: 8px 10px;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.3;
  cursor: pointer;
}
.pai-help-card:hover { background: var(--border, #2d3148); }

.pai-help-msg { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.pai-help-msg-user {
  align-self: flex-end;
  background: var(--ci-primary, #1565C0);
  color: #fff;
  padding: 6px 10px;
  border-radius: 10px 10px 0 10px;
  max-width: 85%;
}
.pai-help-msg-assistant {
  align-self: flex-start;
  background: var(--bg-raised, #131720);
  color: var(--text, #e2e8f0);
  padding: 8px 10px;
  border-radius: 10px 10px 10px 0;
  max-width: 95%;
}
.pai-help-msg-body { line-height: 1.5; word-wrap: break-word; }
.pai-help-msg-body strong { color: var(--ci-accent, #42A5F5); font-weight: 600; }
.pai-help-msg-body code {
  background: var(--card, #1a1d27);
  border: 1px solid var(--border, #2d3148);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
}
.pai-help-msg-body blockquote {
  margin: 6px 0;
  padding: 4px 10px;
  border-left: 3px solid var(--ci-primary, #1565C0);
  background: rgba(21,101,192,0.08);
  color: var(--text, #e2e8f0);
  font-style: italic;
}
.pai-help-msg-body ul { margin: 4px 0; padding-left: 20px; }
.pai-help-msg-body li { margin-bottom: 2px; }
.pai-help-msg-body p { margin: 0 0 6px; }
/* Warten auf die Antwort — der drehende Würfel der Bildmarke statt drei
   Punkte, wie im Docki-Chat und in dessen Hilfe. Die Punkt-Regeln samt
   `pai-help-bounce` sind damit entfallen, sie hatten keinen weiteren Nutzer. */
.pai-help-busy { display: flex; align-items: center; padding: 4px 10px; }
.pai-help-wuerfel { display: block; }

.pai-help-cites { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.pai-help-cite {
  font-size: 10.5px;
  background: var(--ci-primary, #1565C0);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
}
.pai-help-cite:hover { filter: brightness(1.15); }
.pai-help-fallback {
  color: var(--warning, #f59e0b);
  font-size: 11px;
  font-style: italic;
  margin-top: 4px;
}

.pai-help-input-row {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #2d3148);
  background: var(--card, #1a1d27);
}
.pai-help-input {
  flex: 1;
  border: 1px solid var(--border, #2d3148);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  background: var(--bg, #0f1117);
  color: var(--text, #e2e8f0);
}
.pai-help-input:focus { outline: 2px solid var(--ci-accent, #42A5F5); outline-offset: -1px; border-color: transparent; }
.pai-help-send {
  background: var(--ci-primary, #1565C0);
  color: #fff;
  border: 0;
  border-radius: 6px;
  width: 36px; height: 34px;
  cursor: pointer;
  /* wie beim Mikrofon: gezeichneter Pfeil statt „↑", darum echte Zentrierung.
     Höhe gleich dem Mikrofon-Knopf daneben. */
  display: flex;
  align-items: center;
  justify-content: center;
}
.pai-help-send:hover { background: var(--ci-navy, #0D47A1); }
.pai-help-send:disabled { background: var(--border, #2d3148); cursor: not-allowed; }
.pai-help-foot {
  font-size: 10.5px;
  color: var(--text-muted, #94a3b8);
  padding: 6px 12px;
  background: var(--bg-raised, #131720);
  border-top: 1px solid var(--border, #2d3148);
}

/* Topbar-Hilfe-Button */
.topbar-help-btn {
  background: transparent;
  border: 1px solid var(--border, #2d3148);
  color: var(--ci-accent, #42A5F5);
  border-radius: 6px;
  width: 34px; height: 34px;
  font-size: 15px;
  cursor: pointer;
  margin-right: 8px;
}
.topbar-help-btn:hover {
  background: var(--ci-primary, #1565C0);
  color: #fff;
  border-color: var(--ci-primary, #1565C0);
}

/* Demo-Layer (Phase 5) — Banner oben über alles */
.pai-help-demo-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: linear-gradient(90deg, #b45309 0%, #d97706 100%);
  color: #fff;
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.pai-help-demo-pill {
  background: #fff;
  color: #b45309;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
}
.pai-help-demo-text { flex: 1; }
.pai-help-demo-end {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 4px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}
.pai-help-demo-end:hover { background: rgba(255, 255, 255, 0.30); }

/* Walkthrough (B3) — geführte Tour */
.pai-help-walk-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9100;
}
.pai-help-walk-ring {
  position: absolute;
  border: 2px solid var(--ci-primary, #1565C0);
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.4), 0 0 24px rgba(21,101,192,0.55);
  pointer-events: none;
}
.pai-help-walk-tip {
  position: absolute;
  width: 360px;
  pointer-events: auto;
  background: var(--card, #1a1d27);
  color: var(--text, #e2e8f0);
  border: 1px solid var(--ci-primary, #1565C0);
  border-radius: 10px;
  padding: 14px 16px 12px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.55);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.pai-help-walk-tip-risk { border-color: var(--warning, #f59e0b); }
.pai-help-walk-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.pai-help-walk-step {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ci-accent, #42A5F5); font-weight: 600;
}
.pai-help-walk-x {
  background: transparent; border: 0; color: var(--text-muted, #94a3b8);
  cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px;
}
.pai-help-walk-title {
  margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--text, #e2e8f0);
}
.pai-help-walk-body { margin: 0 0 12px; color: var(--text, #e2e8f0); line-height: 1.5; }
.pai-help-walk-body strong { color: var(--ci-accent, #42A5F5); }
.pai-help-walk-warn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--warning, #f59e0b);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0 0 10px;
  font-size: 12.5px;
  color: #fed7aa;
}
.pai-help-walk-warn strong { color: var(--warning, #f59e0b); }
.pai-help-walk-restart {
  font-size: 11.5px; color: var(--text-muted, #94a3b8);
  margin: -6px 0 10px; font-style: italic;
}
.pai-help-walk-await {
  background: rgba(66,165,245,0.12);
  border-left: 3px solid var(--ci-accent, #42A5F5);
  padding: 6px 10px; margin: 0 0 10px; font-size: 12px;
  color: var(--ci-accent, #42A5F5); border-radius: 0 4px 4px 0;
}
.pai-help-walk-foot {
  display: flex; gap: 8px; align-items: center;
}
.pai-help-walk-btn {
  background: var(--ci-primary, #1565C0); color: #fff; border: 0;
  border-radius: 6px; padding: 7px 14px; cursor: pointer; font-size: 13px; font-weight: 500;
  margin-left: auto;
}
.pai-help-walk-btn-confirm {
  background: var(--warning, #f59e0b);
}
.pai-help-walk-btn-confirm:disabled {
  background: rgba(245,158,11,0.4); color: rgba(255,255,255,0.7); cursor: not-allowed;
}
.pai-help-walk-btn-ghost {
  background: transparent; color: var(--text-muted, #94a3b8);
  border: 1px solid var(--border, #2d3148); border-radius: 6px;
  padding: 7px 14px; cursor: pointer; font-size: 13px;
}
.pai-help-walk-btn-ghost:hover { background: var(--border, #2d3148); }

/* Spotlight (B2) — kurzes Highlight */
.pai-help-spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8999;
}
.pai-help-spot-ring {
  position: absolute;
  border: 2px solid var(--ci-primary, #1565C0);
  border-radius: 8px;
  animation: pai-help-pulse 1.5s ease-out infinite;
}
@keyframes pai-help-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(21,101,192,0.55); }
  70%  { box-shadow: 0 0 0 14px rgba(21,101,192,0); }
  100% { box-shadow: 0 0 0 0   rgba(21,101,192,0); }
}
.pai-help-spot-label {
  position: absolute;
  max-width: 240px;
  background: var(--card, #1a1d27);
  border: 1px solid var(--ci-primary, #1565C0);
  color: var(--text, #e2e8f0);
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 3px solid var(--ci-primary, #1565C0);
}

/* Kapitel-Verweise in Hilfe-Antworten → klickbar aufs Handbuch */
.pai-help-kaplink {
  color: var(--ci-accent, #42A5F5);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.pai-help-kaplink:hover { opacity: 0.85; }

/* Link-Popup: kleine Auswahl beim Klick auf einen Kapitel-Verweis */
.pai-help-linkcard {
  position: fixed;
  z-index: 100000;
  min-width: 200px;
  max-width: 280px;
  background: var(--surface, #1a1d2e);
  border: 1px solid var(--border, #2c3148);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: 10px;
}
.pai-help-linkcard-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #e6e9f2);
  margin-bottom: 8px;
  line-height: 1.3;
}
.pai-help-linkcard-actions { display: flex; gap: 6px; }
.pai-help-linkcard-btn {
  flex: 1;
  font-size: 11.5px;
  padding: 5px 8px;
  border: 1px solid var(--border, #2c3148);
  border-radius: 5px;
  background: var(--surface-2, #232740);
  color: var(--text, #e6e9f2);
  cursor: pointer;
  white-space: nowrap;
}
.pai-help-linkcard-btn:hover { filter: brightness(1.2); }
.pai-help-linkcard-btn-primary {
  background: var(--ci-accent, #42A5F5);
  border-color: var(--ci-accent, #42A5F5);
  color: #0b1020;
}

/* Mikrofon-Button im Hilfe-Eingabefeld (Diktat → /api/transcribe) */
.pai-help-mic {
  flex: 0 0 auto;
  background: var(--surface, #1a1d2e);
  color: var(--ci-accent, #42A5F5);
  border: 1px solid var(--border, #2d3148);
  border-radius: 6px;
  width: 34px; height: 34px;
  cursor: pointer;
  /* Zentriert das gezeichnete Symbol. Als Emoji saß es auf der Textgrundlinie
     und hing dadurch sichtbar zu tief im Knopf. */
  display: flex;
  align-items: center;
  justify-content: center;
}
.pai-help-mic:hover { background: var(--border, #2d3148); }
.pai-help-mic:disabled { opacity: 0.5; cursor: default; }
.pai-help-mic--rec {
  background: #c62828; color: #fff; border-color: #c62828;
  animation: pai-help-mic-pulse 1.1s ease-in-out infinite;
}
@keyframes pai-help-mic-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
