/* ── WhatsApp Chat Widget ─────────────────────────────────────────────── */

#wa-widget {
  position: fixed;
  bottom: 62px; /* 42px banner + 20px margem */
  right: 20px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Botão flutuante ──────────────────────────────────────────────────── */
.wa-float-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: rgb(37, 211, 102);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow: rgba(0, 0, 0, 0.25) 0px 4px 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}

.wa-float-btn:hover {
  transform: scale(1.05);
  box-shadow: rgba(0, 0, 0, 0.35) 0px 6px 20px;
}

.wa-float-btn svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* Bolinha vermelha de notificação */
.wa-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  background: rgb(255, 0, 0);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ── Popup ────────────────────────────────────────────────────────────── */
.wa-popup {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  transform-origin: bottom right;
  animation: waPopupIn 0.2s ease;
}

@keyframes waPopupIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.wa-window {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: rgba(0, 0, 0, 0.3) 0px 4px 30px;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.wa-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgb(0, 128, 105);
  padding: 20px;
  height: 93px;
  box-sizing: border-box;
}

.wa-avatar-wrap {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(#f2f2f2 0%, #f7f7f7 100%);
  overflow: hidden;
}

.wa-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.wa-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wa-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.wa-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #fff;
  line-height: 1;
}

.wa-online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #4eff91;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Botão fechar ─────────────────────────────────────────────────────── */
.wa-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
}

.wa-close:hover {
  opacity: 1;
}

.wa-close svg {
  width: 14px;
  height: 14px;
}

/* ── Chat body ────────────────────────────────────────────────────────── */
.wa-chat {
  background-image: url('wa-bg.jpg');
  background-size: cover;
  background-position: center;
  height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

.wa-msg-wrap {
  padding: 10px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* cresce junto com o conteúdo, empurrando o scroll para baixo */
  flex: 1;
  justify-content: flex-end;
}

.wa-time-label {
  font-size: 10px;
  color: rgb(17, 17, 17);
  text-align: center;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  padding: 2px 8px;
  align-self: center;
}

/* ── Typing dots (balão de carregamento) ──────────────────────────────── */
.wa-typing {
  display: flex;
  align-self: flex-start;
}

.wa-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 0px;
}

.wa-typing-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: rgb(17, 17, 17);
  border-radius: 50%;
  animation: waDot 1.2s infinite ease-in-out;
}

.wa-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.wa-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes waDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Balão do bot (esquerda, branco) ──────────────────────────────────── */
.wa-bubble {
  align-self: flex-start;
  background: rgb(255, 255, 255);
  border-radius: 0 16px 16px 16px;
  box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 0px;
  padding: 6px 14px;
  max-width: 85%;
}

.wa-bubble p {
  font-size: 15px;
  color: rgb(17, 17, 17);
  margin: 0;
  line-height: 1.5;
}

.wa-bubble p + p {
  margin-top: 4px;
}

/* ── Balão do usuário (direita, verde WhatsApp) ───────────────────────── */
.wa-bubble-user {
  align-self: flex-end;
  background: #dcf8c6;
  border-radius: 16px 0 16px 16px;
  box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 0px;
  padding: 6px 14px;
  max-width: 85%;
  font-size: 15px;
  color: rgb(17, 17, 17);
  line-height: 1.5;
  word-break: break-word;
}

/* ── Botões de escolha rápida ─────────────────────────────────────────── */
.wa-btn-group {
  display: flex;
  gap: 8px;
  align-self: stretch; /* ocupa a largura disponível */
}

.wa-option-btn {
  flex: 1;
  padding: 9px 12px;
  background: #fff;
  border: 1.5px solid rgb(0, 128, 105);
  border-radius: 20px;
  color: rgb(0, 128, 105);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  line-height: 1.2;
}

.wa-option-btn:hover {
  background: rgb(0, 128, 105);
  color: #fff;
}

/* ── Animação de entrada dos balões ───────────────────────────────────── */
.wa-bubble--in {
  animation: waBubbleIn 0.2s ease;
}

@keyframes waBubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Input area ───────────────────────────────────────────────────────── */
.wa-input-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border-top: 1px solid rgba(17, 17, 17, 0.1);
  height: 53px;
  padding: 12px 12px 12px 20px;
  box-sizing: border-box;
}

.wa-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: rgb(17, 17, 17);
  font-family: inherit;
}

.wa-input::placeholder {
  color: rgba(17, 17, 17, 0.3);
}

.wa-send-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: rgb(37, 211, 102);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}

.wa-send-btn:hover {
  background: rgb(25, 195, 88);
}

.wa-send-btn svg {
  width: 16px;
  height: 16px;
}


/* ── Responsivo ───────────────────────────────────────────────────────── */
@media (max-width: 420px) {
  .wa-popup {
    width: calc(100vw - 24px);
    right: -8px;
  }
}
