/* ==========================================================================
   Speech-to-Text (Web Speech API)
   ========================================================================== */

/* --- Mic button --- */
#stt-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s ease, border-radius 0.3s ease, background 0.2s, color 0.2s;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

#stt-btn .lucide { width: 20px; height: 20px; flex-shrink: 0; }
#stt-btn:hover { background: rgba(var(--overlay-rgb), 0.06); color: var(--text); }

/* Recording active — pill shape */
#stt-btn.stt-active {
  width: auto;
  padding: 0 14px 0 10px;
  border-radius: 18px;
  color: #fff;
  background: #e53935;
}

#stt-btn.stt-active:hover {
  background: #c62828;
}

/* --- Waveform bars --- */
.stt-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 18px;
  flex-shrink: 0;
}

.stt-wave-bar {
  width: 3px;
  border-radius: 1.5px;
  background: rgba(255, 255, 255, 0.85);
  animation: stt-wave-bounce 1.2s ease-in-out infinite;
}

.stt-wave-bar:nth-child(1) { height: 6px;  animation-delay: 0s; }
.stt-wave-bar:nth-child(2) { height: 12px; animation-delay: 0.15s; }
.stt-wave-bar:nth-child(3) { height: 16px; animation-delay: 0.3s; }
.stt-wave-bar:nth-child(4) { height: 12px; animation-delay: 0.45s; }
.stt-wave-bar:nth-child(5) { height: 6px;  animation-delay: 0.6s; }

@keyframes stt-wave-bounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

/* Stop label */
.stt-stop-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* Loading state */
#stt-btn.stt-loading {
  pointer-events: none;
  opacity: 0.7;
}

.stt-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: block;
}

/* --- Language popover --- */
.stt-lang-popover {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 -4px 24px rgba(var(--shadow-rgb), 0.4);
  z-index: 20;
  min-width: 200px;
  overflow: hidden;
}

.stt-lang-title {
  padding: 12px 16px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dimmer);
}

.stt-lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  gap: 8px;
}

.stt-lang-option:hover {
  background: rgba(var(--overlay-rgb), 0.05);
}

.stt-lang-option.stt-lang-active {
  color: var(--accent);
  font-weight: 600;
}

.stt-lang-name {
  flex: 1;
}

.stt-lang-hint {
  font-size: 11px;
  color: var(--text-dimmer);
  flex-shrink: 0;
}

.stt-lang-option:last-child {
  border-radius: 0 0 14px 14px;
}
