/* ═══════════════════════════════════════════════════════════
   WO-28 T4: Voice CSS — Visual Feedback States
   Voice Indicator in Zone A + Waveform + Command Overlay
   Scotty Studio Colors (WO-26b)
   ═══════════════════════════════════════════════════════════ */

:root {
  --voice-ready: var(--success);
  --voice-listening: var(--accent);
  --voice-processing: var(--warning);
  --voice-error: var(--danger);
  --voice-idle: var(--text-muted);
  --voice-noise: var(--warning);
  --success-a: 34, 197, 94;
  --warning-a: 234, 179, 8;
  --danger-a: 239, 68, 68;
  --noise-a: 249, 115, 22;
}

/* ── Voice Indicator (Zone A) ──────────────────────────── */
.voice-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--card);
  transition: all 300ms ease;
  cursor: pointer;
  user-select: none;
}

.voice-indicator .mic-icon {
  font-size: 20px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 200ms ease;
}

.voice-indicator .mic-status-text {
  font-size: 12px;
  color: var(--text-muted, #888);
  font-family: var(--font-family, 'Inter', sans-serif);
  white-space: nowrap;
  transition: color 300ms ease;
}

/* ── Voice States ──────────────────────────────────────── */
.voice-indicator.voice-idle .mic-icon {
  color: #666;
  background: rgba(255,255,255,0.04);
}

.voice-indicator.voice-listening .mic-icon {
  color: var(--success);
  background: rgba(var(--success-a), 0.2);
  box-shadow: 0 0 12px rgba(var(--success-a), 0.3);
}

.voice-indicator.voice-listening .mic-status-text {
  color: var(--success);
}

.voice-indicator.voice-processing .mic-icon {
  color: var(--warning);
  background: rgba(var(--warning-a), 0.2);
  box-shadow: 0 0 12px rgba(var(--warning-a), 0.3);
}

.voice-indicator.voice-processing .mic-status-text {
  color: var(--warning);
}

.voice-indicator.voice-confirmed .mic-icon {
  color: var(--success);
  background: rgba(var(--success-a), 0.2);
}

.voice-indicator.voice-confirmed .mic-status-text {
  color: var(--success);
}

.voice-indicator.voice-error .mic-icon {
  color: var(--danger);
  background: rgba(var(--danger-a), 0.2);
}

.voice-indicator.voice-error .mic-status-text {
  color: var(--danger);
}

.voice-indicator.voice-noise .mic-icon {
  color: var(--noise, var(--warning));
  background: rgba(var(--noise-a), 0.2);
}

.voice-indicator.voice-noise .mic-status-text {
  color: var(--noise, var(--warning));
}

.voice-indicator.voice-off .mic-icon {
  color: #444;
  background: rgba(255,255,255,0.03);
}

/* ── Pulse Animation ───────────────────────────────────── */
.voice-indicator.voice-pulse .mic-icon {
  animation: voice-pulse 1.5s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Push-to-Talk Button ───────────────────────────────── */
.voice-ptt-btn {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--card-hover);
  border: 1px solid var(--border);
  color: var(--text-muted, #888);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-family, 'Inter', sans-serif);
  transition: all 200ms ease;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.voice-ptt-btn:hover {
  background: rgba(160,80,224,0.12);
  border-color: rgba(160,80,224,0.25);
}

.voice-ptt-btn:active,
.voice-ptt-btn.ptt-active {
  background: rgba(var(--success-a), 0.2);
  border-color: rgba(var(--success-a), 0.4);
  color: var(--success);
  box-shadow: 0 0 8px rgba(var(--success-a), 0.2);
}

.voice-ptt-btn.ptt-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Waveform Bars ─────────────────────────────────────── */
.voice-waveform {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 300ms ease;
}

.voice-waveform.active {
  opacity: 1;
}

.voice-waveform .waveform-bar {
  width: 3px;
  min-height: 3px;
  border-radius: 2px;
  background: currentColor;
  transition: height 80ms ease;
  opacity: 0.6;
}

.voice-waveform .waveform-bar:nth-child(odd) {
  opacity: 0.4;
}

/* ── Command Text Overlay ──────────────────────────────── */
.voice-command-overlay {
  position: fixed;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-family: var(--font-family, 'Inter', sans-serif);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  background: var(--card);
  color: #ccc;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  max-width: 80vw;
  text-align: center;
}

.voice-command-overlay.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.voice-command-overlay.confirmed {
  border-color: rgba(var(--success-a), 0.4);
  color: var(--success);
}

.voice-command-overlay.error {
  border-color: rgba(var(--danger-a), 0.4);
  color: var(--danger);
}

/* ── Zone A Layout (voice rows) ────────────────────────── */
.zone-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ── Responsive: Small Screens ─────────────────────────── */
@media (max-width: 480px) {
  .voice-indicator {
    padding: 4px 8px;
    gap: 4px;
  }
  .voice-indicator .mic-icon {
    font-size: 16px;
    width: 24px;
    height: 24px;
  }
  .voice-indicator .mic-status-text {
    font-size: 10px;
  }
  .voice-ptt-btn {
    padding: 4px 10px;
    font-size: 10px;
  }
  .voice-command-overlay {
    top: 8%;
    font-size: 12px;
    padding: 8px 14px;
  }
}

/* ── Audio Context Init Banner ──────────────────────────── */
.voice-init-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  color: var(--warning);
  font-size: 13px;
  font-family: var(--font-family, 'Inter', sans-serif);
  text-align: center;
  z-index: 310;
  cursor: pointer;
  transition: transform 300ms ease;
}

.voice-init-banner.hidden {
  transform: translateY(-100%);
}
