/* Chat "atendente real" + PIX — complementa desenrola.css */

.chat-stream {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f6f7f9;
  min-height: 380px;
  max-height: 62vh;
}

html.theme-dark .chat-stream {
  background: #232323;
}

.msg {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  word-wrap: break-word;
  animation: msg-in 0.18s ease-out;
}

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

.msg--bot {
  align-self: flex-start;
  background: #fff;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.msg--user {
  align-self: flex-end;
  background: var(--azul-primario);
  color: #fff;
  border-bottom-right-radius: 4px;
}

html.theme-dark .msg--bot {
  background: #3a3a3a;
  color: #ededed;
}

.msg-hora {
  display: block;
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

/* Digitando */
.typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

html.theme-dark .typing {
  background: #3a3a3a;
}

.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa3ad;
  animation: dot 1.1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.typing span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Gravando áudio */
.recording {
  align-self: flex-start;
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: #d92d20;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

html.theme-dark .recording {
  background: #3a3a3a;
}

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d92d20;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

.rec-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.rec-bars i {
  display: block;
  width: 3px;
  background: #d92d20;
  border-radius: 2px;
  animation: bar 0.9s infinite ease-in-out;
}

.rec-bars i:nth-child(1) {
  animation-delay: 0s;
  height: 6px;
}
.rec-bars i:nth-child(2) {
  animation-delay: 0.1s;
  height: 12px;
}
.rec-bars i:nth-child(3) {
  animation-delay: 0.2s;
  height: 16px;
}
.rec-bars i:nth-child(4) {
  animation-delay: 0.3s;
  height: 10px;
}
.rec-bars i:nth-child(5) {
  animation-delay: 0.4s;
  height: 14px;
}

@keyframes bar {
  0%,
  100% {
    transform: scaleY(0.4);
  }
  50% {
    transform: scaleY(1);
  }
}

/* Áudio da atendente */
.msg--audio {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
}

.audio-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: none;
  border-radius: 50%;
  background: var(--azul-primario);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.audio-wave {
  flex: 1;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}

.audio-wave i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: #c3ccd6;
  height: 40%;
}

.audio-wave i.on {
  background: var(--azul-primario);
}

.audio-dur {
  font-size: 11px;
  color: #667;
  min-width: 34px;
  text-align: right;
}

/* Opções de resposta rápida */
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e8e8e8;
  background: #fff;
}

html.theme-dark .chat-actions {
  background: #2a2a2a;
  border-top-color: #444;
}

.chat-opt {
  border: 1.5px solid var(--azul-primario);
  background: #fff;
  color: var(--azul-primario);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: 0.15s;
}

.chat-opt:hover {
  background: var(--azul-primario);
  color: #fff;
}

.chat-opt--full {
  width: 100%;
  border-radius: 8px;
}

html.theme-dark .chat-opt {
  background: #333;
}

/* PIX */
.pix-wrap {
  text-align: center;
  padding: 20px 18px 24px;
}

.pix-valor {
  font-size: 30px;
  font-weight: 800;
  color: var(--azul-primario);
  margin: 4px 0 2px;
}

.pix-qr {
  width: 220px;
  height: 220px;
  margin: 14px auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pix-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pix-copia {
  width: 100%;
  font-family: monospace;
  font-size: 11px;
  padding: 10px;
  border: 1px solid var(--borda-input);
  border-radius: 8px;
  resize: none;
  min-height: 72px;
  background: #fafafa;
}

html.theme-dark .pix-copia {
  background: #333;
  border-color: #555;
  color: #eee;
}

.pix-status {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #8a6d00;
  background: var(--alerta-amarelo-bg);
  border: 1px solid var(--alerta-amarelo-borda);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.pix-status--ok {
  color: var(--sucesso-texto);
  background: var(--sucesso-bg);
  border-color: #b7e0c0;
}

.spin {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pix-timer {
  font-size: 13px;
  color: #666;
  margin-top: 8px;
}

/* Player de áudio isolado (pix / obrigado) */
.chat-audio-solo {
  margin: 14px 0 6px;
  display: flex;
  justify-content: center;
}
.chat-audio-solo audio {
  width: 100%;
  max-width: 320px;
}

/* ============ Linhas de mensagem estilo funil original ============ */
.msg-row {
  display: flex;
  align-items: flex-end;
  margin-bottom: 10px;
  animation: fadeUp 0.28s ease both;
}
.msg-row.user {
  justify-content: flex-end;
}
.msg-row > .avatar,
.msg-row > .avatar-spacer {
  width: 30px;
  height: 30px;
  margin-right: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
}
.bubble-bot,
.bubble-user,
.bubble-system {
  max-width: 78%;
  font-size: 14.5px;
  line-height: 1.45;
  padding: 10px 14px;
  border-radius: 18px 18px 18px 4px;
  background: #fff;
  border: 1px solid #e5e5e5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
}
.bubble-user {
  background: #1351b4;
  color: #fff;
  border: none;
  border-radius: 18px 18px 4px 18px;
}
.bubble-system {
  background: #eef1f5;
  border: none;
  box-shadow: none;
  color: #666;
  font-size: 13px;
  text-align: center;
  max-width: 100%;
  border-radius: 10px;
}
.msg-media {
  max-width: 78%;
  border-radius: 8px;
}
.bubble-info-card {
  background: #fff;
  border-left: 4px solid #1351b4;
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 78%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
  font-size: 14px;
}
.bubble-info-card .ic-label {
  color: #555;
}
.bubble-info-card .ic-value {
  color: #1351b4;
  font-weight: 600;
}
.bubble-info-card .ic-bold {
  font-weight: 700;
  color: #1a1a1a;
}
.confirm-card {
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: 10px;
  padding: 12px 14px;
  max-width: 78%;
  font-size: 14px;
  display: grid;
  gap: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.07);
}
.confirm-card .confirm-title {
  font-weight: 700;
  color: #1351b4;
  margin-bottom: 6px;
  display: block;
}
.chat-opt--ghost {
  background: #fff;
  color: #1351b4;
}
html.theme-dark .bubble-bot,
html.theme-dark .bubble-info-card,
html.theme-dark .confirm-card {
  background: #2a2a2a;
  border-color: #3a3a3a;
  color: #eee;
}
html.theme-dark .bubble-system {
  background: #222;
  color: #aaa;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bubble-bot,
.bubble-user,
.bubble-info-card,
.confirm-card {
  text-align: left;
}

/* Vídeo VSL no chat (sem controles) */
.msg-video {
  position: relative;
  display: inline-block;
  max-width: 100%;
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  margin-top: 4px;
}
.msg-video video {
  display: block;
  height: 400px;
  max-height: 60vh;
  width: auto;
  max-width: 100%;
}
.msg-video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
}
