/* ============================================================
 *  VOICE MESSAGES  (shared styles)
 * ------------------------------------------------------------
 *  Styles the in-composer recording bar built by
 *  /script/default/voice-recorder.js (window.OsbyVoice) plus the
 *  inline <audio> player used for sent voice notes. Loaded
 *  globally from views/partials/menu.hbs so both chat surfaces
 *  (the floating widget and /social/chat) share one look.
 *
 *  The recording bar is an absolutely-positioned OVERLAY on the
 *  composer (which is position:relative), so it visually replaces
 *  the text row + buttons without us having to hide each child.
 * ============================================================ */

/* ---- Mic button (lives in each composer, matches its siblings) ---- */
.chat-voice-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-voice-mic svg {
  width: 20px;
  height: 20px;
}

.chat-voice-mic[aria-pressed='true'] {
  color: #ff5a5f;
}

/* ---- Recording bar (overlay) ---- */
.voice-bar {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: rgba(18, 18, 22, 0.98);
  border-radius: inherit;
  animation: voice-bar-in 0.16s ease;
}

@keyframes voice-bar-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.voice-bar button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  color: #cfcfd4;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.voice-bar button svg {
  width: 19px;
  height: 19px;
}

.voice-bar .voice-cancel:hover {
  background: rgba(255, 90, 95, 0.16);
  color: #ff7a7f;
}

.voice-bar .voice-send {
  background: #2b6dab;
  color: #fff;
}

.voice-bar .voice-send:hover {
  background: #3580c4;
}

.voice-bar .voice-send:active {
  transform: scale(0.92);
}

.voice-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b3b;
  animation: voice-pulse 1.1s ease-in-out infinite;
}

@keyframes voice-pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

.voice-time {
  flex: 0 0 auto;
  min-width: 42px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #eaeaea;
}

/* Live "waveform" — purely decorative bouncing bars. */
.voice-wave {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  overflow: hidden;
}

.voice-wave i {
  flex: 0 0 auto;
  width: 3px;
  height: 30%;
  border-radius: 3px;
  background: #5b9bd5;
  animation: voice-eq 0.9s ease-in-out infinite;
}

.voice-wave i:nth-child(1) {
  animation-delay: -0.8s;
}

.voice-wave i:nth-child(2) {
  animation-delay: -0.5s;
}

.voice-wave i:nth-child(3) {
  animation-delay: -0.2s;
}

.voice-wave i:nth-child(4) {
  animation-delay: -0.6s;
}

.voice-wave i:nth-child(5) {
  animation-delay: -0.1s;
}

.voice-wave i:nth-child(6) {
  animation-delay: -0.4s;
}

.voice-wave i:nth-child(7) {
  animation-delay: -0.7s;
}

.voice-wave i:nth-child(8) {
  animation-delay: -0.3s;
}

@keyframes voice-eq {

  0%,
  100% {
    height: 20%;
  }

  50% {
    height: 90%;
  }
}

/* Uploading after Stop — freeze the meters, dim the controls. */
.voice-bar.is-busy .voice-wave i,
.voice-bar.is-busy .voice-dot {
  animation-play-state: paused;
  opacity: 0.4;
}

.voice-bar.is-busy .voice-cancel,
.voice-bar.is-busy .voice-send {
  opacity: 0.5;
  pointer-events: none;
}

/* ---- Inline player for a sent voice note ---- */
.chat-voice {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.chat-voice audio {
  width: 240px;
  max-width: 100%;
  height: 40px;
}

@media (max-width: 480px) {
  .chat-voice audio {
    width: 210px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .voice-bar,
  .voice-dot,
  .voice-wave i {
    animation: none;
  }

  .voice-wave i {
    height: 45%;
  }
}