/* ======== VARIÁVEIS DO TEMA SOUL ======== */
:root {
  --primary-color: #1B4D3E; /* Verde Soul (Medicinal/Sério) */
  --accent-color: #D4AF37;  /* Dourado suave para destaques */
  --bg-color: #000000;      /* Cor de fundo de fallback */
  --user-msg-bg: #1B4D3E;   /* Balão do usuário (Verde escuro) */
  --user-text: #FFFFFF;
  --bot-msg-bg: #FFFFFF;    /* Balão do bot (Branco) */
  --bot-text: #333333;
  --input-bg: #FFFFFF;
  --font-main: 'Montserrat', sans-serif;
}

/* ======== GERAL (TRAVA DE TELA & FUNDO) ======== */
body {
  margin: 0;
  font-family: var(--font-main);
  background-color: var(--bg-color); /* Cor de fundo caso a imagem falhe */

  /* --- IMAGEM DE FUNDO PRINCIPAL --- */
  background-image: url('../imagens/fundo.jpg'); /* Caminho para sua imagem */
  background-size: cover;          /* Cobre toda a tela, sem distorcer */
  background-position: center center; /* Centraliza a imagem */
  background-repeat: no-repeat;    /* Não repete a imagem */
  background-attachment: fixed;    /* O fundo fica fixo ao rolar */

  /* --- ESTRUTURA FIXA (APP-LIKE) --- */
  display: flex;
  flex-direction: column;
  height: 100dvh; /* Altura exata da viewport dinâmica */
  overflow: hidden; /* Impede que a página inteira role */
  position: relative;
}

/* ======== EFEITO DE FUMAÇA ANIMADA (OVERLAY) ======== */
/* Cria uma camada sobre o fundo para a animação da fumaça */
body::before {
  content: '';
  position: fixed; /* Fica fixo na tela */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Permite clicar através da fumaça */
  z-index: 0; /* Fica atrás do chat (z-index: 50), mas sobre o fundo */
  opacity: 0.3; /* Ajuste a transparência da fumaça (0.1 a 0.5 é bom) */

  /* --- TEXTURA DA FUMAÇA --- */
  /* Você precisa fazer upload de uma imagem de fumaça transparente (PNG) */
  background-image: url('../imagens/fumaca2.png');
  background-size: cover;
  /* Animação lenta e contínua */
  animation: smoke-drift 30s linear infinite;
}

/* Define a animação de deriva da fumaça */
@keyframes smoke-drift {
  from {
    background-position: 0% 0%;
  }
  to {
    /* Move a textura para cima e ligeiramente para a direita */
    background-position: 20% -100%;
  }
}

/* ======== CABEÇALHO (FIXO) ======== */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);

  /* --- FIXAÇÃO --- */
  flex-shrink: 0; /* Impede que o cabeçalho encolha */
  position: relative;
  z-index: 100; /* Fica acima da fumaça e do chat */
}

header img {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-right: 12px;
  border: 2px solid #4caf50;  /*var(--accent-color);*/
  object-fit: cover;
}

header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  flex: 1;
  letter-spacing: 0.5px;
}

/* ======== BOTÃO INSTALAR APP ======== */
#installBtn {
  background-color: transparent;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  display: none;
}

#installBtn:hover {
  background-color: var(--accent-color);
  color: var(--primary-color);
}

/* ======== CHAT (ÁREA DE ROLAGEM) ======== */
#chat {
  /* --- ESTRUTURA DE ROLAGEM --- */
  flex: 1; /* Ocupa todo o espaço disponível */
  overflow-y: auto; /* Apenas esta área rola */
  padding: 20px;
  display: flex;
  flex-direction: column;

  /* --- FUNDO E VISUAL --- */
  background-color: transparent; /* Transparente para ver o fundo e a fumaça */
  position: relative;
  z-index: 50; /* Acima da fumaça (z-index: 0), abaixo do header (z-index: 100) */

  opacity: 1;
  gap: 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* Rolagem suave no iOS */
}

.mensagem {
  max-width: 80%;
  padding: 12px 16px;
  margin: 0;
  border-radius: 18px;
  word-wrap: break-word;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  position: relative;
}

.usuario {
  align-self: flex-end;
  background-color: var(--user-msg-bg);
  color: var(--user-text);
  border-bottom-right-radius: 4px;
}

.bot {
  align-self: flex-start;
  background-color: var(--bot-msg-bg);
  color: var(--bot-text);
  border-bottom-left-radius: 4px;
  border: 1px solid #e0e0e0;
}

/* Links dentro das mensagens */
.mensagem a {
  color: inherit;
  font-weight: bold;
  text-decoration: underline;
}

/* ======== INPUT AREA (FIXO) ======== */
#input-area {
  display: flex;
  padding: 15px;
  background-color: var(--primary-color);
  align-items: center;
  gap: 10px;
  border-top: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);

  /* --- FIXAÇÃO --- */
  flex-shrink: 0; /* Impede que a barra de input suma */
  position: relative;
  z-index: 100; /* Fica acima da fumaça e do chat */
}

#mensagem {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid #ddd;
  border-radius: 25px;
  font-size: 16px;
  background-color: var(--input-bg);
  outline: none;
  font-family: var(--font-main);
  transition: border 0.3s;
}

#mensagem:focus {
  border-color: var(--primary-color);
}

#enviar {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(27, 77, 62, 0.3);
  transition: transform 0.2s;
}

#enviar:active {
  transform: scale(0.95);
}

/* ======== BOTÕES RÁPIDOS ======== */
.quick-reply {
  background-color: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 8px 16px;
  border-radius: 20px;
  margin: 5px 4px 5px 0;
  display: inline-block;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}

.quick-reply:hover {
  background-color: var(--primary-color);
  color: white;
}

/* ======== BOTÃO ÁUDIO ======== */
#audioBtn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s;
}

#audioBtn.gravando {
    background-color: #ff4444;
    animation: pulse 1.5s infinite;
}

#audioBtn img {
  width: 22px;
  height: 22px;
  opacity: 0.7;
}

#sendAudioBtn {
  display: none;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  padding: 0;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Animação Pulse do Áudio */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ======== ANIMAÇÃO DE FOLHAS (DESATIVADA) ======== */
/* O código abaixo está comentado e não será executado pelo navegador. */
/*
.folhas-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.folha {
  position: absolute;
  top: -10%;
  background-image: url('../imagens/folha.png');
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.6;
}

.f1 { left: 10%; width: 30px; height: 30px; animation: cair 12s linear infinite, balanco 4s ease-in-out infinite alternate; animation-delay: 0s; }
.f2 { left: 30%; width: 20px; height: 20px; animation: cair 18s linear infinite, balanco 6s ease-in-out infinite alternate; animation-delay: 4s; }
.f3 { left: 50%; width: 40px; height: 40px; animation: cair 10s linear infinite, balanco 5s ease-in-out infinite alternate; animation-delay: 2s; }
.f4 { left: 70%; width: 25px; height: 25px; animation: cair 15s linear infinite, balanco 3s ease-in-out infinite alternate; animation-delay: 7s; }
.f5 { left: 90%; width: 35px; height: 35px; animation: cair 13s linear infinite, balanco 4s ease-in-out infinite alternate; animation-delay: 1s; }
.f6 { left: 15%; width: 15px; height: 15px; animation: cair 20s linear infinite, balanco 5s ease-in-out infinite alternate; animation-delay: 9s; }
.f7 { left: 60%; width: 50px; height: 50px; animation: cair 14s linear infinite, balanco 7s ease-in-out infinite alternate; animation-delay: 3s; }

@keyframes cair {
  0% { top: -10%; opacity: 0; }
  20% { opacity: 0.5; }
  90% { opacity: 0.5; }
  100% { top: 110%; opacity: 0; transform: rotate(360deg); }
}

@keyframes balanco {
  0% { margin-left: -20px; transform: rotate(-10deg); }
  100% { margin-left: 20px; transform: rotate(10deg); }
}
*/