/* Conversa por voz: barra que substitui a caixa de escrita enquanto a voz
   está ativa. Usa os tokens de cor do index.html (--primary, --surface…). */
.composer-container.voice-active .composer-form { display: none; }

.voice-dock {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 12px 10px 14px;
  border: 1px solid var(--primary-line);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-light), var(--surface) 55%);
  box-shadow: var(--shadow-sm);
  animation: voiceDockIn .25s ease;
}
.voice-dock[hidden] { display: none; }
@keyframes voiceDockIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Orbe: o núcleo cresce com --level (0..1), medido do microfone/da voz. */
.voice-orb {
  --level: 0;
  --orb: var(--primary);
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.voice-orb-core {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--orb) 55%, #fff), var(--orb) 70%);
  transform: scale(calc(1 + var(--level) * 0.55));
  transition: transform .08s linear, background .3s ease;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--orb) 45%, transparent);
}
.voice-orb-glow {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--orb);
  opacity: calc(0.12 + var(--level) * 0.35);
  transform: scale(calc(1 + var(--level) * 0.6));
  transition: transform .08s linear, opacity .08s linear, background .3s ease;
}
.voice-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}
.voice-orb[data-state="connecting"] .voice-orb-ring,
.voice-orb[data-state="thinking"] .voice-orb-ring,
.voice-orb[data-state="tool"] .voice-orb-ring {
  border-color: color-mix(in srgb, var(--orb) 25%, transparent);
  border-top-color: var(--orb);
  animation: voiceSpin 1s linear infinite;
}
.voice-orb[data-state="connecting"] { --orb: var(--muted); }
.voice-orb[data-state="tool"] { --orb: var(--amber); }
.voice-orb[data-state="speaking"] { --orb: var(--green); }
.voice-orb[data-state="muted"] { --orb: var(--red); }
.voice-orb[data-state="listening"] .voice-orb-core { animation: voiceBreathe 2.4s ease-in-out infinite; }
@keyframes voiceSpin { to { transform: rotate(360deg); } }
@keyframes voiceBreathe { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }

.voice-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.voice-status { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.voice-status-text { font-size: var(--fs-body); font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-timer { font-size: var(--fs-label); color: var(--muted); font-variant-numeric: tabular-nums; }
.voice-caption {
  font-size: var(--fs-cell);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1.4em;
}
.voice-dock[data-state="tool"] .voice-status-text { color: var(--amber); }
.voice-dock[data-state="muted"] .voice-status-text { color: var(--red); }

.voice-actions { display: flex; gap: 8px; }
.voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-label);
  font-weight: 700;
  transition: var(--transition);
}
.voice-btn:hover { background: var(--surface-3); color: var(--text); }
.voice-btn-icon { display: inline-flex; }
.voice-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.voice-mute.is-on { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.voice-end { background: var(--red); border-color: var(--red); color: #fff; }
.voice-end:hover { background: color-mix(in srgb, var(--red) 88%, #000); color: #fff; }
:root.dark .voice-end, :root[data-theme="dark"] .voice-end { color: #111827; }

/* Botão que abre a conversa por voz, ao lado do microfone de ditado. */
.btn-voice-mode {
  color: var(--primary-ink);
  background: var(--primary-light);
  border-color: var(--primary-line);
}
.btn-voice-mode:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-voice-mode svg { width: 18px; height: 18px; }

@media (max-width: 620px) {
  .voice-dock { grid-template-columns: auto minmax(0, 1fr); border-radius: 20px; gap: 10px 12px; }
  .voice-actions { grid-column: 1 / -1; justify-content: stretch; }
  .voice-btn { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .voice-orb-core, .voice-orb-glow { transform: none !important; }
}
