/* ============================================================
 *  Peerly — Messages vocaux
 *  v8.2.0 — play button arrondi
 * ============================================================ */

.voice-bubble {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--space-3) var(--space-4);
  min-width: 220px;
  max-width: 340px;
  cursor: default;
}

.voice-player {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

/* ---- Bouton play/pause — rond ---- */
.voice-play-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--md-primary);
  color: var(--md-on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-instant) var(--ease-out);
}
.voice-play-btn:hover {
  background: color-mix(in srgb, var(--md-primary) 88%, white 12%);
  transform: scale(1.05);
}
.voice-play-btn:active {
  transform: scale(0.94);
}
.voice-play-btn i {
  font-size: 20px;
  line-height: 1;
}

/* ---- Zone centrale : waveform ---- */
.voice-center {
  flex: 1;
  min-width: 0;
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.voice-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 32px;
  width: 100%;
  cursor: pointer;
  user-select: none;
}
.voice-bar {
  flex: 1;
  min-width: 2px;
  max-width: 3px;
  border-radius: var(--radius-full);
  background: currentColor;
  opacity: 0.35;
  transition: opacity 100ms ease, background 100ms ease;
  pointer-events: none;
}

/* --- Dans une bulle envoyée --- */
.chat-bubble.sent .voice-bar {
  background: var(--md-on-primary);
  opacity: 0.35;
}
.chat-bubble.sent .voice-bar.active {
  background: var(--md-on-primary);
  opacity: 1;
}

/* --- Dans une bulle reçue --- */
.chat-bubble.received .voice-bar {
  background: var(--md-on-surface);
  opacity: 0.3;
}
.chat-bubble.received .voice-bar.active {
  background: var(--md-primary);
  opacity: 1;
}

/* ---- Barre de progression (invisible) ---- */
.voice-progress {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
}
.voice-progress-fill {
  height: 100%;
  width: 0%;
}

/* ---- Durée ---- */
.voice-duration {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-medium);
  opacity: 0.75;
  flex-shrink: 0;
  min-width: 34px;
  text-align: right;
}

/* ---- Mobile ---- */
@media (max-width: 599px) {
  .voice-bubble {
    min-width: 180px;
    padding: var(--space-2) var(--space-3);
    gap: 6px;
  }
  .voice-player {
    gap: var(--space-2);
  }
  .voice-play-btn {
    width: 36px;
    height: 36px;
  }
  .voice-play-btn i {
    font-size: 18px;
  }
  .voice-bars {
    height: 28px;
    gap: 1.5px;
  }
  .voice-bar {
    min-width: 2px;
  }
  .voice-duration {
    min-width: 30px;
    font-size: 10px;
  }
}