*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --marrom: #6C3018;
  --marrom-dark: #4e2210;
  --ambar: #FDAA20;
  --ambar-light: #FFF0C0;
  --creme: #F5E6CF;
  --creme-bg: #EDE0CC;
  --branco: #ffffff;
  --verde-wa: #25D366;
  --verde-wa-dark: #1ebe5d;
  --sombra-msg: 0 1px 2px rgba(0, 0, 0, 0.12);
  --sombra-btn: 0 2px 8px rgba(108, 48, 24, 0.2);
  --radius-duda: 4px 18px 18px 18px;
  --radius-user: 18px 4px 18px 18px;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Poppins', sans-serif;
  background: #d4c5b0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Desktop: frame de celular ── */
.phone-frame {
  width: 100%;
  max-width: 440px;
  height: 100vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  border-radius: 20px;
  overflow: hidden;
}

@media (max-width: 440px) {
  .phone-frame {
    border-radius: 0;
    max-height: 100vh;
  }
}

/* ── Chat wrapper ── */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--creme-bg);
  background-image:
    radial-gradient(circle, rgba(253, 170, 32, 0.18) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
}

/* ── Header ── */
.chat-header {
  background: linear-gradient(135deg, var(--marrom) 0%, #8B3E1A 100%);
  padding: 12px 18px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-ring {
  position: relative;
  flex-shrink: 0;
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ambar) 0%, #f59f00 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: var(--verde-wa);
  border-radius: 50%;
  border: 2px solid var(--marrom);
}

.contact-info {
  flex: 1;
}

.contact-name {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--branco);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.contact-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  margin-top: 1px;
  transition: color 0.3s;
}

/* ── Chat area ── */
.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}

.chat-area::-webkit-scrollbar {
  width: 4px;
}

.chat-area::-webkit-scrollbar-track {
  background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
  background: rgba(108, 48, 24, 0.2);
  border-radius: 4px;
}

/* ── Mensagens ── */
.message {
  display: flex;
  max-width: 80%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.message.visible {
  opacity: 1;
  transform: translateY(0);
}

.duda-message {
  align-self: flex-start;
  margin-top: 6px;
}

.user-message {
  align-self: flex-end;
  margin-top: 6px;
}

.bubble {
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  color: #1a1a1a;
  box-shadow: var(--sombra-msg);
  word-break: break-word;
}

.duda-message .bubble {
  background: var(--branco);
  border-radius: var(--radius-duda);
}

.user-message .bubble {
  background: var(--ambar-light);
  border-radius: var(--radius-user);
  color: var(--marrom-dark);
}

.bubble strong {
  font-weight: 600;
  color: var(--marrom);
}

/* ── Digitando ── */
.typing-bubble {
  padding: 12px 16px;
  display: flex;
  align-items: center;
}

.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #aaa;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Botão de pergunta ── */
.question-btn-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.question-btn-wrapper.visible {
  opacity: 1;
  transform: translateY(0);
}

.question-btn {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--marrom);
  background: var(--branco);
  border: 2px solid var(--ambar);
  border-radius: 22px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: var(--sombra-btn);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  text-align: left;
  max-width: 100%;
  animation: pulse-border 2.5s ease-in-out infinite;
}

.question-btn:hover,
.question-btn:focus-visible {
  background: var(--ambar-light);
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(108, 48, 24, 0.28);
  animation: none;
  outline: none;
}

.question-btn:active {
  transform: scale(0.97);
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--ambar); box-shadow: var(--sombra-btn); }
  50% { border-color: var(--marrom); box-shadow: 0 2px 12px rgba(108, 48, 24, 0.32); }
}

/* ── Data/separador ── */
.date-chip {
  align-self: center;
  background: rgba(108, 48, 24, 0.1);
  color: var(--marrom);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 10px;
  margin: 8px 0 4px;
  letter-spacing: 0.03em;
}

/* ── CTA final (WhatsApp) ── */
.whatsapp-btn-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.whatsapp-btn-wrapper.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--branco);
  background: linear-gradient(135deg, var(--verde-wa) 0%, #20c05a 100%);
  border: none;
  border-radius: 28px;
  padding: 14px 28px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: glow-green 2s ease-in-out infinite;
}

.whatsapp-btn:hover,
.whatsapp-btn:focus-visible {
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 8px 28px rgba(37, 211, 102, 0.55);
  animation: none;
  outline: none;
}

.whatsapp-btn:active {
  transform: scale(0.97);
}

@keyframes glow-green {
  0%, 100% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.45); }
  50% { box-shadow: 0 4px 30px rgba(37, 211, 102, 0.7); }
}

/* ── Emoji grande na mensagem final ── */
.final-emoji {
  font-size: 32px;
  display: block;
  text-align: center;
  margin-bottom: 4px;
}

/* ── Input bar (coleta nome/telefone) ── */
.input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 14px;
  background: var(--creme);
  border-top: 1px solid rgba(108, 48, 24, 0.12);
  flex-shrink: 0;
  animation: slideUp 0.3s ease;
}

.input-bar[hidden] {
  display: none;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-input {
  flex: 1;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: var(--branco);
  border: 1.5px solid rgba(108, 48, 24, 0.2);
  border-radius: 22px;
  padding: 10px 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
  border-color: var(--ambar);
  box-shadow: 0 0 0 3px rgba(253, 170, 32, 0.18);
}

.chat-input::placeholder {
  color: #aaa;
}

.send-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--marrom);
  color: var(--branco);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(108, 48, 24, 0.35);
  transition: background 0.2s, transform 0.15s;
}

.send-btn:hover {
  background: var(--marrom-dark);
  transform: scale(1.08);
}

.send-btn:active {
  transform: scale(0.94);
}
