/* ============================================================
   CHA BARIATRICO - design system do typebot
   Padrao Truque da Cavala (minimalista tipo Typebot/Manychat).
   Paleta: grafite + CTA verde. Hex hardcoded, sem custom props.
   ============================================================ */

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

body {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 24px;
  color: #202020;
  background: #FFFAFA;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- progress bar ---------- */

.progress-bar-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgb(241, 241, 241);
  z-index: 10;
}

.progress-bar-fill {
  height: 100%;
  width: 0;
  background: #e0edff;
  transition: width 0.4s ease;
}

/* ---------- layout ---------- */

.chat-container {
  max-width: 800px;
  margin: 0 auto;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 20px 50vh 20px;
  scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

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

.chat-container::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
}

/* ---------- linha de mensagem do bot ---------- */

.bot-message {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 8px;
}

.bot-avatar,
.bot-avatar-placeholder {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.bot-avatar {
  border-radius: 50%;
  object-fit: cover;
}

.bot-bubbles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100% - 52px);
}

.bot-bubble {
  background: rgb(247, 248, 255);
  color: #202020;
  padding: 8px 16px;
  border-radius: 6px;
  width: fit-content;
  max-width: 100%;
  opacity: 0;
  animation: fadeInUp 0.3s ease forwards;
  overflow-wrap: break-word;
}

.bot-bubble img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
}

/* bubble que so tem imagem: sem padding, a imagem preenche */
.bot-bubble.bubble-img {
  padding: 0;
  background: transparent;
  max-width: 340px;
}

/* ---------- bubble da usuaria ---------- */

.guest-bubble {
  background: #303235;
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: 6px;
  max-width: 80%;
  width: fit-content;
  margin-left: auto;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeInUp 0.3s ease forwards;
  overflow-wrap: break-word;
}

/* ---------- typing dots ---------- */

.typing-bubble {
  background: rgb(247, 248, 255);
  padding: 8px 16px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
  animation: typingPulse 1.4s infinite;
}

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

/* ---------- botoes de opcao ---------- */

.choices-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 12px;
  padding-left: 52px;
  animation: fadeIn 0.3s ease forwards;
}

.choices-container.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

.choice-btn {
  background: #303235;
  color: #FFFFFF;
  padding: 12px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font: 16px/24px 'Inter', sans-serif;
  width: 100%;
  text-align: left;
  transition: opacity 0.2s ease;
  opacity: 0;
  animation: fadeInBtn 0.3s ease forwards;
  display: block;
  text-decoration: none;
}

.choice-btn:hover { opacity: 0.85; }
.choice-btn:active { opacity: 0.7; }

.choice-btn:focus-visible {
  outline: 2px solid #22c55e;
  outline-offset: 2px;
}

/* ---------- CTA de checkout ---------- */

.choice-btn.checkout-cta {
  background: #22c55e;
  color: #FFFFFF;
  font-weight: 600;
  text-align: center;
  animation: fadeInBtn 0.3s ease forwards, ctaPulse 2s ease-in-out infinite 0.4s;
}

.choice-btn.checkout-cta:hover { opacity: 0.9; }

/* ---------- input numerico ---------- */

.number-input-container {
  display: flex;
  gap: 8px;
  max-width: 300px;
  margin-top: 12px;
  margin-bottom: 12px;
  margin-left: 52px;
  animation: fadeIn 0.3s ease forwards;
}

.number-input-container input {
  flex: 1;
  background: #FFFFFF;
  color: #202020;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font: 16px/24px 'Inter', sans-serif;
  outline: none;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  min-width: 0;
}

.number-input-container input::placeholder { color: #9095A0; }

.number-input-container input:focus {
  box-shadow: 0 0 0 2px #303235;
}

.number-input-container button {
  background: #303235;
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  font: 16px/24px 'Inter', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.number-input-container button:hover { opacity: 0.85; }

/* ---------- animacoes ---------- */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

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

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  50%      { box-shadow: 0 0 0 12px rgba(34, 197, 94, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .choice-btn.checkout-cta { animation: fadeInBtn 0.3s ease forwards; }
  .typing-dot { animation-duration: 2.8s; }
  .chat-container { scroll-behavior: auto; }
}

/* ---------- mobile ---------- */

@media (max-width: 640px) {
  .chat-container         { padding: 12px 12px 50vh 12px; }
  .choices-container      { padding-left: 0; }
  .number-input-container { max-width: 100%; width: 100%; margin-left: 0; }
  .bot-bubbles            { max-width: calc(100% - 52px); }
  .bot-bubble.bubble-img  { max-width: 100%; }
}
