/* Composer dictation: mic button, recording pill with level meter, transcribing shimmer.
   Button rules are scoped under .composer so they beat the composer's generic button sizing. */

.dictation {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer .dictation__mic {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
}

.composer .dictation__mic svg {
  width: 17px;
  height: 17px;
}

.composer .dictation__mic:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--text);
}

.composer .dictation__mic:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.composer .dictation__mic.is-recording {
  border-color: var(--danger);
  background: rgba(255, 138, 122, 0.14);
  color: var(--danger);
  animation: dictation-pulse 1.4s ease-in-out infinite;
}

.composer .dictation__cancel {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.dictation__pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 138, 122, 0.14);
  color: var(--danger);
  font-size: 12px;
  white-space: nowrap;
  animation: dictation-in 180ms ease-out;
}

.dictation__pill.is-busy {
  background: var(--hover);
  color: var(--muted);
}

.dictation__status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.dictation__dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dictation-blink 1.2s ease-in-out infinite;
}

.dictation__wave {
  flex: none;
  display: block;
  width: 72px;
  height: 22px;
  color: var(--danger);
}

.dictation__label {
  font-weight: 600;
}

.dictation__time {
  flex: none;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.dictation__shimmer {
  flex: none;
  width: 72px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hover) 0%, var(--green) 50%, var(--hover) 100%);
  background-size: 200% 100%;
  animation: dictation-shimmer 1.2s linear infinite;
}

@keyframes dictation-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 138, 122, 0.45);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 138, 122, 0);
  }
}

@keyframes dictation-in {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes dictation-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

@keyframes dictation-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .composer .dictation__mic.is-recording,
  .dictation__pill,
  .dictation__dot,
  .dictation__shimmer {
    animation: none;
  }
}

/* Phone: the composer row is tight. While a take is live, Attach steps aside and the pill
   shows only the dot and timer; Cancel keeps its icon. */
@media (max-width: 700px) {
  .dictation__label,
  .dictation__wave,
  .dictation__cancel-text {
    display: none;
  }

  .composer:has(.dictation__mic.is-recording) .attach-button {
    display: none;
  }
}
