/* Reset de margens e altura total */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, sans-serif;
}

/* Fundo geral */
body {
  background-color: #f2f2f2;
}

.chat-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background-color: #fff;
}

/* =========================
   CABEÇALHO
==========================*/
.chat-header {
  flex: 0 0 auto;
  background-color: #1e60fa;
  color: #fff;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-left: 16px;
  padding-right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header.iphone-xr-up {
  padding-top: 0px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-left img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.chat-header h2 {
  font-size: 16px;
  margin: 0;
}
.header-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-buttons .btn {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
}
.header-buttons .btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* =========================
   ÁREA DO CHAT (rolável)
==========================*/
.chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px;
  background-color: #fafafa;
}

/* Mensagem inicial (sem foto, sem botões) */
.initial-bot-message {
  max-width: 80%;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  background-color: #1798fc;
  color: #fff;
}

/* -------------------------
   ESTRUTURA DAS MENSAGENS
--------------------------*/
.message-container {
  display: flex;
  margin-bottom: 10px;
}
/* Bot -> alinhado à esquerda */
.message-container.bot {
  align-self: flex-start;
}
/* Usuário -> alinhado à direita */
.message-container.user {
  align-self: flex-end;
  justify-content: flex-end;
}

/* Balão de mensagem */
.message-bubble {
  max-width: 80%;
  border-radius: 14px;
  padding: 8px 12px;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
}
/* Bot: balão azul, texto branco */
.bot .message-bubble {
  background-color: #1798fc;
  color: #fff;
}
/* Usuário: balão claro, texto escuro */
.user .message-bubble {
  background-color: #b4cafd;
  color: #333;
}
/* Hyperlinks dentro do balão com texto branco */
.message-bubble a {
  color: #fff;
}

/* =========================
   CONTEÚDO DO BOT:
   Cabeçalho (foto + nome + botões) + texto
==========================*/
.bot-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bot-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.bot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bot-name {
  font-weight: bold;
  font-size: 17px;
}
.reaction-buttons {
  display: flex;
  gap: 4px;
  padding-left: 20px;
  font-size: 1.2em;
  transform: scale(1.1);
}
.reaction-buttons button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}
.reaction-buttons button:hover {
  opacity: 0.8;
}
.icon-color {
  /* inherit color from parent (normally white in bot bubble)
     and enable a smooth transition when toggled */
  color: inherit;
  transition: color 160ms ease, transform 160ms ease;
}
.icon-color.active {
  /* visually highlight the active feedback icon */
  color: #111111; /* warm black for active state */
  transform: scale(1.15);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}
.bot-text {
  margin-top: 6px;
  white-space: pre-wrap; /* preserva espaços e quebras */
}

/* =========================
   ANIMAÇÃO DE "BOT DIGITANDO"
==========================*/
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #fff;
  border-radius: 50%;
  animation: blink 1s infinite alternate;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0% {
    opacity: 0.2;
  }
  100% {
    opacity: 1;
  }
}

/* =========================
   RODAPÉ (área de digitação)
==========================*/
.chat-footer {
  flex: 0 0 auto;
  border-top: 1px solid #ccc;
  padding: 8px;
  display: flex;
}
.auto-resize {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  margin-right: 8px;
  resize: none;
  padding: 8px;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
}
.chat-footer button {
  background-color: #1e60fa;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}
.chat-footer button:hover {
  background-color: #1e60fa;
}

/* Rodapé com marca d'água/créditos */
.footer-credits {
  text-align: center;
  color: #666;
  font-size: 8px;
  padding-bottom: 20px;
}
.footer-credits.iphone-xr-up {
  padding-bottom: 40px;
}

/* Responsividade extra */
@media (max-width: 480px) {
  .chat-header h2 {
    font-size: 16px;
  }
  .header-buttons .btn {
    font-size: 12px;
    padding: 4px 8px;
  }
  .auto-resize {
    font-size: 16px;
  }
  .chat-footer button {
    font-size: 14px;
    padding: 6px 10px;
  }
}
