/* voice-fill.css — mic buttons added by assets/crm/js/voice-fill.js */

.vf-host {
  position: relative;
}

/* keep long labels clear of the mic button */
.vf-host > label {
  padding-right: 30px;
}

.vf-mic {
  position: absolute;
  top: -3px;
  right: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--vf-border, rgba(37, 99, 235, 0.35));
  border-radius: 50%;
  background: var(--vf-bg, #ffffff);
  color: var(--vf-accent, var(--primary-color, #2563eb));
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

/* Bootstrap floating field (label inside the box): mic sits inside the input, on the right.
   A page with shorter inputs sets --vf-field-h (Bootstrap's default is 3.5rem + 2px). */
.form-floating.vf-host > .vf-mic {
  top: calc(var(--vf-field-h, calc(3.5rem + 2px)) / 2 - 12px);
  right: 10px;
  z-index: 5;
}
.form-floating.vf-host > .form-control {
  padding-right: 42px;
}

/* bare dropdown with no label above it: mic just left of the arrow */
.form-group-alt.vf-host:not(:has(> label)) > .vf-mic {
  top: 7px;
  right: 34px;
  z-index: 5;
}

.vf-mic:hover {
  background: var(--vf-accent, var(--primary-color, #2563eb));
  color: #ffffff;
}

.vf-mic:focus-visible {
  outline: 2px solid var(--vf-accent, var(--primary-color, #2563eb));
  outline-offset: 2px;
}

.vf-mic.vf-listening {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  animation: vf-pulse 1.2s ease-out infinite;
}

/* waiting for the voice service to answer */
.vf-mic.vf-busy,
.vf-whole-btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

@keyframes vf-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  100% { box-shadow: 0 0 0 9px rgba(220, 38, 38, 0); }
}

.vf-field-listening {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

.vf-field-filled {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ---- "Speak whole form" bar ---- */

.vf-whole {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px dashed var(--vf-border, rgba(37, 99, 235, 0.35));
  border-radius: 10px;
  background: var(--vf-whole-bg, rgba(37, 99, 235, 0.04));
}

.vf-whole-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--vf-accent, var(--primary-color, #2563eb));
  border-radius: 999px;
  background: var(--vf-accent, var(--primary-color, #2563eb));
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.vf-whole-btn:hover {
  filter: brightness(1.08);
}

.vf-whole-btn:focus-visible {
  outline: 2px solid var(--vf-accent, var(--primary-color, #2563eb));
  outline-offset: 2px;
}

.vf-whole-btn.vf-listening {
  background: #dc2626;
  border-color: #dc2626;
  animation: vf-pulse 1.2s ease-out infinite;
}

.vf-whole-hint {
  margin-top: 6px;
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.4;
}

.vf-whole-live {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  font-size: 0.78rem;
  color: #0f172a;
  line-height: 1.4;
  min-height: 1.4em;
}

.vf-whole-live.vf-info {
  color: #475569;
  font-style: italic;
}

.vf-whole-live[hidden],
.vf-whole-summary[hidden] {
  display: none;
}

.vf-whole-summary {
  position: relative;
  margin-top: 8px;
  padding: 8px 28px 8px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #334155;
}

.vf-whole-summary.vf-ok    { border-color: rgba(22, 163, 74, 0.4); }
.vf-whole-summary.vf-warn  { border-color: rgba(180, 83, 9, 0.4); }
.vf-whole-summary.vf-error { border-color: rgba(185, 28, 28, 0.4); color: #b91c1c; }

.vf-whole-head {
  font-weight: 600;
}

.vf-whole-heard {
  margin-top: 2px;
  color: #64748b;
  font-style: italic;
  word-break: break-word;
}

.vf-whole-summary ul {
  margin: 6px 0 0;
  padding-left: 0;
  list-style: none;
}

.vf-whole-summary li.vf-ok   { color: #15803d; }
.vf-whole-summary li.vf-warn { color: #b45309; }

.vf-whole-tip {
  margin-top: 6px;
  color: #64748b;
}

.vf-whole-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  color: #64748b;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.vf-whole-close:hover {
  color: #0f172a;
}

.vf-status {
  margin-top: 4px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #475569;
}

.vf-status[hidden] {
  display: none;
}

.vf-status.vf-ok    { color: #15803d; }
.vf-status.vf-warn  { color: #b45309; }
.vf-status.vf-error { color: #b91c1c; }
.vf-status.vf-info  { color: #475569; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .vf-mic,
  .vf-mic.vf-listening,
  .vf-whole-btn.vf-listening,
  .vf-field-filled {
    animation: none;
    transition: none;
  }
}
