/* ================================================================
   ALVUS DICTATION — estilos do modo ditado contínuo
   Namespace: .alv-dict-*
   ================================================================ */

/* ── Dot indicador de estado ──────────────────────────────────── */
#alv-dict-dot {
  position: fixed;
  top: 12px;
  right: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
  transition: background 0.25s, box-shadow 0.25s;
}

#alv-dict-dot[data-state="LISTENING"] {
  background: #00efff;
  box-shadow: 0 0 0 3px rgba(0, 239, 255, 0.25), 0 0 10px rgba(0, 239, 255, 0.6);
  animation: alv-dict-pulse 1.4s ease-in-out infinite;
}

#alv-dict-dot[data-state="PAUSED"] {
  background: #f39c12;
  box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.25);
  animation: none;
}

@keyframes alv-dict-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0, 239, 255, 0.25), 0 0 10px rgba(0, 239, 255, 0.6); }
  50%       { box-shadow: 0 0 0 6px rgba(0, 239, 255, 0.1),  0 0 18px rgba(0, 239, 255, 0.8); }
}

/* ── Botão da toolbar ─────────────────────────────────────────── */
#btn-alv-dictation {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0, 239, 255, 0.22);
  background: rgba(0, 239, 255, 0.06);
  color: #7de8f8;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s;
  white-space: nowrap;
  user-select: none;
}

#btn-alv-dictation:hover {
  background: rgba(0, 239, 255, 0.15);
  border-color: rgba(0, 239, 255, 0.5);
  color: #d0f9ff;
}

#btn-alv-dictation.alv-dict--listening {
  background: rgba(0, 239, 255, 0.18);
  border-color: rgba(0, 239, 255, 0.7);
  color: #00efff;
  box-shadow: 0 0 8px rgba(0, 239, 255, 0.4);
  animation: alv-btn-pulse 1.6s ease-in-out infinite;
}

#btn-alv-dictation.alv-dict--paused {
  background: rgba(243, 156, 18, 0.12);
  border-color: rgba(243, 156, 18, 0.5);
  color: #f7c048;
}

@keyframes alv-btn-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(0, 239, 255, 0.35); }
  50%       { box-shadow: 0 0 14px rgba(0, 239, 255, 0.65); }
}

/* ── Ícone de microfone (SVG inline no botão) ─────────────────── */
#btn-alv-dictation .alv-mic-icon {
  flex-shrink: 0;
  transition: fill 0.14s;
}

/* ── Texto interim no editor ─────────────────────────────────── */
.alv-interim {
  color: rgba(180, 220, 240, 0.55);
  font-style: italic;
  pointer-events: none;
  user-select: none;
}

/* ── Flash de feedback de comando ────────────────────────────── */
#alv-dict-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 99999;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
}

#alv-dict-flash.alv-flash--ok {
  background: rgba(0, 180, 100, 0.92);
  color: #e0fff0;
  box-shadow: 0 2px 20px rgba(0, 180, 100, 0.5);
}

#alv-dict-flash.alv-flash--error {
  background: rgba(200, 40, 40, 0.92);
  color: #ffe0e0;
  box-shadow: 0 2px 20px rgba(200, 40, 40, 0.5);
}

#alv-dict-flash.alv-flash--warn {
  background: rgba(200, 140, 0, 0.92);
  color: #fff8e0;
  box-shadow: 0 2px 20px rgba(200, 140, 0, 0.4);
}

#alv-dict-flash[data-visible="1"] {
  opacity: 1;
}

/* ── Overlay de confirmação (limpar laudo etc.) ───────────────── */
#alv-dict-confirm {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
}

#alv-dict-confirm .alv-confirm-box {
  background: #1a2030;
  border: 1px solid rgba(0, 239, 255, 0.3);
  border-radius: 12px;
  padding: 24px 32px;
  text-align: center;
  max-width: 380px;
  color: #c8dff0;
  font-family: 'Inter', sans-serif;
}

#alv-dict-confirm .alv-confirm-msg {
  font-size: 1rem;
  margin-bottom: 18px;
  line-height: 1.5;
}

#alv-dict-confirm .alv-confirm-hint {
  font-size: 0.78rem;
  opacity: 0.6;
}

/* ================================================================
   ALVUS INTERIM RENDERER — premium rendering layer
   Namespace: .alvus-*   (separate from legacy .alv-interim)
   ================================================================ */

@font-face {
  font-family: 'Michroma';
  src: url('assets/fonts/michroma.woff2') format('woff2');
  font-display: swap;
}

/* ── Wrapper ──────────────────────────────────────────────────── */
.alvus-interim {
  display: inline;
  pointer-events: none;
  user-select: none;
}

/* ── Committed words box ──────────────────────────────────────── */
.alvus-iw-box {
  display: inline;
  color: #007a9e;
  transition: color .6s ease;
}

.alvus-iw {
  display: inline;
  opacity: 0;
  filter: blur(3px);
  transition: opacity .35s ease, filter .35s ease;
}

.alvus-iw.in {
  opacity: 1;
  filter: blur(0);
}

/* ── Blinking caret ───────────────────────────────────────────── */
.alvus-icaret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  vertical-align: -3px;
  background: #007a9e;
  margin-left: 2px;
  animation: alvus-caret-blink 1.1s steps(1) infinite;
}

@keyframes alvus-caret-blink {
  0%, 55%  { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* ── ALVUS brand / decode indicator ──────────────────────────── */
.alvus-brand {
  display: inline-block;
  margin-left: 6px;
  vertical-align: 1px;
  transition: opacity .15s ease;
}

.alvus-bl {
  display: inline-block;
  font-family: 'Michroma', sans-serif;
  font-size: 10px;
  letter-spacing: .04em;
  width: 1em;
  text-align: center;
  color: rgba(0, 122, 158, .35);
  transition: color .2s;
}

.alvus-bl.lk {
  color: #007a9e;
}

.alvus-bl.aur {
  background: linear-gradient(90deg, #0090b8, #6d4fc4, #00917a, #0090b8);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: alvus-flow 1.2s linear infinite;
}

@keyframes alvus-flow {
  0%   { background-position: 0% 0; }
  100% { background-position: 300% 0; }
}

/* ── Brand dot fallback (no Michroma font) ────────────────────── */
.alvus-brand-dots {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .08em;
  color: rgba(0, 122, 158, .5);
}

.alvus-brand-dots span {
  display: inline-block;
  animation: alvus-dot-pulse .9s ease-in-out infinite;
}
.alvus-brand-dots span:nth-child(2) { animation-delay: .2s; }
.alvus-brand-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes alvus-dot-pulse {
  0%, 100% { opacity: .3; }
  50%       { opacity: 1; }
}

/* ── prefers-reduced-motion: strip all animations ─────────────── */
@media (prefers-reduced-motion: reduce) {
  .alvus-icaret           { animation: none; opacity: 1; }
  .alvus-bl.aur           { animation: none; }
  .alvus-brand-dots span  { animation: none; opacity: .4; }
  .alvus-iw               { opacity: 0; filter: none; transition: none; }
  .alvus-iw.in            { opacity: 1; }
}
