/* Voice mode UI — toggle, transcript pill, page-listening tint. */

.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.voice-toggle:hover { background: #f4f4ee; border-color: #d4d4d8; }
.voice-toggle.voice-on {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}
.voice-toggle.voice-on svg { animation: voice-pulse 1.4s ease-in-out infinite; }

/* Floating fallback for pages without a .top-bar (e.g. ticket details).
 * Sits below modals/dropdowns so it never traps interaction. */
.voice-toggle.voice-toggle-floating {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 9000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
}

/* Vertical stack for Voice + action buttons on tickets-style top-bars
 * (single right-side action button). Without this, the .top-bar's
 * `justify-content: space-between` strands the action button in the middle. */
.voice-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.voice-stack .voice-toggle,
.voice-stack > button {
  justify-content: center;
}

@keyframes voice-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(.9); }
}

/* Subtle page-edge tint while listening, so the live state is unmistakable
 * without being noisy. Inset shadow avoids reflowing layout. */
html.voice-listening body {
  box-shadow: inset 0 0 0 2px rgba(239, 68, 68, .35);
}

/* Bottom-center transcript pill. Fixed positioning so it never affects
 * page layout. Hidden until listening. */
.voice-pill {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(8px);
  display: none;
  align-items: center;
  gap: 10px;
  max-width: min(80vw, 700px);
  padding: 10px 14px;
  background: rgba(17, 17, 17, .92);
  color: #f5f5f4;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.3;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  z-index: 99999;
  opacity: 0;
  transition: opacity 160ms ease, transform 160ms ease;
}
.voice-pill.voice-pill-show {
  display: inline-flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.voice-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex: 0 0 auto;
  animation: voice-pulse 1.4s ease-in-out infinite;
}
.voice-pill-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 580px;
}
.voice-pill-stop {
  background: transparent;
  border: 1px solid rgba(245, 245, 244, .35);
  color: #f5f5f4;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
}
.voice-pill-stop:hover { background: rgba(245, 245, 244, .08); border-color: rgba(245, 245, 244, .55); }

/* ── Dictation field-fill effects (Phase 2) ─────────────────────────── */

/* 700ms ring pulse applied to a field/pill when voice fills it.
 * Uses an outline so it sits over the existing border without nudging
 * layout. Color matches the modal's primary accent. */
@keyframes voice-pulse-anim {
  0%   { box-shadow: 0 0 0 0 rgba(59, 130, 246, .55); }
  40%  { box-shadow: 0 0 0 6px rgba(59, 130, 246, .14); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
.voice-pulse {
  animation: voice-pulse-anim 720ms ease-out;
  border-radius: 8px;
}

/* Low-confidence indicator: dashed outline + slightly faded.
 * Scoped to the create-ticket modal so it can't bleed into other UI. */
#globalCreateTicketModal .voice-low-conf {
  border-style: dashed !important;
  opacity: 0.82;
}
#globalCreateTicketModal .gct-pill.voice-low-conf {
  border-style: dashed !important;
  border-width: 1px;
  opacity: 0.82;
}
