/*
 * Conversa do SDR dentro do widget de atendimento.
 *
 * Arquivo separado do chat-widget.css de propósito: o desenho base (launcher,
 * painel, cabeçalho, setores, bolhas, compositor) continua no arquivo original,
 * sem uma linha alterada. Aqui vivem só as classes da conversa: etiqueta do dia,
 * hora/tique dentro da bolha, indicador de "digitando…", opções dentro do campo
 * branco e a barra do compositor igual à do mensageiro da página /sdr.
 */

.re-chat__cta { display: grid; gap: 9px; margin-top: 18px; }

.re-chat__cta-note {
  margin: 0;
  color: var(--chat-muted);
  font-size: 12px;
  line-height: 1.5;
}

/* Etiqueta do dia ---------------------------------------------------------- */

.re-chat__day {
  align-self: center;
  margin: 0 auto 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--chat-surface-soft);
  color: var(--chat-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* Bolha: hora e tique dentro do balão -------------------------------------- */

.re-chat__bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  line-height: 1;
}

.re-chat__bubble-meta .re-chat__bubble-time {
  display: inline;
  margin: 0;
  font-size: 10px;
  line-height: 1;
  opacity: .72;
  text-align: right;
}

.re-chat__bubble.is-visitor .re-chat__bubble-meta .re-chat__bubble-time {
  color: var(--chat-on-brand);
  opacity: 1;
}

.re-chat__tick {
  color: var(--chat-on-brand);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -.06em;
  line-height: 1;
}

/* Lida pela equipe: mesmo azul do tique de leitura do mensageiro. */
.re-chat__tick.is-read { color: #53bdeb; }

.re-chat__bubble.is-agent .re-chat__tick { color: var(--chat-brand-strong); }

/* Avisos e confirmação: continuam bolha, com superfície própria.
   A classe base `.re-chat__bubble.is-agent` define borda e fundo; por isso o
   seletor aqui repete as duas classes para vencer a especificidade. */
.re-chat__bubble.is-agent.re-chat__bubble--notice {
  border-color: var(--chat-line-strong);
  background: var(--chat-surface-soft);
}

.re-chat__bubble--notice .re-chat__bubble-text { font-size: 13px; color: var(--chat-ink-soft); }

.re-chat__bubble.is-agent.re-chat__bubble--result {
  border-color: var(--chat-brand-strong);
  background: var(--chat-brand-soft);
}

.re-chat__result-title {
  display: block;
  margin-bottom: 4px;
  color: var(--chat-brand-strong);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* "digitando…": três pontinhos no histórico --------------------------------- */

.re-chat__typing {
  align-self: flex-start;
  max-width: 82%;
  padding: 12px 14px;
  border: 1px solid var(--chat-line);
  border-radius: 13px;
  border-bottom-left-radius: 4px;
  background: var(--chat-surface);
}

.re-chat__typing-dots { display: inline-flex; align-items: center; gap: 4px; }

.re-chat__typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chat-muted-soft);
  animation: re-chat-typing 1.1s ease-in-out infinite;
}

.re-chat__typing-dots span:nth-child(2) { animation-delay: .16s; }
.re-chat__typing-dots span:nth-child(3) { animation-delay: .32s; }

@keyframes re-chat-typing {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* Cabeçalho: "digitando…" enquanto o bot pensa ------------------------------ */

.re-chat__connection[data-state="typing"]::before {
  background: var(--chat-on-brand);
  animation: re-chat-presence-pulse 1.4s ease-out infinite;
}

/* Compositor: barra com emoji, campo branco e clipe ------------------------- */

.re-chat__composer--chat {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 6px;
  padding: 9px 10px 7px;
}

.re-chat__bar-icon {
  width: 30px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--chat-muted);
  display: grid;
  place-items: center;
}

.re-chat__bar-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.re-chat__attach { cursor: default; }

/* O campo branco é um só: dentro dele ficam as opções ou o texto. */
.re-chat__field {
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--chat-line);
  border-radius: 14px;
  background: var(--chat-surface-soft);
  display: grid;
  gap: 6px;
}

.re-chat__field:focus-within {
  border-color: var(--chat-brand-strong);
  box-shadow: 0 0 0 3px var(--chat-accent-ring-soft);
}

.re-chat__field.is-choices {
  padding: 6px;
  background: var(--chat-surface);
}

.re-chat__chat-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--chat-ink);
  line-height: 1.4;
}

.re-chat__chat-input::placeholder { color: var(--chat-muted); }

.re-chat__chat-input:focus-visible { outline-offset: 0; }

.re-chat__chat-input[aria-invalid="true"] {
  box-shadow: 0 0 0 3px var(--chat-danger-ring);
}

/* Opções dentro do campo --------------------------------------------------- */

.re-chat__choices {
  display: grid;
  gap: 6px;
  max-height: 214px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--chat-scrollbar) transparent;
}

/* Ação da escolha múltipla: fora da lista que rola, sempre à vista. */
.re-chat__choice-actions { display: grid; gap: 6px; }

.re-chat__chip {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--chat-line);
  border-radius: 10px;
  background: var(--chat-surface);
  display: grid;
  gap: 2px;
  color: var(--chat-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.re-chat__chip:hover {
  border-color: var(--chat-brand-strong);
  background: var(--chat-surface-hover);
}

.re-chat__chip.is-selected {
  border-color: var(--chat-brand-strong);
  background: var(--chat-brand-soft);
  box-shadow: inset 0 0 0 1px var(--chat-brand-strong);
}

.re-chat__chip[aria-invalid="true"] {
  border-color: var(--chat-danger);
  box-shadow: 0 0 0 3px var(--chat-danger-ring);
}

.re-chat__chip-label {
  color: var(--chat-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.re-chat__chip-hint { color: var(--chat-muted); font-size: 11px; line-height: 1.35; }

.re-chat__chip--confirm {
  width: 100%;
  justify-items: center;
  border-color: var(--chat-brand);
  background: var(--chat-brand);
  color: var(--chat-on-brand);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.re-chat__chip--confirm:hover:not(:disabled) { background: var(--chat-accent-light); }

.re-chat__chip--confirm:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.re-chat__hint {
  margin: 0;
  padding: 2px 14px 8px;
  color: var(--chat-muted);
  font-size: 11px;
  line-height: 1.4;
}

/* Responsivo -------------------------------------------------------------- */

@media (max-width: 520px) {
  /* Em tela pequena o histórico precisa de espaço: as opções rolam dentro do
     campo em vez de empurrar a conversa para fora. */
  .re-chat__choices { max-height: min(188px, 34vh); }
  .re-chat__hint { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .re-chat__typing-dots span { animation: none; opacity: .7; }
}

@media (forced-colors: active) {
  .re-chat__chip,
  .re-chat__field,
  .re-chat__bubble--result { border: 1px solid ButtonText; }
}
