/* =====================================================================
 * TRUCKING MADE SIMPLE — VOICE COMMAND NAVIGATION (Stage 1) styles
 * ===================================================================== */

/* ---- Mic buttons ---- */
.tms-voice-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .10);
  color: currentColor;
  border-radius: 999px;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.tms-voice-mic:hover { background: rgba(255, 255, 255, .20); }
.tms-voice-mic:active { transform: scale(.94); }
.tms-voice-mic .tms-voice-mic-icon { display: inline-flex; }

.tms-voice-mic--top {
  width: 34px; height: 34px;
  margin-right: 6px;
  color: inherit;
}

.tms-voice-mic--float {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px;
  z-index: var(--tms-z-launcher, 2000000);
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  border: none;
  box-shadow: 0 8px 22px rgba(30, 64, 175, .45);
}
.tms-voice-mic--float svg { width: 24px; height: 24px; }
.tms-voice-mic--float:hover { box-shadow: 0 10px 26px rgba(30, 64, 175, .6); }

/* Listening pulse */
.tms-voice-mic.is-listening {
  background: #dc2626 !important;
  color: #fff !important;
  box-shadow: 0 0 0 0 rgba(220, 38, 38, .6);
  animation: tmsVoicePulse 1.3s infinite;
}
@keyframes tmsVoicePulse {
  0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, .55); }
  70%  { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* ---- Listening / recognized indicator ---- */
.tms-voice-listen {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(14px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .94);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  z-index: var(--tms-z-toast, 5000000);
  transition: opacity .2s ease, transform .2s ease;
  max-width: min(90vw, 620px);
}
.tms-voice-listen.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.tms-voice-listen.is-recognized { background: #1d4ed8; }
.tms-voice-listen-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tms-voice-listen-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ef4444; flex: 0 0 auto;
  animation: tmsVoiceBlink 1s infinite;
}
.tms-voice-listen.is-recognized .tms-voice-listen-dot { background: #93c5fd; animation: none; }
@keyframes tmsVoiceBlink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ---- Toasts ---- */
.tms-voice-toasts {
  position: fixed;
  right: 18px;
  bottom: 84px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--tms-z-toast, 5000000);
  pointer-events: none;
}
.tms-voice-toast {
  pointer-events: auto;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #1f2937;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .28);
  opacity: 1;
  transform: translateY(0);
  transition: opacity .3s ease, transform .3s ease;
  max-width: 320px;
}
.tms-voice-toast--ok   { background: #047857; }
.tms-voice-toast--warn { background: #b45309; }
.tms-voice-toast.is-out { opacity: 0; transform: translateY(8px); }

/* ---- Section flash (highlight the destination we jumped to) ---- */
.tms-voice-flash {
  animation: tmsVoiceFlash 1.6s ease;
  border-radius: 8px;
}
@keyframes tmsVoiceFlash {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
  25%  { box-shadow: 0 0 0 4px rgba(37, 99, 235, .35); background: rgba(37, 99, 235, .06); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* ---- Dialogs (chooser / not-found / safety) ---- */
.tms-voice-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: var(--tms-z-modal, 4000000);
}
.tms-voice-dialog {
  background: #fff;
  color: #0f172a;
  width: min(94vw, 460px);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
}
.tms-voice-dialog--warn { border-top: 5px solid #f59e0b; }
.tms-voice-dialog-title { font-size: 17px; font-weight: 800; margin-bottom: 14px; line-height: 1.35; }
.tms-voice-dialog-copy { font-size: 14px; line-height: 1.5; color: #334155; margin: 0 0 16px; }
.tms-voice-choices { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.tms-voice-choice {
  text-align: left;
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.tms-voice-choice:hover { border-color: #2563eb; background: #eff6ff; }
.tms-voice-choice-title { font-weight: 800; font-size: 15px; }
.tms-voice-choice-sub { font-size: 12.5px; color: #64748b; }
.tms-voice-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.tms-voice-dialog-close {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.tms-voice-dialog-close:hover { background: #f1f5f9; }

/* Dark mode friendliness */
@media (prefers-color-scheme: dark) {
  .tms-voice-dialog { background: #111827; color: #e5e7eb; }
  .tms-voice-dialog-copy { color: #cbd5e1; }
  .tms-voice-choice { background: #1f2937; border-color: #374151; }
  .tms-voice-choice:hover { background: #1e3a8a33; border-color: #3b82f6; }
  .tms-voice-choice-sub { color: #94a3b8; }
  .tms-voice-dialog-close { background: #1f2937; color: #e5e7eb; border-color: #374151; }
}

/* Small screens: keep the float button clear of mobile nav */
@media (max-width: 640px) {
  .tms-voice-mic--float { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); width: 52px; height: 52px; }
  .tms-voice-toasts { bottom: 140px; right: 12px; }
  .tms-voice-listen { bottom: 140px; }

  /* Welcome voice-replay pill (#tmsVoiceBar, built by js/tms-voice.js).
   * On phones its inline styles centered it at the bottom, where it floated
   * dead-center over page content and covered primary buttons (e.g. the Fleet
   * Dashboard "Upload & Analyze"). Dock it compactly in the bottom-left corner
   * (above the analyzer FAB), icon-only, so the content strip stays clear.
   * !important is required to beat the element's inline positioning. */
  #tmsVoiceBar {
    left: 16px !important;
    right: auto !important;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
    transform: none !important;
    padding: 5px !important;
    gap: 0 !important;
  }
  #tmsVoiceBar > span { display: none !important; }   /* hide the "Welcome" text label */
}
