/* ===========================================================================
   Áudio do chat do CRM — player e gravador no padrão WhatsApp Web.
   Usado pelos componentes <audio-mensagem> e <gravador-audio>.
   =========================================================================== */

/* ----------------------------------------------------------- Player (bolha) */

.audio-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
    max-width: 100%;
}

.audio-avatar,
.audio-velocidade {
    position: relative;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #d9dde0;
    color: #667781;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: visible;
}

.audio-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.audio-velocidade {
    font-size: .72rem;
    font-weight: 700;
    background: #c9ced1;
    color: #3b4a54;
}

/* Microfone sobreposto ao avatar: verde depois que a cliente ouviu */
.audio-mic {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .55rem;
    color: #8696a0;
}

.audio-mic.ouvido {
    color: #25d366;
}

.audio-play {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #54656f;
    font-size: 1rem;
    padding: 0;
}

.audio-play:hover {
    color: #111b21;
}

/* Waveform com seek */
.audio-onda-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 90px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.audio-onda-barras {
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.audio-onda-barras span {
    flex: 1 1 auto;
    min-width: 2px;
    max-width: 3px;
    border-radius: 2px;
    background: #c3cbd1;
    transition: background .12s linear;
}

.audio-onda-barras span.tocada {
    background: #54656f;
}

.audio-knob {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-radius: 50%;
    background: #54656f;
    transform: translateY(-50%);
    pointer-events: none;
}

.audio-tempo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .7rem;
    color: #667781;
    min-width: 34px;
}

/* Bolinha azul de "ainda não ouvido" */
.audio-nao-ouvido {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #53bdeb;
    display: inline-block;
}

/* Na bolha enviada (fundo verde) o contraste é outro */
.audio-msg-enviada .audio-onda-barras span { background: #a7c4b5; }
.audio-msg-enviada .audio-onda-barras span.tocada { background: #4a7c63; }
.audio-msg-enviada .audio-knob { background: #4a7c63; }

/* Transcrição recolhida */
.audio-transcricao {
    margin-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, .08);
    padding-top: 4px;
}

.audio-transcricao-toggle {
    font-size: .72rem;
    color: #667781 !important;
    text-decoration: none;
}

.audio-transcricao-texto {
    font-size: .8rem;
    color: #3b4a54;
    margin-top: 4px;
}

/* --------------------------------------------------------------- Gravador */

.gravador-barra {
    background: #f0f2f5;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
}

.gravador-linha {
    display: flex;
    align-items: center;
}

.rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef5350;
    display: inline-block;
    animation: recPulse 1.2s ease-in-out infinite;
}

@keyframes recPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .25; }
}

.rec-time {
    font-variant-numeric: tabular-nums;
    font-size: .9rem;
    color: #3b4a54;
    min-width: 42px;
}

.gravador-onda {
    height: 36px;
    width: 100%;
    max-width: 100%;
}

.gravador-onda-estatica {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 36px;
    overflow: hidden;
}

.gravador-onda-estatica span {
    flex: 1 1 auto;
    min-width: 2px;
    max-width: 3px;
    border-radius: 2px;
    background: #8696a0;
}

.rec-send {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
}

/* Telas estreitas: o waveform ao vivo é o primeiro a ceder espaço */
@media (max-width: 575.98px) {
    .gravador-onda { display: none; }
    .audio-msg { min-width: 200px; }
}
