/* ==========================================================================
   Chat da atendente — aparência de conversa no WhatsApp, tema claro
   --------------------------------------------------------------------------
   Tudo prefixado com .wac (WhatsApp-like chat) para não colidir com a página.
   As cores são as do WhatsApp no tema claro; só o avatar usa a paleta da
   clínica, para a janela parecer da Aurora e não de outra empresa.
   ========================================================================== */

.wac {
  --wac-verde: #008069;        /* cabeçalho */
  --wac-verde-claro: #00A884;  /* botão de enviar */
  --wac-lancador: #25D366;     /* botão flutuante */
  --wac-fundo: #EFEAE2;        /* papel de parede */
  --wac-recebida: #FFFFFF;
  --wac-enviada: #D9FDD3;
  --wac-texto: #111B21;
  --wac-meta: #667781;
  --wac-lido: #53BDEB;
  --wac-barra: #F0F2F5;
  --wac-aviso: #FFEECD;
  --wac-aviso-texto: #54656F;
  --wac-sombra: 0 1px .5px rgba(11, 20, 26, .13);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--wac-texto);
}

/* ---------- Botão flutuante ---------- */
.wac-lancador {
  position: fixed; right: 22px; bottom: 22px; z-index: 9000;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--wac-lancador); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px -4px rgba(0, 0, 0, .35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.wac-lancador:hover { transform: scale(1.06); box-shadow: 0 10px 24px -6px rgba(0, 0, 0, .4); }
.wac-lancador:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--wac-verde); }
.wac-lancador svg { width: 32px; height: 32px; }
.wac-lancador .wac-badge {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: #FF3B30; color: #fff; font-size: 12px; font-weight: 700;
  display: none; align-items: center; justify-content: center; border: 2px solid #fff;
}
.wac-lancador.tem-badge .wac-badge { display: flex; }

/* Balão de convite ao lado do botão */
.wac-convite {
  position: fixed; right: 94px; bottom: 30px; z-index: 9000; max-width: 240px;
  background: #fff; color: var(--wac-texto); border-radius: 10px 10px 2px 10px;
  padding: 10px 30px 10px 12px; font-size: 14px; line-height: 1.4;
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, .3); cursor: pointer;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.wac-convite.visivel { opacity: 1; transform: none; pointer-events: auto; }
.wac-convite strong { display: block; font-size: 13px; color: var(--wac-verde); margin-bottom: 2px; }
.wac-convite button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: 0; background: none;
  color: var(--wac-meta); cursor: pointer; font-size: 16px; line-height: 1; border-radius: 50%;
}
.wac-convite button:hover { background: var(--wac-barra); }

/* ---------- Janela ---------- */
.wac-janela {
  position: fixed; right: 22px; bottom: 96px; z-index: 9001;
  width: 380px; height: min(640px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 14px; background: var(--wac-fundo);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(16px) scale(.98); transform-origin: bottom right;
  pointer-events: none; visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.wac.aberto .wac-janela {
  opacity: 1; transform: none; pointer-events: auto; visibility: visible;
  transition: opacity .22s ease, transform .22s ease;
}

/* Cabeçalho */
.wac-topo {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px;
  background: var(--wac-verde); color: #fff; flex-shrink: 0;
}
.wac-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg, #E3DCD2, #D4B5A5);
  display: flex; align-items: center; justify-content: center;
  color: #38322D; font-weight: 600; font-size: 17px;
}
.wac-avatar img { width: 100%; height: 100%; object-fit: contain; padding: 5px; box-sizing: border-box; }
.wac-quem { flex: 1; min-width: 0; line-height: 1.25; }
.wac-nome { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wac-estado { font-size: 13px; opacity: .85; }
.wac-fechar {
  width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.wac-fechar:hover { background: rgba(255, 255, 255, .12); }
.wac-fechar:focus-visible { outline: 2px solid #fff; }
.wac-fechar svg { width: 22px; height: 22px; }

/* Conversa: papel de parede com rabiscos discretos, como o do WhatsApp */
.wac-conversa {
  flex: 1; overflow-y: auto; padding: 10px 14px 6px; overscroll-behavior: contain;
  background-color: var(--wac-fundo);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23D9D2C5' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' opacity='.7'%3E%3Cpath d='M14 18c4-6 12-6 16 0s12 6 16 0'/%3E%3Ccircle cx='86' cy='20' r='7'/%3E%3Cpath d='M20 70l8-8 8 8-8 8z'/%3E%3Cpath d='M70 64c0-6 10-6 10 0 0 7-10 12-10 12s-10-5-10-12c0-6 10-6 10 0'/%3E%3Cpath d='M98 92l6 10h-12z'/%3E%3Cpath d='M30 104h14M37 97v14'/%3E%3Ccircle cx='58' cy='104' r='3'/%3E%3C/g%3E%3C/svg%3E");
}
.wac-conversa::-webkit-scrollbar { width: 6px; }
.wac-conversa::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .18); border-radius: 3px; }

.wac-chip {
  display: table; margin: 8px auto 10px; padding: 5px 12px; border-radius: 8px;
  background: #fff; color: var(--wac-meta); font-size: 12.5px; box-shadow: var(--wac-sombra);
  text-transform: uppercase; letter-spacing: .02em;
}
.wac-aviso {
  margin: 4px auto 12px; max-width: 92%; padding: 7px 12px; border-radius: 8px;
  background: var(--wac-aviso); color: var(--wac-aviso-texto); font-size: 12.5px;
  line-height: 1.45; text-align: center; box-shadow: var(--wac-sombra);
}
.wac-aviso a { color: var(--wac-verde); }

/* Balões */
.wac-linha { display: flex; margin: 2px 0; }
.wac-linha.sua { justify-content: flex-end; }
.wac-linha.nova-voz { margin-top: 10px; }
.wac-balao {
  position: relative; max-width: 82%; padding: 6px 8px 8px 9px; border-radius: 8px;
  font-size: 14.2px; line-height: 1.42; box-shadow: var(--wac-sombra);
  word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap;
  animation: wac-entra .18s ease-out;
}
.wac-linha.dela .wac-balao { background: var(--wac-recebida); }
.wac-linha.sua .wac-balao { background: var(--wac-enviada); }
/* O "rabinho" só no primeiro balão de cada sequência */
.wac-linha.nova-voz.dela .wac-balao { border-top-left-radius: 0; }
.wac-linha.nova-voz.sua .wac-balao { border-top-right-radius: 0; }
.wac-linha.nova-voz.dela .wac-balao::before,
.wac-linha.nova-voz.sua .wac-balao::before {
  content: ''; position: absolute; top: 0; width: 8px; height: 13px;
}
.wac-linha.nova-voz.dela .wac-balao::before {
  left: -8px; background: var(--wac-recebida); clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.wac-linha.nova-voz.sua .wac-balao::before {
  right: -8px; background: var(--wac-enviada); clip-path: polygon(0 0, 100% 0, 0 100%);
}
.wac-autor { display: block; font-size: 12.5px; font-weight: 600; color: #C5A059; margin-bottom: 1px; white-space: normal; }
.wac-texto a { color: #027EB5; }
.wac-meta {
  float: right; margin: 6px 0 -4px 10px; font-size: 11px; color: var(--wac-meta);
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; line-height: 1;
}
.wac-meta svg { width: 16px; height: 11px; }
.wac-meta .wac-tique { color: var(--wac-meta); }
.wac-meta .wac-tique.lido { color: var(--wac-lido); }
.wac-balao.falhou { cursor: pointer; }
.wac-balao.falhou .wac-meta { color: #D93025; }

/* Digitando… */
.wac-digitando { display: inline-flex; gap: 4px; padding: 4px 2px 0; }
.wac-digitando i {
  width: 7px; height: 7px; border-radius: 50%; background: #9AA6AC;
  animation: wac-pulo 1.2s infinite ease-in-out;
}
.wac-digitando i:nth-child(2) { animation-delay: .15s; }
.wac-digitando i:nth-child(3) { animation-delay: .3s; }

/* Sugestões de primeira mensagem */
.wac-sugestoes { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 2px; justify-content: flex-end; }
.wac-sugestoes button {
  border: 1px solid #C9D3D8; background: #fff; color: var(--wac-verde); cursor: pointer;
  border-radius: 18px; padding: 6px 12px; font-size: 13px; font-family: inherit;
  box-shadow: var(--wac-sombra); transition: background .15s ease;
}
.wac-sugestoes button:hover { background: #F2FBF7; }

/* Barra de digitar */
.wac-barra {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; background: var(--wac-barra);
  flex-shrink: 0;
}
.wac-campo {
  flex: 1; min-height: 42px; max-height: 120px; resize: none; border: 0; outline: 0;
  border-radius: 21px; padding: 11px 16px; background: #fff; color: var(--wac-texto);
  font-family: inherit; font-size: 15px; line-height: 1.35; box-sizing: border-box;
}
.wac-campo::placeholder { color: var(--wac-meta); }
/* A página tem um anel de foco próprio; no campo do chat, o foco é o cursor, como no WhatsApp. */
.wac .wac-campo:focus, .wac .wac-campo:focus-visible { outline: none; box-shadow: none; }
.wac-enviar {
  width: 42px; height: 42px; border-radius: 50%; border: 0; flex-shrink: 0; cursor: pointer;
  background: var(--wac-verde-claro); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, opacity .15s ease;
}
.wac-enviar:disabled { opacity: .55; cursor: default; }
.wac-enviar:not(:disabled):hover { background: var(--wac-verde); }
.wac-enviar svg { width: 22px; height: 22px; margin-left: 2px; }

@keyframes wac-entra { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes wac-pulo { 0%, 60%, 100% { transform: translateY(0); opacity: .6; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ---------- Celular: tela cheia ---------- */
@media (max-width: 899px) {
  /* Acima da barra "Agendar minha avaliação" da página */
  .wac-lancador { bottom: 92px; right: 16px; width: 56px; height: 56px; }
  .wac-convite { bottom: 98px; right: 84px; }
}
@media (max-width: 520px) {
  .wac-janela {
    right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0;
    transform: translateY(24px);
  }
  .wac.aberto .wac-lancador, .wac.aberto .wac-convite { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wac-janela, .wac-convite, .wac-lancador, .wac-balao { transition: none; animation: none; }
  .wac-digitando i { animation: none; opacity: .8; }
}
