/* ============================================================
   text-mp3.css — Freitext → MP3 (Segment-Editor + Dateiliste)
   Nutzt die Design-Tokens aus colors.css; nur die drei
   Stimm-Farben (S1–S3) sind hier als eigene Tokens definiert.
   ============================================================ */

/* ── Stimm-Farben: S1 = Akzentblau, S2 = Grün, S3 = warmes Ocker ── */
:root {
  --tmp-v1:     #1b4dff;
  --tmp-v1-bg:  rgba(27, 77, 255, .12);
  --tmp-v2:     #0e7a5f;
  --tmp-v2-bg:  rgba(14, 122, 95, .12);
  --tmp-v3:     #b3591f;
  --tmp-v3-bg:  rgba(179, 89, 31, .12);
  --tmp-danger: #b23434;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tmp-v1:     #6690ff;
    --tmp-v1-bg:  rgba(102, 144, 255, .20);
    --tmp-v2:     #4cc7a2;
    --tmp-v2-bg:  rgba(76, 199, 162, .18);
    --tmp-v3:     #e59a5c;
    --tmp-v3-bg:  rgba(229, 154, 92, .18);
    --tmp-danger: #ff8a80;
  }
}

/* ── Header-Titel ohne Inline-Style (ersetzt style="font-weight:800") ── */
.brand-title { font-weight: 800; }

/* ── Panels ─────────────────────────────────────────────────── */
.tmp-panel {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.tmp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.tmp-h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}
.tmp-head .tmp-h2 { margin-bottom: 0; }

.tmp-lock {
  font-size: .85rem;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tmp-label {
  font-size: .85rem;
  color: var(--muted);
}

.tmp-msg {
  margin: 8px 0 0;
  font-size: .9rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* ── Eingaben (16px verhindert den iOS-Auto-Zoom) ───────────── */
.tmp-input {
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-input);
  color: var(--ink);
}
.tmp-input:focus {
  outline: none;
  border-color: var(--accent-55);
  background: var(--surface-input-focus);
}

.tmp-pw-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.tmp-pw-row .tmp-input { flex: 1 1 220px; }

/* ── Stimmen-Slots ──────────────────────────────────────────── */
.tmp-voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.tmp-voice__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.tmp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.tmp-dot--v1 { background: var(--tmp-v1); }
.tmp-dot--v2 { background: var(--tmp-v2); }
.tmp-dot--v3 { background: var(--tmp-v3); }

.tmp-voice__select {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-input);
  color: var(--ink);
}

/* ── Segmente ───────────────────────────────────────────────── */
.tmp-seg-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tmp-seg {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--surface-item);
}

.tmp-seg__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.tmp-seg__spacer { flex: 1; }

/* Chips: große Touchflächen, Farbe = zugewiesene Stimme */
.tmp-chip {
  flex: 0 1 64px;
  min-width: 48px;
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-btn);
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.tmp-chip:hover { background: var(--surface-btn-hover); }
.tmp-chip--on.tmp-chip--v1 { background: var(--tmp-v1-bg); border-color: var(--tmp-v1); color: var(--tmp-v1); }
.tmp-chip--on.tmp-chip--v2 { background: var(--tmp-v2-bg); border-color: var(--tmp-v2); color: var(--tmp-v2); }
.tmp-chip--on.tmp-chip--v3 { background: var(--tmp-v3-bg); border-color: var(--tmp-v3); color: var(--tmp-v3); }

/* Icon-Knöpfe (↑ ↓ ✕ ▶ ⬇) */
.tmp-ib {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  flex: 0 0 auto;
}
.tmp-ib:hover { background: var(--ink-06); color: var(--ink); }
.tmp-ib:disabled { opacity: .35; cursor: default; background: transparent; }
.tmp-ib--danger:hover { color: var(--tmp-danger); }
.tmp-play--on { color: var(--accent); background: var(--accent-10); }

.tmp-seg__ta {
  width: 100%;
  font: inherit;
  font-size: 16px;
  line-height: 1.55;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-input);
  color: var(--ink);
  resize: none;
  overflow: hidden;
  min-height: 44px;
}
.tmp-seg__ta:focus {
  outline: none;
  border-color: var(--accent-55);
  background: var(--surface-input-focus);
}

/* ── Aktionen unter den Segmenten ───────────────────────────── */
.tmp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.tmp-alt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: var(--muted);
  cursor: pointer;
}
.tmp-alt input { accent-color: var(--accent); }

/* ── Zeichenzähler ──────────────────────────────────────────── */
.tmp-countrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 16px;
}
.tmp-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tmp-count--over { color: var(--tmp-danger); }

.tmp-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--ink-08);
  overflow: hidden;
  margin-top: 6px;
}
.tmp-bar__fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--accent);
  transition: width .2s ease;
}
.tmp-bar__fill--over { background: var(--tmp-danger); }

/* ── Erzeugen + Ergebnis ────────────────────────────────────── */
.tmp-genrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.tmp-title { flex: 1 1 220px; }
#genBtn { flex: 0 0 auto; }
#genBtn:disabled { opacity: .55; pointer-events: none; }

.tmp-progress {
  margin: 12px 0 0;
  font-size: .9rem;
  color: var(--muted);
  min-height: 1.3em;
}
.tmp-progress--error { color: var(--tmp-danger); }

.tmp-result {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tmp-audio { width: 100%; }
.tmp-result__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.tmp-result__note {
  font-size: .85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ── Dateiliste ─────────────────────────────────────────────── */
.tmp-files {
  display: flex;
  flex-direction: column;
}
.tmp-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
}
.tmp-file:first-child { border-top: none; }
.tmp-file__info { flex: 1; min-width: 0; }
.tmp-file__name {
  font-weight: 600;
  font-size: .95rem;
  overflow-wrap: anywhere;
}
.tmp-file__meta {
  font-size: .8rem;
  color: var(--muted);
}

/* ── Stimm-Regler (Tempo + Kommapausen) ─────────────────────── */
.tmp-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.tmp-opt .tmp-label {
  display: block;
  margin-bottom: 4px;
}
