/* ============================================
   Transkript — Tonstudio-inspiriertes Design
   Dunkle Bühne, warmer Bernstein-Akzent,
   Monospace für Zeit/Daten als Signatur.
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,900&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg: #14110f;
  --surface: #1f1b18;
  --surface-2: #2a2521;
  --line: #3a322c;
  --text: #f0ebe4;
  --text-dim: #a39b90;
  --amber: #e8a13c;
  --amber-bright: #f6b95a;
  --rec: #e0533d;
  --rec-glow: rgba(224, 83, 61, 0.5);
  --ok: #6fae6b;
  --radius: 14px;
  --mono: 'JetBrains Mono', monospace;
  --display: 'Fraunces', serif;
  --body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--amber);
  color: #1a1410;
  border: none;
  border-radius: 10px;
  padding: 13px 20px;
  font-family: var(--body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  width: 100%;
}
.btn-primary:hover { background: var(--amber-bright); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-text {
  background: none;
  border: none;
  color: var(--amber);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--body);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-danger {
  background: none;
  border: 1px solid var(--line);
  color: var(--rec);
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--body);
  margin-top: 16px;
  width: 100%;
}
.btn-danger:hover { border-color: var(--rec); }

/* ---------- Auth ---------- */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.logo { font-size: 44px; margin-bottom: 8px; }
.auth-card h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: 34px;
  letter-spacing: -0.02em;
}
.subtitle { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 22px;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 9px;
  border-radius: 7px;
  cursor: pointer;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
}
.tab.active { background: var(--surface-2); color: var(--text); }

.form { display: flex; flex-direction: column; gap: 12px; }
input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--body);
}
input:focus { outline: 2px solid var(--amber); border-color: transparent; }
input::placeholder { color: var(--text-dim); }

.error {
  color: var(--rec);
  font-size: 13px;
  margin-top: 14px;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-family: var(--display); font-weight: 600; font-size: 19px; }
.user-info { display: flex; align-items: center; gap: 14px; font-size: 14px; }
#user-name { color: var(--text-dim); }

.content {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 60px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
}
.card h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  margin-bottom: 16px;
}

/* ---------- Aufnahme ---------- */
.capture-card { text-align: center; }
.record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.record-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 16px 28px;
  border-radius: 100px;
  cursor: pointer;
  font-family: var(--body);
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s;
}
.record-btn:hover { border-color: var(--amber); }
.rec-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--rec);
  flex-shrink: 0;
}
.record-btn.recording {
  border-color: var(--rec);
  box-shadow: 0 0 0 4px var(--rec-glow);
}
.record-btn.recording .rec-icon {
  border-radius: 3px;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.timer {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: 0.04em;
}

.divider {
  position: relative;
  text-align: center;
  margin: 22px 0;
  color: var(--text-dim);
  font-size: 13px;
}
.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 28px);
  height: 1px;
  background: var(--line);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 26px 18px;
  color: var(--text-dim);
  transition: all 0.2s;
}
.dropzone.dragover {
  border-color: var(--amber);
  background: rgba(232, 161, 60, 0.06);
  color: var(--text);
}
.dropzone .small { font-size: 13px; margin-top: 6px; }

/* ---------- Aufnahmen-Liste ---------- */
.recordings { display: flex; flex-direction: column; gap: 10px; }
.rec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.rec-item:hover { border-color: var(--line); }
.rec-main { min-width: 0; flex: 1; }
.rec-title {
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 3px;
}
.rec-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
  font-family: var(--mono);
}
.status-transcribing { background: rgba(232,161,60,0.15); color: var(--amber); }
.status-done { background: rgba(111,174,107,0.15); color: var(--ok); }
.status-error { background: rgba(224,83,61,0.15); color: var(--rec); }

/* Löschen direkt in der Liste */
.rec-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.rec-delete:hover { background: rgba(224,83,61,0.15); color: var(--rec); }

.empty { color: var(--text-dim); font-size: 14px; text-align: center; padding: 12px; }

/* Hinweiszeile im Zusammenfassungs-Bereich (laeuft gerade / fehlgeschlagen). */
.summary-hint {
  font-size: 14px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

/* ---------- Einordnung ---------- */
/*
  Badge fuer privat / personenbezogen / nicht eingestuft.
  Bewusst KEINE Ampel: "privat" ist keine Erfolgsmeldung, sondern die zweite
  gleichwertige Kategorie — deshalb neutral und nicht gruen. Unterschieden wird
  ueber die Beschriftung; nur "personenbezogen" traegt den Bernstein-Akzent der
  Oberflaeche, damit es sich beim Ueberfliegen findet.
*/
.rec-klass {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: 1px;
}
.kl-privat { background: rgba(240,235,228,0.10); color: var(--text); }
.kl-personenbezogen { background: rgba(232,161,60,0.15); color: var(--amber); }
.kl-offen { background: rgba(163,155,144,0.12); color: var(--text-dim); }

/* Im Detail-Modal ist dasselbe Badge ein Schalter. */
button.rec-klass {
  border: none;
  cursor: pointer;
  padding: 4px 11px;
  font-size: 12px;
}
button.rec-klass:hover { filter: brightness(1.25); }

/* Zeile unter dem Titel im Detail-Modal: Einordnung + "Titel erzeugen". */
.detail-kopfzeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: -8px 0 18px;
}

/* Wartende, noch nicht eingeordnete Aufnahme im Aufnahmebereich. */
.pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px;
}
.klass-frage { color: var(--text-dim); font-size: 14.5px; margin-bottom: 18px; }
.klass-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.klass-buttons .btn-action { flex: 1; min-width: 140px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}
.modal-content {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.25s ease;
}
@media (min-width: 600px) {
  .modal { align-items: center; }
  .modal-content { border-radius: 20px; }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--surface-2);
  border: none;
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
}
.modal-content h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 23px;
  margin-bottom: 16px;
  padding-right: 40px;
}
.audio-player { width: 100%; margin-bottom: 20px; }

.detail-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.dtab {
  background: var(--surface-2);
  border: none;
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
}
.dtab.active { background: var(--amber); color: #1a1410; }

.text-block {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  font-family: var(--body);
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 14px;
  min-height: 60px;
}

/* ---------- Aktions-Buttons (Kopieren / PDF) ---------- */
.pane-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.btn-action {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--body);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}
.btn-action:hover { border-color: var(--amber); background: var(--surface); }
.btn-action:active { transform: translateY(1px); }

/* ---------- Gerendertes Markdown (Zusammenfassung) ---------- */
.markdown-body { white-space: normal; }
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.3;
  margin: 18px 0 8px;
}
.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 17px; }
.markdown-body h3 { font-size: 15px; color: var(--amber); }
.markdown-body p { margin: 0 0 10px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 10px; padding-left: 22px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body strong { font-weight: 600; color: var(--text); }
.markdown-body em { font-style: italic; }
.markdown-body a { color: var(--amber); }
.markdown-body code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
}
.markdown-body blockquote {
  border-left: 3px solid var(--line);
  margin: 0 0 10px;
  padding-left: 12px;
  color: var(--text-dim);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
