/* ============================================================
   Rethought-Layout — auf die echte Showcase-App angewandt
   (Branch master-rethought). ZULETZT geladen → überschreibt
   gezielt Teile von showcase.css / showcase-panels.css /
   showcase-immersive.css. Token-Quelle: showcase-theme.css.

   Neue Bausteine ggü. dem bestehenden Immersions-Layout (#75):
   - Phasen-Stepper im Header (statt Phase-Badge)
   - Persistente, schwebende „Akte"-Sidebar (live)
   - Steuer-Dock mit EINEM Pause-Button (koppelt Mute)
   - Abschluss als zentrales Review-Modal mit Inline-Zeilen-Edit
   Avatar bleibt durchgehend VOLLBILD; Karten/Akte schweben darüber.
   ============================================================ */

/* --- App-Shell: Header + Bühne in voller Höhe --- */
.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.app::before { /* feine Marken-Akzentlinie ganz oben */
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--gradient-brand);
  z-index: 50;
  pointer-events: none;
}

/* ============================================================
   HEADER mit Phasen-Stepper
   ============================================================ */
.header { gap: var(--space-4); }
.neutral-mark {
  display: none;
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--text);
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
/* Neutral/White-Label (Default): Logo raus, Wortmark rein. */
body.whitelabel .header-logo { display: none; }
body.whitelabel .neutral-mark { display: inline; }
.header-phase[hidden] { display: none; }

.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  overflow: hidden;
  margin: 0 var(--space-3);
}
.step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  white-space: nowrap;
  opacity: 0.5;
  transition: opacity var(--transition);
}
.step-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background var(--transition), box-shadow var(--transition);
}
.step.done { opacity: 1; }
.step.done .step-dot { background: var(--green); }
.step.active { opacity: 1; font-weight: 700; color: var(--text); }
.step.active .step-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.step-sep { width: 22px; height: 2px; background: var(--border); flex-shrink: 0; }
.step.done + .step-sep { background: var(--green); }

.header-case {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.header-hangup {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.header-hangup:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Schmale Viewports: Stepper-Labels einklappen (nur Punkte). */
@media (max-width: 760px) {
  .stepper { gap: 4px; }
  .step { font-size: 0; gap: 0; }
  .step-sep { width: 12px; }
}

/* ============================================================
   MAIN / BÜHNE — Avatar VOLLBILD, Karten + Akte schweben darüber
   ============================================================ */
.main {
  position: relative;
  padding: 0;
  overflow: hidden;
  min-height: 0;
  flex: 1;
}
/* Bühne füllt die ganze Main-Fläche; video-container (inset:0 aus immersive)
   füllt damit die ganze Bühne. */
.stage { position: absolute; inset: 0; }

/* Avatar-Badge (Name) unten links über dem Video. */
.avatar-badge {
  position: absolute;
  left: var(--space-5);
  bottom: var(--space-5);
  z-index: 6;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

/* Frage-/Options-/Listen-Karten: schwebend unten MITTIG, Platz rechts für die Akte. */
.bottom-panel {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 400px));
  bottom: var(--space-5);
  max-height: calc(100% - 2 * var(--space-5));
}
/* Sehr schmal: Akte rückt unter die Bühne → Karte darf volle Breite nehmen. */
@media (max-width: 900px) {
  .bottom-panel { width: calc(100% - 2 * var(--space-4)); }
}

/* ============================================================
   AKTE — schwebendes Frosted-Glass-Panel rechts
   ============================================================ */
.akte {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
  width: 340px;
  /* endet über dem Dock unten rechts */
  max-height: calc(100% - var(--space-5) - var(--touch-min) - 2 * var(--space-4));
  z-index: 7;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.akte-head {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.akte-title { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.akte-count { font-size: var(--fs-xs); color: var(--text-secondary); text-align: right; }
.akte-body {
  padding: var(--space-4) var(--space-5);
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.akte-section-label {
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: var(--space-3);
}
.akte-list { display: flex; flex-direction: column; gap: var(--space-3); }
.akte-empty {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  font-style: italic;
  line-height: var(--lh-normal);
}

/* Akte-Eintrag (erfasste Antwort) */
.entry {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  animation: akteFlyIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes akteFlyIn {
  from { opacity: 0; transform: translateX(20px) scale(0.97); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
.entry-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}
.entry-main { min-width: 0; }
.entry-q { font-size: var(--fs-sm); color: var(--text-secondary); } /* #6: lesbarer (war --fs-xs) */
.entry-a { font-size: var(--fs-md); font-weight: 700; margin-top: 2px; color: var(--text); word-break: break-word; } /* #6: erfasster Wert ≥18px (war --fs-base) */

/* Frage-Chip (offene Frage fürs Arztgespräch) */
.qchip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text);
  animation: akteFlyIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.qchip-icon { color: var(--blue); font-weight: 700; flex-shrink: 0; }

/* ============================================================
   STEUER-DOCK — EIN Pause-Button (koppelt Mute)
   ============================================================ */
.dock {
  position: absolute;
  right: var(--space-5);
  bottom: var(--space-5);
  display: flex;
  gap: var(--space-3);
  z-index: 8;
}
.dock-btn {
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.dock-btn:hover { transform: translateY(-2px); }
.dock-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.dock-ic { width: 24px; height: 24px; display: block; }
.dock-btn .ic-off { display: none; }
/* Pause aktiv → Play-Icon, Akzent getönt. */
#btnPause.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#btnPause.active .ic-on { display: none; }
#btnPause.active .ic-off { display: block; }
/* Mute aktiv → durchgestrichenes Mikro, rot getönt. */
#btnMute.muted { background: var(--red); color: #fff; border-color: var(--red); }
#btnMute.muted .ic-on { display: none; }
#btnMute.muted .ic-off { display: block; }

/* Pausiert-Badge + Avatar-Dimmung */
.paused-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  background: rgba(15, 19, 41, 0.72);
  color: #fff;
  font-weight: 700;
  font-size: var(--fs-md);
  z-index: 9;
  backdrop-filter: blur(8px);
}
.paused-badge svg { width: 20px; height: 20px; display: block; }
body.paused .paused-badge { display: flex; }
body.paused .video-container video,
body.paused .freeze-canvas { filter: brightness(0.6) saturate(0.9); }

/* Status-Zeile dezent unten links (über dem Avatar-Badge); Mikro-/Level versteckt. */
.stage-controls {
  position: absolute;
  left: var(--space-5);
  bottom: calc(var(--space-5) + var(--touch-min) - 0.5rem);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 60%;
  pointer-events: none;
}
.stage-controls .status-text {
  font-size: var(--fs-xs);
  color: #fff;
  background: rgba(15, 19, 41, 0.55);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  min-height: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.stage-controls .status-text:empty { display: none; }
.stage-controls .status-text.error { color: #ffd7db; }
.stage-controls .mic-btn { display: none; }

/* ============================================================
   ABSCHLUSS-REVIEW-MODAL (zentral) + Inline-Zeilen-Edit
   ============================================================ */
.review-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: var(--space-5);
  background: rgba(15, 19, 41, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: reviewFade 0.25s ease-out;
}
.review-overlay.open { display: grid; }
@keyframes reviewFade { from { opacity: 0; } to { opacity: 1; } }

.review-sheet {
  position: relative;
  width: min(640px, 100%);
  max-height: 92vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: reviewUp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes reviewUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.review-head {
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.review-eyebrow {
  font-size: var(--fs-eyebrow);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.review-title { font-size: var(--fs-xl); line-height: var(--lh-tight); }
.review-sub {
  margin-top: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}
.review-sub .ed-ic { width: 16px; height: 16px; vertical-align: -3px; color: var(--text-secondary); }

.review-body {
  padding: var(--space-3) var(--space-6);
  overflow-y: auto;
  flex: 1;
}
/* Summary lebt im Modal-Body — die Float-/Scroll-Regeln aus immersive.css
   (max-height/Scrollbalken/Fade) wirken hier dezent weiter; opak + ohne Schatten. */
.review-body .summary-panel {
  box-shadow: none;
  border: none;
  border-radius: 0;
  padding: var(--space-3) 0;
  max-height: none;
}
.review-body .summary-panel h3 { margin-bottom: var(--space-3); }

/* Inline-Edit-Zeile: Wert + Stift-Button. showSummary() rendert die Items als
   .summary-item mit .summary-item-edit (Stift). */
.summary-list .summary-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}
.summary-list .summary-item .summary-item-body { flex: 1; min-width: 0; }
.summary-item-edit {
  flex-shrink: 0;
  width: 40px; height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity var(--transition), background var(--transition);
}
.summary-item-edit svg { width: 18px; height: 18px; color: var(--text-secondary); }
.summary-item-edit:hover { opacity: 1; background: var(--accent-tint); }
.summary-item-edit:hover svg { color: var(--accent); }
.summary-item.editing { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-sm); }
.summary-list dd[contenteditable="true"],
.summary-item-list li[contenteditable="true"] {
  outline: none;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.review-foot {
  padding: var(--space-4) var(--space-6) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.voice-cue {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--accent-tint);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}
.voice-cue em { font-style: normal; font-weight: 700; color: var(--accent); }
.voice-cue .mic-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 var(--pulse-ring-start);
  animation: pulse 1.8s infinite;
}

/* Footer-Aktionen: Mute (rund) + „Etwas ändern" (sekundär) + „Abschließen" (primär). */
.review-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.review-mute {
  flex-shrink: 0;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.review-mute:hover { background: var(--surface-alt); }
.review-mute .ic-off { display: none; }
.review-mute.muted { background: var(--red); color: #fff; border-color: var(--red); }
.review-mute.muted .ic-on { display: none; }
.review-mute.muted .ic-off { display: block; }
.review-secondary {
  min-height: var(--touch-min);
  padding: 0 var(--space-5);
  border: 2px solid var(--navy);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--navy);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.review-secondary:hover { background: var(--navy); color: #fff; }
.review-confirm {
  min-height: var(--touch-min);
  padding: 0 var(--space-5);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: var(--fs-lg);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.review-confirm:hover { background: var(--accent-hover); transform: translateY(-1px); }
.review-actions .review-confirm { flex: 1; }

/* Bottom-Sheet-Griff + Backdrop: auf dem Desktop ausgeblendet (Sidebar-Akte
   ist immer offen). Erst der Mobile-Block unten macht sie sichtbar. */
.akte-bar { display: none; }
.akte-backdrop { display: none; }

/* ============================================================
   Schmale/niedrige Viewports: Akte unter die Bühne (Tablet, 761–900px)
   ============================================================ */
@media (max-width: 900px) and (min-width: 761px) {
  .akte {
    position: absolute;
    left: var(--space-4);
    right: var(--space-4);
    top: auto;
    bottom: calc(var(--space-5) + var(--touch-min) + var(--space-3));
    width: auto;
    max-height: 32vh;
  }
  .bottom-panel { bottom: var(--space-4); }
}

/* ============================================================
   #293 Mobile (≤760px): Akte als einklappbares Bottom-Sheet.
   Wurzel: Akte (z-index 7) und bottom-panel (z-index 6) lagen auf demselben
   vertikalen Band → Akte malte über Frage/Optionen. Lösung: eingeklappt nur eine
   schmale Griff-Leiste (~48px), die das Band für die Karten freigibt; Tap öffnet
   das Sheet (überlagert dann bewusst). Reine Präsentation, kein Flow-Eingriff.
   ============================================================ */
@media (max-width: 760px) {
  /* Eingeklappt: schmale Leiste ganz unten. Sidebar-Inhalt (head/body) verborgen. */
  .akte {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-height: none;
    height: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 9; /* über bottom-panel (6) UND Dock (8): die Leiste bleibt antippbar */
    box-shadow: 0 -6px 24px rgba(15, 19, 41, 0.16);
    transition: max-height var(--transition);
  }
  /* Griff-Leiste sichtbar + tappbar. */
  .akte-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    min-height: var(--touch-min);
    padding: 0 var(--space-5);
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
  }
  .akte-bar-caret { transition: transform var(--transition); color: var(--text-secondary); }
  /* Im eingeklappten Zustand head/body NICHT anzeigen → nur die Leiste belegt Platz. */
  .akte .akte-head,
  .akte .akte-body { display: none; }

  /* Aufgeklappt: Sheet expandiert nach oben; head/body wieder sichtbar. */
  .akte.akte-open {
    max-height: 72vh;
  }
  .akte.akte-open .akte-bar-caret { transform: rotate(180deg); }
  .akte.akte-open .akte-head { display: flex; }
  .akte.akte-open .akte-body {
    display: flex;
    max-height: calc(72vh - var(--touch-min));
  }

  /* Backdrop nur sichtbar, wenn das Sheet offen ist (Tap daneben schließt). */
  .akte.akte-open ~ .akte-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 8; /* unter der Akte (9), über bottom-panel (6) */
    background: rgba(15, 19, 41, 0.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  /* Karten dürfen volle Breite nehmen und enden ÜBER der eingeklappten Leiste +
     dem Dock — so verschwindet auch im geöffneten Sheet-Zustand kein Inhalt. */
  .bottom-panel {
    width: calc(100% - 2 * var(--space-4));
    bottom: calc(var(--touch-min) + var(--space-3));
    max-height: calc(100% - 2 * var(--touch-min) - 2 * var(--space-4));
  }
}
