/* ============================================================
   IDA Website v3 — klickbare Demo (demo.css)
   Gehört EXKLUSIV zur Demo (demo.js). Alles ist unter .idemo-*
   bzw. #demo-bar / #mac-handoff genamespaced — keine globalen
   Selektoren, keine externen Ressourcen, keine Fonts von außen.

   Die Leiste ist ein 1:1-Nachbau von renderer/mini.css
   (Kandidat L/M, Thema "hell"): alle Maße nativ in px, die
   Skalierung übernimmt ausschließlich der Stage-Container
   (transform: scale auf .idemo-screen, gesetzt von demo.js).
   ============================================================ */

/* ---- Farbtokens (Thema "hell" = Demo-Standard) ---- */
.idemo {
  --pill-bg: rgba(255, 255, 255, 0.97);
  --pill-bg-rec: rgba(255, 246, 246, 0.98);
  --pill-ring: rgba(16, 24, 40, 0.12);
  --pill-ring-rec: rgba(229, 72, 77, 0.35);
  --pill-shadow: 0 2px 12px rgba(16, 24, 40, 0.16), 0 1px 3px rgba(16, 24, 40, 0.1);
  --pill-text: #14171c;
  --pill-label: #3f4852;
  --pill-icon: #5c6470;
  --pill-icon-hover: #14171c;
  --pill-hover: rgba(11, 29, 58, 0.08);
  --btn-bg: rgba(11, 29, 58, 0.06);
  --btn-border: rgba(11, 29, 58, 0.14);
  --btn-hover: rgba(11, 29, 58, 0.12);
  --wave: #0e8074;
  --spin-track: rgba(11, 29, 58, 0.15);
  --spin-head: #0e8074;
  --check: #176e4c;
  --ok-dot: #1f9a6e;
  --rec-dot: #e5484d;
  --rec-glow: rgba(229, 72, 77, 0.28);
  --rec-pulse-opacity: 1;
  --mic-bg: #0e8074;
  --mic-rec-bg: #e0354b;
  --mic-fg: #ffffff;

  /* Fenster-/Panel-Palette (großes IDA-Fenster, hell) */
  --win-bg: #f6f7f9;
  --win-card: #ffffff;
  --win-text: #14171c;
  --win-muted: #5c6470;
  --win-border: #e3e6ea;
  --win-navy: #0b1d3a;
  --teal-text: #0a7662;
  --chip-bg: #e4f5f0;
  --chip-border: rgba(14, 128, 116, 0.35);
  --ok-pill-bg: #dff2e8;
  --ok-pill-text: #176e4c;
  --marker-bg: #fff4d6;
  --marker-text: #7a5a00;

  /* Demo-Desktop (dunkel, damit die weiße Pille trägt) */
  --desk-a: #101a2b;
  --desk-b: #0c2733;
  --desk-c: #123c3a;
}
/* Thema "dunkel" — für später mitgeführt, per data-theme aktivierbar */
.idemo[data-theme="dunkel"] {
  --pill-bg: rgba(9, 10, 12, 0.96);
  --pill-bg-rec: rgba(18, 9, 11, 0.96);
  --pill-ring: transparent;
  --pill-ring-rec: transparent;
  --pill-shadow: 0 2px 10px rgba(0, 0, 0, 0.32), 0 1px 3px rgba(0, 0, 0, 0.28);
  --pill-text: #f2f5f6;
  --pill-label: #c9d1d5;
  --pill-icon: #9aa6ac;
  --pill-icon-hover: #ffffff;
  --pill-hover: rgba(255, 255, 255, 0.1);
  --btn-bg: rgba(255, 255, 255, 0.09);
  --btn-border: rgba(255, 255, 255, 0.12);
  --btn-hover: rgba(255, 255, 255, 0.18);
  --wave: rgba(255, 255, 255, 0.92);
  --spin-track: rgba(255, 255, 255, 0.2);
  --spin-head: #7fd6cb;
  --check: #35c08e;
  --ok-dot: #2fae82;
  --rec-dot: #ff4d63;
  --rec-glow: rgba(255, 77, 99, 0.22);
  --rec-pulse-opacity: 0.7;
}

/* ---- Handoff-Container: Transform wird VON AUSSEN gesetzt ---- */
#mac-handoff {
  display: block;
  width: 100%;
  /* bewusst KEIN transform hier — der gehört der Seite (Scroll-Handoff) */
}

/* ---- Mac-Display-Rahmen ---- */
.idemo-frame {
  position: relative;
  border-radius: clamp(10px, 1.6vw, 18px);
  background: linear-gradient(180deg, #2a2d33, #17191d 60%, #101216);
  padding: clamp(6px, 1vw, 12px);
  box-shadow:
    0 30px 60px -25px rgba(4, 12, 24, 0.55),
    0 8px 22px -12px rgba(4, 12, 24, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.idemo-frame::after {
  /* dezenter Fuß / Kinnleiste */
  content: "";
  display: block;
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 22%;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
}

/* ---- Stage: fixes Seitenverhältnis, JS skaliert den Screen ---- */
.idemo-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 640;
  overflow: hidden;
  border-radius: clamp(6px, 0.9vw, 10px);
  background: #0c1420;
}
.idemo-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 960px;
  height: 640px;
  transform-origin: 0 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  background:
    radial-gradient(1000px 520px at 76% -8%, rgba(31, 196, 168, 0.16), transparent 60%),
    radial-gradient(900px 600px at 12% 110%, rgba(18, 60, 58, 0.55), transparent 65%),
    linear-gradient(160deg, var(--desk-a), var(--desk-b) 55%, var(--desk-c));
}

/* ---- angedeuteter Praxis-Desktop (rein abstrakt, kein Screenshot) ---- */
.idemo-menubar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  font-size: 11.5px;
  color: rgba(235, 242, 246, 0.72);
  background: rgba(10, 16, 26, 0.45);
  backdrop-filter: blur(2px);
}
.idemo-menubar .mb-app { font-weight: 600; }
.idemo-menubar .mb-item { opacity: 0.6; }
.idemo-menubar .mb-clock { margin-left: auto; font-variant-numeric: tabular-nums; opacity: 0.75; }

/* angedeutetes PVS-Fenster: nur Formen und Platzhalterzeilen */
.idemo-pvs {
  position: absolute;
  top: 48px;
  left: 36px;
  width: 660px;
  height: 400px;
  border-radius: 10px;
  background: rgba(238, 241, 245, 0.92);
  box-shadow: 0 18px 40px -18px rgba(3, 10, 20, 0.6);
  overflow: hidden;
  opacity: 0.9;
}
.idemo-pvs .pvs-title {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: #e6e9ee;
  border-bottom: 1px solid #d6dae1;
}
.idemo-pvs .pvs-dot { width: 9px; height: 9px; border-radius: 50%; background: #c9ced6; }
.idemo-pvs .pvs-name { margin-left: 6px; font-size: 11px; color: #6a7482; }
.idemo-pvs .pvs-body { display: flex; height: calc(100% - 30px); }
.idemo-pvs .pvs-side {
  width: 160px;
  border-right: 1px solid #dfe3e9;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.idemo-pvs .pvs-side i {
  display: block;
  height: 20px;
  border-radius: 5px;
  background: #dde2e9;
}
.idemo-pvs .pvs-side i:nth-child(2) { background: #cfe9e2; }
.idemo-pvs .pvs-main { flex: 1; padding: 12px 14px; }
.idemo-pvs .pvs-main i {
  display: block;
  height: 11px;
  border-radius: 4px;
  background: #e2e6ec;
  margin-bottom: 9px;
}
.idemo-pvs .pvs-main i.w40 { width: 40%; }
.idemo-pvs .pvs-main i.w65 { width: 65%; }
.idemo-pvs .pvs-main i.w80 { width: 80%; }
.idemo-pvs .pvs-main i.w55 { width: 55%; }
.idemo-pvs .pvs-main i.head { height: 16px; width: 34%; background: #d5dae2; margin-bottom: 14px; }

/* ---- Badge "Simulation · ohne Mikrofon" ---- */
.idemo-badge {
  position: absolute;
  top: 38px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #dff5ef;
  background: rgba(10, 22, 30, 0.66);
  border: 1px solid rgba(127, 214, 203, 0.35);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.idemo-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7fd6cb;
}

/* ============================================================
   IDA-Leiste — Werte 1:1 aus renderer/mini.css (Kandidat L/M)
   ============================================================ */
#demo-bar {
  position: absolute;
  left: 50%;
  bottom: 10px; /* --bar-offset Original-Default */
  transform: translateX(-50%);
  height: 40px;
  width: 330px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 20px;
  background: var(--pill-bg);
  box-shadow: 0 0 0 1px var(--pill-ring), var(--pill-shadow);
  color: var(--pill-text);
  font-size: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  cursor: pointer;
  border: none;
  transition:
    width 0.34s cubic-bezier(0.32, 0.72, 0, 1),
    background 0.25s ease,
    box-shadow 0.25s ease;
}
#demo-bar:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 1px var(--pill-ring),
    0 0 0 3px rgba(14, 128, 116, 0.45),
    var(--pill-shadow);
}
#demo-bar.m-min { width: 64px; justify-content: center; }
#demo-bar.m-rec { width: 150px; justify-content: center; cursor: pointer; }
#demo-bar.m-max { width: 330px; }
#demo-bar.m-max.result { width: 372px; cursor: default; }
#demo-bar.m-min .spacer, #demo-bar.m-rec .spacer { display: none; }
#demo-bar.recording {
  background: var(--pill-bg-rec);
  box-shadow: 0 0 0 1px var(--pill-ring-rec), var(--pill-shadow);
}

/* Einsteigende Inhalte (Neu-Einblenden retriggert die Animation) */
#demo-bar .seg,
#demo-bar #time,
#demo-bar #label,
#demo-bar .spinner,
#demo-bar .check,
#demo-bar .txt-btn,
#demo-bar .icon-btn,
#demo-bar .dot.rec {
  animation: idemo-rise 0.26s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes idemo-rise {
  from { opacity: 0; transform: translateY(4px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.idemo .hidden { display: none !important; }
#demo-bar .spacer { flex: 1; }

#demo-bar .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
#demo-bar .dot.ok { background: var(--ok-dot); }
#demo-bar .dot.rec {
  width: 7px;
  height: 7px;
  background: var(--rec-dot);
  animation: idemo-rise 0.26s cubic-bezier(0.32, 0.72, 0, 1),
    idemo-pulse 1.2s ease-in-out infinite;
}
@keyframes idemo-pulse {
  50% { box-shadow: 0 0 0 5px var(--rec-glow); opacity: var(--rec-pulse-opacity); }
}

/* Mikro-/Stopp-Knopf */
#demo-bar #mic-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--mic-bg);
  color: var(--mic-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.18s cubic-bezier(0.32, 0.72, 0, 1);
}
#demo-bar #mic-btn:hover { transform: scale(1.1); }
#demo-bar #mic-btn:active { transform: scale(0.96); }
#demo-bar.recording #mic-btn { background: var(--mic-rec-bg); }
#demo-bar .stop-square { width: 9px; height: 9px; border-radius: 2px; background: var(--mic-fg); }

/* sanfter Hinweis-Puls im Bereitzustand (alle 3.2 s, 600 ms Hub) */
.idemo.is-visible #demo-bar.ready #mic-btn {
  animation: idemo-hint 3.2s ease-in-out infinite;
}
@keyframes idemo-hint {
  0%, 18.75%, 100% { transform: scale(1); }
  9.4% { transform: scale(1.06); }
}
.idemo.is-visible #demo-bar.ready #mic-btn:hover { animation: none; transform: scale(1.1); }

/* Pegel */
#demo-bar #wave { display: flex; gap: 2.5px; height: 18px; align-items: center; }
#demo-bar #wave i {
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: var(--wave);
  transition: height 0.09s ease;
}

#demo-bar #time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }
#demo-bar #label { color: var(--pill-label); white-space: nowrap; }

#demo-bar .spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--spin-track);
  border-top-color: var(--spin-head);
  border-radius: 50%;
  animation: idemo-rise 0.26s cubic-bezier(0.32, 0.72, 0, 1),
    idemo-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes idemo-spin { to { transform: rotate(360deg); } }

#demo-bar .check { color: var(--check); font-weight: 700; }

#demo-bar .txt-btn {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--pill-text);
  border-radius: 11px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
#demo-bar .txt-btn:hover { background: var(--btn-hover); }
#demo-bar .txt-btn.danger:hover { background: rgba(229, 72, 77, 0.24); }

#demo-bar .icon-btn {
  background: none;
  border: none;
  color: var(--pill-icon);
  cursor: pointer;
  padding: 4px;
  display: flex;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
#demo-bar .icon-btn:hover { color: var(--pill-icon-hover); background: var(--pill-hover); }
/* ⌄ und ⤢ sind in der Demo sichtbar, aber inert */
#demo-bar .icon-btn.inert { pointer-events: none; }
/* Nachtrag/✕ im Ergebnis: echte Optik, aber ohne Funktion */
#demo-bar .txt-btn.inert { pointer-events: none; }

/* ============================================================
   IDA-Panel — Karteieintrag im Look des großen Fensters (hell)
   ============================================================ */
.idemo-panel {
  position: absolute;
  left: 50%;
  top: 36px;
  transform: translateX(-50%) translateY(10px) scale(0.97);
  width: 620px;
  max-height: 552px;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--win-bg);
  box-shadow:
    0 0 0 1px rgba(16, 24, 40, 0.1),
    0 28px 60px -22px rgba(3, 10, 20, 0.65);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.32s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.idemo-panel.open {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: auto;
}

.idemo-panel .p-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
}
.idemo-panel .p-brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--win-navy);
}
.idemo-panel .p-brand::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok-dot);
  margin-left: 6px;
  vertical-align: 1px;
}
.idemo-panel .p-test {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--teal-text);
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 2px 8px;
}
.idemo-panel .p-min {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--win-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.idemo-panel .p-min:hover { background: rgba(11, 29, 58, 0.08); color: var(--win-text); }

.idemo-panel .p-titlerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 8px;
}
.idemo-panel .p-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--win-text);
}
.idemo-panel .p-copied {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ok-pill-text);
  background: var(--ok-pill-bg);
  border-radius: 999px;
  padding: 4px 11px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.idemo-panel .p-copied.show { opacity: 1; }

.idemo-panel .p-cards {
  padding: 2px 16px 6px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.idemo-card {
  background: var(--win-card);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.07), 0 0 0 1px rgba(16, 24, 40, 0.05);
  padding: 8px 12px 10px;
  opacity: 0;
  transform: translateY(6px);
}
.idemo-card.on {
  opacity: 1;
  transform: none;
  transition: opacity 0.28s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.idemo-card .c-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.idemo-card .c-chip {
  min-width: 24px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--teal-text);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
}
.idemo-card .c-name { font-size: 12.5px; font-weight: 600; color: var(--win-muted); }
.idemo-card .c-copy {
  margin-left: auto;
  font-size: 11px;
  color: var(--win-muted);
  background: rgba(11, 29, 58, 0.05);
  border: 1px solid rgba(11, 29, 58, 0.12);
  border-radius: 9px;
  padding: 2px 8px;
  pointer-events: none; /* Optik, in der Demo inert */
}
.idemo-card .c-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--win-text);
  background: #fafbfc;
  border: 1px solid var(--win-border);
  border-radius: 9px;
  padding: 7px 10px;
  min-height: 20px;
  overflow-wrap: anywhere;
}
.idemo-card .c-text .marker {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--marker-text);
  background: var(--marker-bg);
  border-radius: 5px;
  padding: 0 4px;
  margin: 0 1px;
}
.idemo-card .c-text .caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  vertical-align: -0.18em;
  margin-left: 1px;
  background: var(--teal-text);
  animation: idemo-caret 0.9s steps(1) infinite;
}
@keyframes idemo-caret { 50% { opacity: 0; } }

.idemo-panel .p-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 13px;
}
.idemo-panel .p-note {
  flex: 1;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--win-muted);
}
.idemo-panel .p-note strong { color: var(--marker-text); font-weight: 700; }
.idemo-panel .p-again {
  flex-shrink: 0;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: #ffffff;
  background: linear-gradient(180deg, #14a08e, #0e8074);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.15s ease;
}
.idemo-panel .p-again.show { opacity: 1; pointer-events: auto; }
.idemo-panel .p-again:hover { transform: scale(1.04); }
.idemo-panel .p-again:active { transform: scale(0.98); }

/* Unterzeile unter dem Rahmen */
.idemo-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 13px;
  color: rgba(92, 100, 112, 0.95);
  text-align: center;
}
.idemo-sub .sub-hint { line-height: 1.4; }

/* Screenreader-only */
.idemo-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- prefers-reduced-motion: Pegel statisch, alles springt weich ---- */
@media (prefers-reduced-motion: reduce) {
  #demo-bar { transition-duration: 0s; }
  #demo-bar .seg,
  #demo-bar #time,
  #demo-bar #label,
  #demo-bar .spinner,
  #demo-bar .check,
  #demo-bar .txt-btn,
  #demo-bar .icon-btn,
  #demo-bar .dot.rec { animation: none; }
  #demo-bar .dot.rec { animation: idemo-pulse 1.2s ease-in-out infinite; } /* Aufnahme-Signal bleibt */
  #demo-bar .spinner { animation: idemo-spin 0.8s linear infinite; }
  .idemo.is-visible #demo-bar.ready #mic-btn { animation: none; }
  #demo-bar #wave i { transition: none; }
  .idemo-panel { transition: opacity 0.2s ease; transform: translateX(-50%); }
  .idemo-panel.open { transform: translateX(-50%); }
  .idemo-card.on { transition: opacity 0.2s ease; }
  .idemo-card .c-text .caret { display: none; }
}
