/* ============================================================
   Apollo Chat – Abschnitt „Apollo ausprobieren"
   ------------------------------------------------------------ */
/* Design nach nexis-demo: Schwarzes Panel, Haarlinien,
   Host Grotesk (Schrift), DM Mono (Labels/Mono-Kicker).
   Wird NACH apollo.css geladen. */
.achat { background: #0a0a0b; color: #f4f4f2; padding: clamp(4rem, 3rem + 6vw, 7rem) 0; }
.achat .container { max-width: var(--container, 1120px); margin: 0 auto; padding: 0 var(--gutter, 20px); }

.achat-kopf { margin-bottom: clamp(2rem, 1.2rem + 3vw, 3.5rem); }
.achat-kicker { font-family: "DM Mono", var(--font-mono, monospace); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: #a6a6a3; margin-bottom: 14px; }
.achat-titel { font-size: clamp(2.25rem, 1.2rem + 3.4vw, 4rem); font-weight: 400; line-height: 1; letter-spacing: -0.045em; color: #f4f4f2; margin: 0; }
.achat-lead { max-width: 46ch; margin-top: 18px; color: #a6a6a3; font-size: clamp(1rem, 0.95rem + 0.25vw, 1.1875rem); line-height: 1.5; }

.achat-grid { display: grid; gap: 1px; background: #242426; border: 1px solid #242426; border-radius: 12px; overflow: hidden; }
@media (min-width: 900px) { .achat-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 899px) { .achat-grid { grid-template-columns: 1fr; } }

/* ---------- Links: Chat (die Protokoll-Spalte gibt es nicht mehr) ---------- */
.achat-chat { background: #0e0e10; padding: clamp(1.25rem, 1rem + 1vw, 1.75rem); display: flex; flex-direction: column; gap: 14px; min-height: 620px; }

/* ---------- Agent-Auswahl: ein Button mit Ausklapp-Menü ---------- */
.achat-agentwahl { position: relative; }
.achat-agent-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border: 1px solid #2a2a2d; border-radius: 8px; background: #141416; color: #f4f4f2;
  font-family: "DM Mono", var(--font-mono, monospace); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.achat-agent-btn:hover { border-color: #4a4a4e; background: #1a1a1d; }
.achat-agent-pfeil { transition: transform 0.2s; color: #a6a6a3; }
.achat-agent-btn[aria-expanded="true"] .achat-agent-pfeil { transform: rotate(180deg); }
.achat-agent-menue {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 220px;
  margin: 0; padding: 6px; list-style: none;
  background: #141416; border: 1px solid #2a2a2d; border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.achat-agent-menue[hidden] { display: none; }
.achat-agent-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 40px; padding: 8px 12px; border: 0; border-radius: 7px;
  background: transparent; color: #d9d9d6; text-align: left;
  font-family: "DM Mono", var(--font-mono, monospace); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.achat-agent-option:hover, .achat-agent-option:focus-visible { background: #1a1a1d; color: #f4f4f2; outline: none; }
.achat-agent-option .achat-schloss { display: inline-flex; color: #7b7b78; }
.achat-agentwahl li[aria-selected="true"] .achat-agent-option { color: #f4f4f2; background: #1f1f22; }

/* ---------- Portrait-Leiste: Männchen direkt über der Chat-Zeile ---------- */
.achat-portrait-leiste {
  height: 120px; margin: -4px 0 2px; display: flex; justify-content: center;
  background: transparent; border: 0; border-radius: 0; position: relative;
}
.achat-portrait-leiste .achat-portrait {
  aspect-ratio: auto; width: 100%; height: 100%;
  border: 0; border-radius: 0; background: transparent; cursor: pointer;
}

.achat-verlauf { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 320px; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #2a2a2d transparent; }
.achat-verlauf:empty::after { content: "Stelle eine Frage zu Apollo – oder wähle einen Einstieg unten."; color: #6f6f6c; font-size: 0.875rem; line-height: 1.5; padding: 6px 0; overflow-wrap: anywhere; word-break: break-word; }

.achat-msg { display: flex; }
.achat-msg-user { justify-content: flex-end; }
.achat-msg-inhalt { max-width: 82%; padding: 10px 14px; border-radius: 10px; font-size: 0.9375rem; line-height: 1.5; }
.achat-msg-user .achat-msg-inhalt { background: #1a1a1d; color: #f4f4f2; }
.achat-msg-agent .achat-msg-inhalt { background: transparent; border: 1px solid #242426; color: #d9d9d6; }

/* ---------- Vorschläge: endloses Laufband (eine Zeile, wandert nach rechts und kommt wieder) ---------- */
.achat-chips { display: block; overflow: hidden; position: relative; padding: 4px 0;
  /* Seiten-Ausblendung: Chips lösen sich sanft am Rand auf */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 36px, #000 calc(100% - 36px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 36px, #000 calc(100% - 36px), transparent 100%); }
.achat-chips[hidden] { display: none; }
.achat-chips-bahn { display: flex; gap: 8px; width: max-content; animation: achat-laufband 32s linear infinite; will-change: transform; }
.achat-chips-seg { display: flex; gap: 8px; flex: 0 0 auto; }
@keyframes achat-laufband {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}
.achat-chips:hover .achat-chips-bahn, .achat-chips:focus-within .achat-chips-bahn { animation-play-state: paused; }
.achat-chip {
  flex: 0 0 auto; padding: 7px 14px; border: 1px solid #2a2a2d; border-radius: 999px; background: #0e0e10; color: #d9d9d6;
  font-size: 0.8125rem; cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.achat-chip:hover { border-color: #4a4a4e; background: #141416; color: #f4f4f2; }

/* ---------- Eingabe: Feld exakt so hoch wie der Sende-Button ---------- */
.achat-eingabe { display: flex; gap: 8px; align-items: stretch; }
.achat-feld {
  flex: 1; height: 52px; min-height: 52px; padding: 14px; border-radius: 10px; border: 1px solid #2a2a2d;
  background: #111113; color: #f4f4f2; font-size: 0.9375rem; resize: none; overflow-y: auto;
  box-sizing: border-box;
}
.achat-feld:focus { outline: none; border-color: #4a4a4e; }
.achat-feld:disabled { opacity: 0.45; cursor: not-allowed; }
.achat-feld::placeholder { color: #6f6f6c; }
.achat-senden {
  height: 52px; min-height: 52px; padding: 0 22px; border-radius: 10px; border: 1px solid #3a3a3d;
  background: #f4f4f2; color: #0a0a0b; font-size: 0.875rem; font-weight: 500; cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.achat-senden:hover { background: #ffffff; }
.achat-senden:disabled { opacity: 0.4; cursor: not-allowed; }

.achat-fuss { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.achat-zaehler { font-family: "DM Mono", var(--font-mono, monospace); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: #7b7b78; }
.achat-hinweis { font-size: 0.75rem; color: #6f6f6c; }
.achat-hinweis-text::before { content: "Demo. Bitte keine vertraulichen Daten eingeben."; }
.achat-sperrbox { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #2a2a2d; border-radius: 8px; background: #131315; }
.achat-sperrbox[hidden] { display: none; }
.achat-sperrbox p { margin: 0; font-size: 0.8125rem; color: #a6a6a3; }
.achat-sperrbox a { white-space: nowrap; }

/* ---------- Portrait selbst (früher im Protokoll-Panel) ---------- */
.achat-portrait { max-width: 100%; min-width: 0; }
.achat-portrait canvas { display: block; width: 100%; height: 100%; min-width: 0; }

/* ---------- Schloss-Dialog ---------- */
.achat-dialog { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(5, 5, 6, 0.7); padding: 20px; }
.achat-dialog[hidden] { display: none; }
.achat-dialog-box {
  width: min(420px, 100%); background: #141416; border: 1px solid #2a2a2d; border-radius: 12px;
  padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); text-align: left;
}
.achat-dialog-titel { margin: 0 0 10px; font-size: 1.0625rem; font-weight: 500; letter-spacing: -0.01em; color: #f4f4f2; display: flex; align-items: center; gap: 10px; }
.achat-dialog-titel .achat-schloss { color: #a6a6a3; }
.achat-dialog-text { margin: 0 0 18px; font-size: 0.875rem; line-height: 1.5; color: #a6a6a3; }
.achat-dialog-aktionen { display: flex; gap: 10px; flex-wrap: wrap; }
.achat-dialog-btn {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 18px; border-radius: 8px;
  background: #f4f4f2; color: #0a0a0b; font-size: 0.875rem; font-weight: 500; cursor: pointer; border: 0;
}
.achat-dialog-btn:hover { background: #ffffff; }
.achat-dialog-schliessen {
  margin-left: auto; display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px;
  border-radius: 8px; background: transparent; color: #a6a6a3; border: 1px solid #2a2a2d;
  font-size: 0.875rem; cursor: pointer;
}
.achat-dialog-schliessen:hover { color: #f4f4f2; border-color: #4a4a4e; }

/* ---------- Schloss-Symbol (inline SVG) ---------- */
.achat-schloss svg { width: 12px; height: 12px; display: block; }

/* ---------- Scroll-Einblenden ---------- */
.achat .m-reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.has-motion .achat .m-reveal.m-in { opacity: 1; transform: none; }

/* ============================================================
   Terminator-Angriff: Shake, Risse, Funken, Bruchstücke, Neustart
   ============================================================ */
.achat-bebt { }
.achat-bebt .achat-grid { animation: achat-wackelt 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes achat-wackelt {
  0% { transform: translate(0, 0); } 12% { transform: translate(-4px, 2px); } 25% { transform: translate(3px, -2px); }
  40% { transform: translate(-3px, -1px); } 55% { transform: translate(2px, 2px); }
  70% { transform: translate(-2px, 1px); } 85% { transform: translate(1px, -1px); } 100% { transform: translate(0, 0); }
}

/* Risse als SVG-Overlay über dem Grid */
.achat-risse {
  position: absolute; inset: 0; z-index: 5; width: 100%; height: 100%;
  color: rgba(244, 244, 242, 0.85); pointer-events: none;
}
.achat-grid { position: relative; }

/* Funken-Kurzblitz (rot) */
.achat-funken {
  position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background:
    radial-gradient(circle at 22% 30%, rgba(255, 59, 48, 0.45) 0, transparent 34%),
    radial-gradient(circle at 76% 22%, rgba(255, 59, 48, 0.38) 0, transparent 30%),
    linear-gradient(90deg, transparent 0 46%, rgba(255, 59, 48, 0.22) 50%, transparent 54% 100%);
  animation: achat-funken-weg 1s ease-out forwards;
  mix-blend-mode: screen;
}
@keyframes achat-funken-weg { from { opacity: 1; } to { opacity: 0; } }

/* Bruchstücke: Nachrichten-/Feld-Chips fliegen heraus */
.achat-bruchstueck {
  position: absolute; z-index: 7; max-width: 180px; padding: 6px 10px;
  border: 1px solid #2a2a2d; border-radius: 8px; background: #141416; color: #d9d9d6;
  font-size: 0.75rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  pointer-events: none; transform: translate(0, 0) rotate(0);
  animation: achat-fliegt 1.3s cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}
.achat-bruchstueck-feld { min-height: 44px; max-width: none; }
@keyframes achat-fliegt {
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 90px), var(--dy, -80px)) rotate(var(--rot, 20deg)); }
}

/* Chat-Bereich nach dem Angriff: klappt zusammen */
.achat-zerstoert { overflow: hidden; }
.achat-zerstoert .achat-chat {
  transform: translateY(38%) scaleY(0.02); opacity: 0;
  transform-origin: top center;
  transition: transform 0.65s cubic-bezier(0.5, 0, 0.75, 0.2), opacity 0.5s ease;
}

/* Neustart-Knopf (tastaturbedienbar) */
.achat-neustart { display: flex; justify-content: center; padding: 26px 0 8px; }
.achat-neustart-btn {
  min-height: 44px; padding: 10px 22px; border-radius: 8px; cursor: pointer;
  background: #ff3b30; border: 0; color: #0a0a0b; font-weight: 500; font-size: 0.9375rem;
}
.achat-neustart-btn:hover { background: #ff544b; }
.achat-neustart-btn:focus-visible { outline: 2px solid #f4f4f2; outline-offset: 3px; }

/* Reduzierte Bewegung: ohne Shake/Funken/Bruchstücke und ohne Laufband */
@media (prefers-reduced-motion: reduce) {
  .achat-bebt .achat-grid { animation: none; }
  .achat-funken, .achat-bruchstueck { animation-duration: 0.01s; opacity: 0; }
  .achat-zerstoert .achat-chat { transition: none; }
  .achat-chips-bahn { animation: none; }
}

/* ---------- Mobil ---------- */
@media (max-width: 899px) {
  .achat-grid { grid-template-columns: minmax(0, 1fr); }
  .achat-chat { min-width: 0; max-width: 100%; overflow-x: hidden; gap: 10px; min-height: auto; }
  .achat-verlauf { max-height: 260px; min-height: 150px; }
  .achat-portrait-leiste { height: 96px; }

  /* Vorschläge: Laufband läuft auch mobil, ohne Seitenränder */
  .achat-chips { margin: 0 calc(-1 * clamp(1.25rem, 1rem + 1vw, 1.75rem)); }
  .achat-chip { max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Senden wird zum Pfeil-Button */
  .achat-eingabe { align-items: stretch; }
  .achat-senden { flex: 0 0 auto; width: 52px; padding: 0; font-size: 1.05rem; }
}
@media (max-width: 480px) {
  .achat-agent-menue { min-width: 200px; }
}

.achat-msg-inhalt { white-space: pre-line; }
.achat-msg { flex-shrink: 0; }
.achat-verlauf { max-height: 620px; }
.achat-msg-agent .achat-msg-inhalt { max-width: 92%; }

/* ============================================================
   Schwebende Version: Agenten-Fenster unten rechts im Apollo-Panel
   (apollo.js öffnet über den Assistent-Knopf das volle Agenten-UI)
   ============================================================ */
.apollo .apollo-panel-agent { width: min(420px, calc(100vw - 32px)); max-height: min(760px, calc(100svh - 132px)); overflow: visible; }
.apollo .apollo-panel-agent .achat-grid {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: #0e0e10; border: 1px solid #242426;
  border-left: 0; border-right: 0; border-bottom: 0;
}
.apollo .apollo-panel-agent .achat-chat { min-height: 0; padding: 12px 14px 14px; gap: 10px; }
.apollo .apollo-panel-agent .achat-verlauf { flex: 1; min-height: 110px; max-height: 320px; }
.apollo .apollo-panel-agent .achat-portrait-leiste { flex: none; height: 96px; }
.apollo .apollo-panel-agent .achat-chips { margin-left: -14px; margin-right: -14px; }
.apollo .apollo-panel-agent .achat-feld { height: 44px; min-height: 44px; padding: 10px 14px; }
.apollo .apollo-panel-agent .achat-senden
  { width: 44px; min-height: 44px; height: 44px; padding: 0; font-size: 1rem; }
.apollo .apollo-panel-agent .achat-neustart { padding: 14px 0 14px; }
.apollo .achat-dialog { z-index: 90; }
.apollo .achat-agent-menue { z-index: 30; }
/* Leere Platzhalterzeile im Verlauf */
.apollo:lang(en) .achat-verlauf:empty::after { content: "Ask a question about Apollo – or pick a suggestion below."; }
.apollo:lang(en) .achat-hinweis-text::before { content: "Demo. Please do not enter confidential data."; }

@media (prefers-reduced-motion: reduce) {
  .apollo .achat-chips-bahn { animation: none; }
}
@media (max-width: 640px) {
  .apollo .apollo-panel-agent { width: 100%; max-height: min(72svh, 560px); }
}
