/* =====================================================================
   MYMOBI CRM — chat-v2.css
   Módulo de Conversas V2 — Design WhatsApp Web
   ===================================================================== */

/* ── Variáveis do chat ─────────────────────────────────────────────── */
:root {
  --chat-bg:            #f0f2f5;
  --chat-sidebar-bg:    #ffffff;
  --chat-panel-bg:      #efeae2;
  --chat-panel-img:     url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='366' height='336'%3E%3C/svg%3E");
  --bubble-out:         #d9fdd3;
  --bubble-in:          #ffffff;
  --bubble-out-dark:    #202c33;
  --bubble-in-dark:     #202c33;
  --bubble-radius:      8px;
  --bubble-radius-tail: 0px;
  --chat-input-bg:      #ffffff;
  --chat-meta-color:    #667781;
  --chat-tick-delivered:#667781;
  --chat-tick-read:     #53bdeb;
  --reply-bar:          #00a884;
  --reply-bg:           rgba(0,0,0,.06);
  --waveform-color:     #00a884;
  --waveform-played:    #667781;
  --unread-badge:       #25d366;
  --search-bg:          #f0f2f5;
  --conv-hover:         #f5f6f6;
  --conv-active:        #e9edef;
  --divider-date-bg:    #e1f2fb;
  --divider-date-color: #54656f;
  --system-msg-bg:      rgba(225,245,251,.92);
}

/* ── Layout principal ──────────────────────────────────────────────── */
#chatV2Root {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: var(--chat-bg);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
}

/* ── SIDEBAR (lista de conversas) ──────────────────────────────────── */
.cv2-sidebar {
  width: 360px;
  min-width: 280px;
  max-width: 420px;
  background: var(--chat-sidebar-bg);
  border-right: 1px solid #e9edef;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

/* Cabeçalho da sidebar */
.cv2-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f0f2f5;
  min-height: 56px;
}
.cv2-sidebar-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #111b21;
  margin: 0;
}

/* Barra de busca */
.cv2-search-wrap {
  padding: 6px 12px 8px;
  background: var(--chat-sidebar-bg);
}
.cv2-search-input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--search-bg);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  color: #111b21;
  outline: none;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667781' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 16px;
}
.cv2-search-input::placeholder { color: #8696a0; }
.cv2-search-input:focus { background-color: #ffffff; }

/* Filtros de fila */
.cv2-filters {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e9edef;
  overflow-x: auto;
  scrollbar-width: none;
}
.cv2-filters::-webkit-scrollbar { display: none; }
.cv2-filter-btn {
  flex: 1;
  min-width: max-content;
  padding: 8px 12px;
  border: none;
  background: none;
  color: #8696a0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.cv2-filter-btn.active {
  color: #00a884;
  border-bottom-color: #00a884;
}
.cv2-filter-btn:hover { background: var(--conv-hover); }

/* Lista de conversas */
.cv2-conv-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.cv2-conv-list::-webkit-scrollbar { width: 4px; }
.cv2-conv-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Item de conversa */
.cv2-conv-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f2f5;
  transition: background .1s;
  position: relative;
  user-select: none;
}
.cv2-conv-item:hover   { background: var(--conv-hover); }
.cv2-conv-item.active  { background: var(--conv-active); }

.cv2-conv-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #dfe5e7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: #667781;
}
.cv2-conv-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cv2-conv-body { flex: 1; min-width: 0; }
.cv2-conv-top  {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}
.cv2-conv-name {
  font-size: 15px;
  font-weight: 500;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.cv2-conv-time {
  font-size: 12px;
  color: var(--chat-meta-color);
  white-space: nowrap;
  flex-shrink: 0;
}
.cv2-conv-time.unread { color: #25d366; font-weight: 500; }

.cv2-conv-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cv2-conv-preview {
  font-size: 13px;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  max-width: 220px;
}
.cv2-conv-preview .prev-you  { color: #111b21; }
.cv2-badge {
  background: var(--unread-badge);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.cv2-badge.muted { background: #8696a0; }

.cv2-conv-empty {
  padding: 48px 24px;
  text-align: center;
  color: #8696a0;
  font-size: 14px;
}
.cv2-conv-loading {
  padding: 24px;
  text-align: center;
  color: #8696a0;
}

/* ── PAINEL CENTRAL (chat) ─────────────────────────────────────────── */
.cv2-chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--chat-panel-bg);
  position: relative;
}

/* Tela vazia quando nenhuma conversa está selecionada */
.cv2-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8696a0;
  text-align: center;
  gap: 16px;
  background: var(--chat-bg);
}
.cv2-chat-empty svg { opacity: .3; }
.cv2-chat-empty h2 { font-size: 20px; font-weight: 300; color: #41525d; margin: 0; }
.cv2-chat-empty p  { font-size: 14px; margin: 0; }

/* Cabeçalho do chat */
.cv2-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #f0f2f5;
  border-bottom: 1px solid #e9edef;
  min-height: 56px;
  flex-shrink: 0;
}
.cv2-chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #dfe5e7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #667781;
  cursor: pointer;
  flex-shrink: 0;
}
.cv2-chat-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cv2-chat-header-info { flex: 1; min-width: 0; }
.cv2-chat-header-name {
  font-size: 15px;
  font-weight: 600;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv2-chat-header-status {
  font-size: 12px;
  color: #8696a0;
}
.cv2-chat-header-status.online { color: #25d366; }

.cv2-chat-header-actions {
  display: flex;
  gap: 8px;
}
.cv2-header-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  color: #54656f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background .1s;
}
.cv2-header-btn:hover { background: #e9edef; }

/* Área de mensagens */
.cv2-messages-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8% 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  /* Fundo estilo WhatsApp */
  background-color: var(--chat-panel-bg);
}
.cv2-messages-area::-webkit-scrollbar { width: 6px; }
.cv2-messages-area::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Indicador de carregamento de mensagens antigas */
.cv2-load-more {
  text-align: center;
  padding: 8px;
  font-size: 13px;
  color: #8696a0;
}
.cv2-load-more button {
  background: #e1f2fb;
  border: none;
  border-radius: 16px;
  padding: 6px 16px;
  font-size: 12px;
  color: #54656f;
  cursor: pointer;
}
.cv2-load-more button:hover { background: #d0eaf8; }

/* Separador de data */
.cv2-date-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
  position: sticky;
  top: 8px;
  z-index: 1;
}
.cv2-date-sep span {
  background: var(--divider-date-bg);
  color: var(--divider-date-color);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

/* ── BOLHAS DE MENSAGEM ─────────────────────────────────────────────── */
.cv2-msg-row {
  display: flex;
  margin-bottom: 1px;
}
.cv2-msg-row.out { justify-content: flex-end; }
.cv2-msg-row.in  { justify-content: flex-start; }
.cv2-msg-row.sys { justify-content: center; }

.cv2-bubble {
  max-width: 65%;
  min-width: 60px;
  border-radius: var(--bubble-radius);
  padding: 6px 7px 8px 9px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

/* Cauda da bolha */
.cv2-msg-row.out .cv2-bubble {
  background: var(--bubble-out);
  border-bottom-right-radius: var(--bubble-radius-tail);
}
.cv2-msg-row.in .cv2-bubble {
  background: var(--bubble-in);
  border-bottom-left-radius: var(--bubble-radius-tail);
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

/* Bolha de sistema */
.cv2-sys-msg {
  background: var(--system-msg-bg);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  color: #54656f;
  text-align: center;
  max-width: 340px;
}

/* Texto da mensagem */
.cv2-msg-text {
  font-size: 14.2px;
  color: #111b21;
  white-space: pre-wrap;
}
.cv2-msg-row.out .cv2-msg-text { color: #111b21; }

/* Meta (hora + status) */
.cv2-msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  float: right;
  margin-left: 8px;
  margin-bottom: -2px;
}
.cv2-msg-time {
  font-size: 11px;
  color: var(--chat-meta-color);
  white-space: nowrap;
}
.cv2-msg-ticks {
  font-size: 14px;
  color: var(--chat-tick-delivered);
}
.cv2-msg-ticks.read { color: var(--chat-tick-read); }

/* ── REPLY (mensagem citada) ────────────────────────────────────────── */
.cv2-reply-block {
  border-left: 3px solid var(--reply-bar);
  background: var(--reply-bg);
  border-radius: 0 6px 6px 0;
  padding: 6px 10px;
  margin: 0 0 6px;
  cursor: pointer;
  transition: filter .1s;
}
.cv2-reply-block:hover { filter: brightness(.95); }
.cv2-reply-from {
  font-size: 12px;
  font-weight: 600;
  color: var(--reply-bar);
  margin-bottom: 2px;
}
.cv2-reply-preview {
  font-size: 12.5px;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.cv2-reply-preview .reply-icon { margin-right: 4px; }

/* ── IMAGEM ─────────────────────────────────────────────────────────── */
.cv2-img-wrap {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  max-width: 300px;
  cursor: zoom-in;
}
.cv2-img-wrap img {
  display: block;
  width: 100%;
  max-width: 300px;
  max-height: 280px;
  object-fit: cover;
  border-radius: 6px;
  transition: filter .2s;
}
.cv2-img-wrap:hover img { filter: brightness(.92); }
.cv2-media-failed {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 180px; height: 100px; border-radius: 8px;
  background: #f0f2f5; color: #667781; gap: 6px; font-size: 12px; cursor: default;
}
.cv2-media-failed i { font-size: 28px; color: #aaa; }
.cv2-img-placeholder {
  width: 220px;
  height: 160px;
  background: #dfe5e7;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8696a0;
  font-size: 28px;
}
.cv2-img-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.4));
  padding: 20px 8px 4px;
}

/* ── ÁUDIO ──────────────────────────────────────────────────────────── */
.cv2-audio-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  min-width: 220px;
  max-width: 320px;
}
.cv2-audio-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dfe5e7;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #8696a0;
  flex-shrink: 0;
}
.cv2-audio-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cv2-audio-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #00a884;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: background .15s;
}
.cv2-msg-row.in .cv2-audio-play-btn  { background: #00a884; }
.cv2-msg-row.out .cv2-audio-play-btn { background: #00a884; }
.cv2-audio-play-btn:hover { background: #028a6e; }
.cv2-audio-play-btn:disabled { background: #ccc; cursor: default; }

.cv2-audio-body { flex: 1; min-width: 0; }
.cv2-waveform {
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 28px;
  cursor: pointer;
  padding: 2px 0;
}
.cv2-waveform-bar {
  width: 3px;
  border-radius: 2px;
  background: #c4c4c4;
  transition: background .1s;
  min-height: 3px;
  flex-shrink: 0;
}
.cv2-waveform-bar.played { background: var(--waveform-color); }
.cv2-audio-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}
.cv2-audio-time {
  font-size: 11px;
  color: var(--chat-meta-color);
}
.cv2-audio-speed {
  font-size: 10px;
  font-weight: 600;
  color: #8696a0;
  cursor: pointer;
  border: 1px solid #c4c4c4;
  border-radius: 10px;
  padding: 0 5px;
  line-height: 16px;
}
.cv2-audio-speed:hover { background: rgba(0,0,0,.05); }

/* ── VÍDEO ──────────────────────────────────────────────────────────── */
.cv2-video-wrap {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  max-width: 300px;
}
.cv2-video-wrap video {
  display: block;
  width: 100%;
  max-width: 300px;
  max-height: 260px;
  border-radius: 6px;
}
.cv2-video-thumb {
  width: 100%;
  max-width: 300px;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  cursor: pointer;
}
.cv2-video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cv2-video-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  transition: transform .15s;
}
.cv2-video-play-overlay:hover .cv2-video-play-btn { transform: scale(1.08); }

/* ── DOCUMENTO ──────────────────────────────────────────────────────── */
.cv2-doc-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  max-width: 280px;
  text-decoration: none;
  color: inherit;
}
.cv2-doc-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  color: #fff;
}
.cv2-doc-icon.pdf  { background: #e53935; }
.cv2-doc-icon.doc  { background: #1976d2; }
.cv2-doc-icon.xls  { background: #388e3c; }
.cv2-doc-icon.zip  { background: #f57c00; }
.cv2-doc-icon.img  { background: #7b1fa2; }
.cv2-doc-icon.vid  { background: #00796b; }
.cv2-doc-icon.aud  { background: #0288d1; }
.cv2-doc-icon.def  { background: #546e7a; }

.cv2-doc-info { flex: 1; min-width: 0; }
.cv2-doc-name {
  font-size: 13.5px;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.cv2-doc-meta {
  font-size: 12px;
  color: #8696a0;
  margin-top: 1px;
}
.cv2-doc-download {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e9edef;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #54656f;
  font-size: 14px;
  flex-shrink: 0;
  text-decoration: none;
  transition: background .15s;
}
.cv2-doc-download:hover { background: #d1d7db; }

/* ── STICKER ────────────────────────────────────────────────────────── */
.cv2-sticker-wrap { padding: 0; }
.cv2-sticker-wrap img {
  width: 160px;
  height: 160px;
  object-fit: contain;
}
.cv2-sticker-wrap .cv2-bubble {
  background: transparent !important;
  box-shadow: none !important;
  padding: 4px;
}

/* ── LOCALIZAÇÃO ────────────────────────────────────────────────────── */
.cv2-location-wrap a {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  text-decoration: none;
}
.cv2-location-map {
  width: 100%;
  max-width: 260px;
  height: 140px;
  object-fit: cover;
  display: block;
}
.cv2-location-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 13px;
  color: #00a884;
  font-weight: 500;
  background: #f0f2f5;
}

/* ── CONTATO ────────────────────────────────────────────────────────── */
.cv2-contact-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
.cv2-contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dfe5e7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #8696a0;
  flex-shrink: 0;
}
.cv2-contact-name { font-size: 14px; color: #111b21; font-weight: 500; }
.cv2-contact-sep  {
  height: 1px;
  background: #e9edef;
  margin: 6px 0;
}
.cv2-contact-add-btn {
  width: 100%;
  border: none;
  background: none;
  color: #00a884;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 0;
  cursor: pointer;
  text-align: center;
}

/* ── REAÇÃO ─────────────────────────────────────────────────────────── */
.cv2-reaction-badge {
  position: absolute;
  bottom: -4px;
  right: 8px;
  background: #fff;
  border: 1px solid #e9edef;
  border-radius: 12px;
  padding: 1px 5px;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  cursor: default;
}

/* ── MENSAGEM APAGADA ───────────────────────────────────────────────── */
.cv2-deleted-msg {
  font-size: 13.5px;
  color: #8696a0;
  font-style: italic;
}
.cv2-deleted-msg i { margin-right: 5px; }

/* ── ENQUETE ────────────────────────────────────────────────────────── */
.cv2-poll-wrap { min-width: 220px; }
.cv2-poll-question {
  font-size: 14.5px;
  font-weight: 600;
  color: #111b21;
  margin-bottom: 10px;
}
.cv2-poll-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13.5px;
  color: #111b21;
  border-top: 1px solid #e9edef;
}
.cv2-poll-option i { color: #8696a0; }

/* ── LEGENDA ─────────────────────────────────────────────────────────── */
.cv2-caption {
  font-size: 14px;
  color: #111b21;
  margin-top: 4px;
  white-space: pre-wrap;
}

/* ── FORWARDED ──────────────────────────────────────────────────────── */
.cv2-forwarded-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #8696a0;
  font-style: italic;
  margin-bottom: 4px;
}

/* ── INPUT DE MENSAGEM ──────────────────────────────────────────────── */
.cv2-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  background: #f0f2f5;
  border-top: 1px solid #e9edef;
  flex-shrink: 0;
}

.cv2-input-wrap {
  flex: 1;
  background: var(--chat-input-bg);
  border-radius: 24px;
  display: flex;
  align-items: flex-end;
  padding: 6px 14px;
  min-height: 40px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.cv2-textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-size: 14.5px;
  line-height: 1.5;
  max-height: 140px;
  overflow-y: auto;
  font-family: inherit;
  color: #111b21;
  padding: 2px 0;
  scrollbar-width: thin;
}
.cv2-textarea::placeholder { color: #8696a0; }
.cv2-textarea::-webkit-scrollbar { width: 3px; }

.cv2-input-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all .15s;
}
.cv2-emoji-btn { background: transparent; color: #8696a0; }
.cv2-emoji-btn:hover { color: #54656f; }
.cv2-attach-btn { background: transparent; color: #8696a0; }
.cv2-attach-btn:hover { color: #54656f; }
.cv2-send-btn { background: #00a884; color: #fff; }
.cv2-send-btn:hover { background: #028a6e; }
.cv2-send-btn:disabled { background: #8696a0; cursor: default; }
.cv2-mic-btn { background: transparent; color: #8696a0; }
.cv2-mic-btn:hover { color: #00a884; }

/* ── UI de gravação de áudio ── */
/* ── Barra de gravação (WhatsApp style) ── */
.cv2-rec-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 0 6px;
  animation: cv2FadeIn .15s ease;
}
.cv2-rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e53935;
  flex-shrink: 0;
  animation: cv2RecPulse 1s ease-in-out infinite;
}
@keyframes cv2RecPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .45; transform: scale(.75); }
}
.cv2-rec-timer {
  font-size: 14px;
  font-weight: 600;
  color: #111b21;
  min-width: 38px;
  font-variant-numeric: tabular-nums;
}
/* Ondas animadas durante gravação */
.cv2-rec-wave-anim {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  overflow: hidden;
}
.cv2-rec-wave-anim span {
  display: inline-block;
  width: 3px;
  border-radius: 2px;
  background: #00a884;
  animation: cv2WaveBar .8s ease-in-out infinite;
}
.cv2-rec-wave-anim span:nth-child(1)  { animation-delay: 0s;    height: 8px; }
.cv2-rec-wave-anim span:nth-child(2)  { animation-delay: .1s;   height: 16px; }
.cv2-rec-wave-anim span:nth-child(3)  { animation-delay: .2s;   height: 24px; }
.cv2-rec-wave-anim span:nth-child(4)  { animation-delay: .05s;  height: 20px; }
.cv2-rec-wave-anim span:nth-child(5)  { animation-delay: .15s;  height: 12px; }
.cv2-rec-wave-anim span:nth-child(6)  { animation-delay: .25s;  height: 28px; }
.cv2-rec-wave-anim span:nth-child(7)  { animation-delay: .1s;   height: 18px; }
.cv2-rec-wave-anim span:nth-child(8)  { animation-delay: .3s;   height: 10px; }
.cv2-rec-wave-anim span:nth-child(9)  { animation-delay: .2s;   height: 22px; }
.cv2-rec-wave-anim span:nth-child(10) { animation-delay: .05s;  height: 14px; }
@keyframes cv2WaveBar {
  0%, 100% { transform: scaleY(0.4); opacity: .6; }
  50%       { transform: scaleY(1);   opacity: 1; }
}
.cv2-rec-cancel {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #8696a0;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.cv2-rec-cancel:hover { background: #fde0e0; color: #e53935; }
.cv2-rec-send {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: #00a884;
  color: #fff;
  cursor: pointer;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,168,132,.35);
}
.cv2-rec-send:hover { background: #028a6e; }
/* legado (não usado mais, mantido para não quebrar nada) */
.cv2-rec-ui { display: none; }
.cv2-rec-label, .cv2-rec-actions { display: none; }

/* ── Wrapper relativo para posicionar o menu ── */
.cv2-attach-wrap {
  position: relative;
  flex-shrink: 0;
}

/* ── Menu flutuante de anexo ── */
.cv2-attach-menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  padding: 8px;
  min-width: 160px;
  z-index: 200;
  animation: cv2-menu-in .12s ease;
}
.cv2-attach-menu.open { display: flex; }

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

/* ── Cada opção do menu ── */
.cv2-attach-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: #111b21;
  text-align: left;
  transition: background .12s;
  width: 100%;
}
.cv2-attach-opt:hover { background: #f0f2f5; }

.cv2-attach-opt-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}

/* Reply preview acima do input */
.cv2-reply-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0f2f5;
  padding: 6px 16px 0;
  border-top: 1px solid #e9edef;
}
.cv2-reply-preview-bar .cv2-reply-block { flex: 1; margin: 0; }
.cv2-reply-cancel {
  border: none;
  background: none;
  font-size: 18px;
  color: #54656f;
  cursor: pointer;
  padding: 4px;
}

/* ── BOTÃO NOVAS MENSAGENS ──────────────────────────────────────────── */
.cv2-new-msg-btn {
  position: absolute;
  bottom: 70px;
  right: 20px;
  background: #00a884;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
  animation: cv2-slide-up .2s ease;
}
.cv2-new-msg-btn:hover { background: #028a6e; }
@keyframes cv2-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── LIGHTBOX ────────────────────────────────────────────────────────── */
.cv2-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  cursor: zoom-out;
}
.cv2-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
}
.cv2-lightbox-actions {
  display: flex;
  gap: 12px;
}
.cv2-lightbox-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background .15s;
}
.cv2-lightbox-btn:hover { background: rgba(255,255,255,.25); }
.cv2-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 20px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── BADGE DE CONEXÃO (ponto no header da sidebar) ───────────────────── */
.cv2-conn-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #f0f2f5;
  transition: background .3s;
}
.cv2-conn-on   { background: #25d366; }
.cv2-conn-off  { background: #e53935; }
.cv2-conn-warn { background: #f57c00; animation: cv2-pulse 1.2s infinite; }
@keyframes cv2-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* ── BANNER DE STATUS DO BACKEND ─────────────────────────────────────── */
.cv2-banner {
  padding: 8px 14px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid transparent;
  flex-shrink: 0;
}
.cv2-banner i { flex-shrink: 0; }
.cv2-banner-error {
  background: #fdecea;
  color: #b71c1c;
  border-bottom-color: #ef9a9a;
}
.cv2-banner-warn {
  background: #fff8e1;
  color: #e65100;
  border-bottom-color: #ffe082;
}
.cv2-banner-ok {
  background: #e8f5e9;
  color: #1b5e20;
  border-bottom-color: #a5d6a7;
}

/* ── ERRO DE ENVIO (inline) ──────────────────────────────────────────── */
.cv2-send-error {
  margin: 0 12px 6px;
  padding: 8px 12px;
  background: #fdecea;
  color: #b71c1c;
  font-size: 12.5px;
  border-radius: 8px;
  border-left: 3px solid #e53935;
  animation: cv2-msg-in .2s ease;
}

/* ── LABEL "EDITADA" ─────────────────────────────────────────────────── */
.cv2-edited {
  font-size: 10.5px;
  color: #8696a0;
  font-style: italic;
  margin-right: 3px;
}

/* ── TICKS — MÁQUINA DE ESTADOS VISUAL ──────────────────────────────── */
/* pendente / enviando: ⏳ cinza */
.cv2-msg-ticks.pending  { color: #aaa; font-size: 12px; }
/* enviada: ✓ cinza */
.cv2-msg-ticks.sent     { color: #8696a0; }
/* entregue: ✓✓ cinza */
.cv2-msg-ticks.delivered{ color: #8696a0; }
/* lida: ✓✓ azul (via var já existente) */
.cv2-msg-ticks.read     { color: var(--chat-tick-read, #53bdeb); }
/* falha: ❌ vermelho */
.cv2-msg-ticks.error    { color: #e53935; font-size: 13px; }
/* timeout > 15s: ⚠ amarelo */
.cv2-msg-ticks.timeout  {
  color: #f59e0b;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.cv2-tick-warn {
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  color: #f59e0b;
  letter-spacing: 0.2px;
}

/* ── LOADER DA ÁREA DE MENSAGENS ─────────────────────────────────────── */
.cv2-msgs-load {
  padding: 40px;
  text-align: center;
  color: #8696a0;
  font-size: 13px;
}

/* ── STATUS CONEXÃO ──────────────────────────────────────────────────── */
.cv2-conn-status {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  z-index: 100;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.cv2-conn-status.visible { opacity: 1; }
.cv2-conn-status.reconnecting { background: #e67e22; }
.cv2-conn-status.connected    { background: #27ae60; }

/* ── RESPONSIVIDADE ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cv2-sidebar { width: 100%; max-width: 100%; }
  .cv2-chat-panel { display: none; }
  .cv2-sidebar.conv-selected { display: none; }
  .cv2-chat-panel.conv-selected { display: flex; width: 100%; }
  .cv2-bubble { max-width: 85%; }
}

/* ── ANIMAÇÕES ──────────────────────────────────────────────────────── */
@keyframes cv2-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cv2-msg-row.animating { animation: cv2-msg-in .2s ease; }

/* Typing indicator */
.cv2-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bubble-in);
  border-radius: 8px;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.cv2-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8696a0;
  animation: cv2-bounce .8s infinite;
}
.cv2-typing-dot:nth-child(2) { animation-delay: .15s; }
.cv2-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes cv2-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* Spinner de carregamento */
.cv2-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #e9edef;
  border-top-color: #00a884;
  border-radius: 50%;
  animation: cv2-spin .7s linear infinite;
}
@keyframes cv2-spin { to { transform: rotate(360deg); } }
