/* Chat do encontro — lista de conversas + sala (ativo/encerrado) */

.chat-shell {
  display: flex;
  height: 100vh;
  /* Transparente de propósito: deixa passar o creme + orbs da .app-shell. */
  background: transparent;
}

/* ── Lista de conversas ── */
.chat-list {
  width: 340px;
  flex-shrink: 0;
  /* Janela para a camada animada única (.app-shell::before) — igual à sidebar. */
  background: rgba(255, 255, 255, 0.32);
  -webkit-backdrop-filter: saturate(1.8);
  backdrop-filter: saturate(1.8);
  border-right: 1px solid rgba(221, 177, 247, 0.30);
  display: flex;
  flex-direction: column;
}
.chat-list-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 14px;
}
.chat-convs { flex: 1; overflow-y: auto; padding: 0 10px 10px; }

.chat-conv {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 14px;
  border: none;
  background: none;
  cursor: pointer;
  transition: background .15s;
  margin-bottom: 2px;
  font-family: var(--font-body);
}
.chat-conv:hover { background: rgba(255, 255, 255, 0.7); }
.chat-conv.sel { background: var(--color-orange-light); }
.chat-conv-cover { width: 50px; height: 50px; border-radius: 16px; }
.chat-conv-dot {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2.5px solid #fff;
}
.chat-conv-name {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--color-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-conv-time { font-size: 11px; color: var(--color-text-muted); flex-shrink: 0; }
.chat-conv-preview {
  flex: 1;
  min-width: 0;
  font-size: 13px; color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-badge {
  flex-shrink: 0;
  background: var(--color-orange);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ── Sala ── */
.chat-room {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* Transparente: os orbs/creme da .app-shell aparecem atrás das mensagens. */
  background: transparent;
}
.chat-vazio {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}

.chat-room-head {
  /* Janela para a camada animada (nada rola por baixo daqui — as mensagens têm scroll próprio). */
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: saturate(1.8);
  backdrop-filter: saturate(1.8);
  border-bottom: 1px solid rgba(221, 177, 247, 0.28);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 13px;
}
.chat-room-cover { width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; }
.chat-back { display: none; }

.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}
.chat-msgs::-webkit-scrollbar { width: 6px; }
.chat-msgs::-webkit-scrollbar-thumb { background: rgba(132, 153, 183, 0.3); border-radius: 50px; }

.chat-sep {
  align-self: center;
  background: rgba(132, 153, 183, 0.15);
  color: var(--color-text-muted);
  border-radius: 50px;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 500;
  margin: 4px 0;
}

.chat-bubble-wrap { display: flex; max-width: 74%; gap: 8px; align-items: flex-end; }
.chat-bubble-wrap.enviada { align-self: flex-end; }
.chat-bubble-wrap.recebida { align-self: flex-start; gap: 9px; }

/* Botão de responder (aparece no hover; sempre visível no mobile) */
.chat-reply-btn {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
  align-self: center;
}
.chat-bubble-wrap:hover .chat-reply-btn { opacity: 1; }
.chat-reply-btn:hover { background: var(--color-cream); }

/* Citação dentro da bolha */
.chat-quote {
  border-left: 3px solid;
  border-radius: 6px;
  padding: 5px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-quote.recv { background: var(--color-lavender-light); border-color: var(--color-lavender); }
.chat-quote.recv .chat-quote-autor { color: #9b59d6; font-weight: 600; }
.chat-quote.recv .chat-quote-trecho { color: var(--color-text-secondary); }
.chat-quote.sent { background: rgba(255, 255, 255, 0.22); border-color: rgba(255, 255, 255, 0.75); }
.chat-quote.sent .chat-quote-autor { color: #fff; font-weight: 600; }
.chat-quote.sent .chat-quote-trecho { color: rgba(255, 255, 255, 0.9); }
.chat-quote-trecho { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

.chat-bubble-name { font-size: 11px; color: var(--color-text-muted); margin: 0 0 3px 4px; }
.chat-bubble-recv {
  background: #fff;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--color-text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.chat-bubble-sent {
  background: var(--color-orange);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  font-size: 14px;
  color: #fff;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.chat-bubble-time { font-size: 10px; color: var(--color-disabled-text); margin: 3px 0 0 4px; }

/* ── Input ── */
.chat-compose {
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.chat-reply-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px 0;
}
.chat-reply-preview-autor {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-orange);
}
.chat-reply-preview-trecho {
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-reply-cancel {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--color-cream);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chat-reply-cancel:hover { background: var(--color-disabled-bg); }

.chat-input-bar {
  padding: 13px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-input {
  flex: 1;
  background: var(--color-cream);
  border: 1.5px solid transparent;
  border-radius: 50px;
  padding: 12px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-text);
  outline: none;
}
.chat-input:focus { border-color: var(--color-orange); }
.chat-send {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--color-orange);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(255, 110, 31, 0.35);
  transition: opacity .15s;
}
.chat-send:hover { opacity: .92; }
.chat-send:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.chat-closed {
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
.chat-closed span { font-size: 13.5px; color: var(--color-text-muted); }

/* ── Mobile: alterna lista/sala ── */
@media (max-width: 820px) {
  .chat-list { width: 100%; }
  .chat-back { display: flex; }

  /* Lista: fica acima da bottom nav. Sala aberta: tela cheia (a nav some via body.sala-aberta). */
  .chat-shell { height: calc(100vh - var(--app-nav-h)); }
  .chat-shell.com-sala { height: 100vh; }

  /* Sem encontro selecionado: mostra só a lista. Com encontro: mostra só a sala. */
  .chat-shell:not(.com-sala) .chat-room { display: none; }
  .chat-shell.com-sala .chat-list { display: none; }
  .chat-shell.com-sala .chat-room { width: 100%; }

  /* Sem hover no toque: botão de responder sempre visível (discreto). */
  .chat-reply-btn { opacity: .55; }
}
