body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  height: 100vh;
  /* Previne scroll bounce em iOS */
  position: fixed;
  width: 100%;
}
.input-group {
  display: flex;
  align-items: stretch;
  margin-bottom: 15px;
  height: 40px; /* Define uma altura fixa para o grupo */
}

.country-container {
  position: relative;
  width: 120px;
  height: 100%; /* Faz o container ocupar toda a altura do grupo */
}

.country-search {
  width: 100%;
  height: 100%; /* Faz o input ocupar toda a altura do container */
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px 0 0 4px;
  border-right: none;
  box-sizing: border-box;
}

#phone-number, #name {
  flex: 1;
  height: 100%; /* Faz o input do telefone ocupar toda a altura do grupo */
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 0 4px 4px 0;
  box-sizing: border-box;
}

#country-list {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  border: 1px solid #ddd;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: none;
}

.country-item {
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.country-item:hover {
  background-color: #f0f0f0;
}

.flag {
  font-size: 1.5em;
}

.country-container::after {
  content: '▼';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 12px;
  color: #666;
}


#welcome-container {
  font-family: Arial, sans-serif;
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
  line-height: 1.6;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  #welcome-container {
    max-width: 90%;
    margin: 20px auto;
    padding: 16px;
    font-size: 16px;
  }
}

/* Estilos para autenticação */
#auth-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 400px;
  text-align: center;
  z-index: 1001;
}

#auth-container h2 {
  margin-bottom: 20px;
  color: #333;
}

#code-form {
display: none;
}
#phone-form, #code-form {
  margin-bottom: 20px;
}

#phone-number, #verification-code, #name {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  box-sizing: border-box;
}

#send-code-button, #verify-code-button {
  background-color: #000000;
  color: white;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s;
  width: 100%;
}

#send-code-button:hover, #verify-code-button:hover {
  background-color: #e21414;
}

#auth-error {
  color: #e21414;
  margin-top: 10px;
  font-size: 14px;
}

#chat-widget {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  display: block;
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

.content-container {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

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

/* Novas animações para as mensagens */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Animação dos pontos de digitação */
@keyframes typingDots {
  0%, 20% {
    content: ".";
  }
  40%, 60% {
    content: "..";
  }
  80%, 100% {
    content: "...";
  }
}

#chat-header {
  background-color: #000000;
  color: white;
  padding: 10px 20px;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  border-radius: 10px 10px 0 0;
}

#chat-icon-header {
  width: 32px;
  height: 32px;
  margin-right: 10px;
}

#header-left {
  display: flex;
  align-items: center;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#language-selector {
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  border: none;
  background-color: #ffffff;
  color: #000000;
}

#close-button {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
  border-radius: 4px;
}

#close-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  z-index: 10;
}

#chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: #f8f9fa;
  -webkit-overflow-scrolling: touch;
}

.message {
  margin-bottom: 16px;
  padding: 16px 20px;
  border-radius: 16px;
  max-width: 80%;
  font-size: 16px;
  line-height: 1.5;
  opacity: 0;
  animation: scaleIn 0.3s ease forwards;
  transform-origin: center;
  will-change: transform, opacity;
  position: relative;
  letter-spacing: 0.2px;
}

.user-message {
  background: linear-gradient(135deg, #7FB685, #4A7856);
  color: white;
  align-self: flex-end;
  margin-left: auto;
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-shadow: 0 8px 24px rgba(74, 120, 86, 0.15),
              0 4px 12px rgba(74, 120, 86, 0.1),
              inset 0 2px 4px rgba(255, 255, 255, 0.1);
  border-bottom-right-radius: 4px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.user-message:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 12px 28px rgba(74, 120, 86, 0.2),
              0 6px 16px rgba(74, 120, 86, 0.15),
              inset 0 2px 4px rgba(255, 255, 255, 0.15);
  background: linear-gradient(135deg, #8FC497, #558B63);
}


.assistant-message {
  background: linear-gradient(145deg, #ffffff, #f0f4ff);
  color: #2c3e50;
  align-self: flex-start;
  animation: slideInLeft 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  border-bottom-left-radius: 4px;
  transition: all 0.3s ease;
  border: 1px solid rgba(148, 163, 184, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.assistant-message:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  background: linear-gradient(145deg, #ffffff, #e8efff);
}



#user-input-container {
  display: flex;
  padding: 16px 20px;
  background-color: #fff;
  border-top: 1px solid #e0e0e0;
  align-items: center;
  min-height: 70px;
  cursor: text;
  position: relative;
  z-index: 2;
}

#user-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ccc;
  border-radius: 20px;
  font-size: 16px;
  margin-right: 12px;
  min-height: 20px;
  line-height: 20px;
  appearance: none;
  -webkit-appearance: none;
}

#send-btn, #ptt-btn {
  width: 54px;
  height: 54px;
  min-width: 54px;
  border: none;
  background-color: #000000;
  color: white;
  font-size: 18px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin-left: 8px;
}

#send-btn:hover {
  background-color: #e21414;
  transform: scale(1.05);
}

#send-btn svg, #ptt-btn svg {
  width: 24px;
  height: 24px;
  fill: white;
}

#ptt-btn.recording {
  background-color: #e21414;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(226, 20, 20, 0.4);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(226, 20, 20, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(226, 20, 20, 0);
  }
}

#toggle-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #000000;
  color: #fff;
  font-size: 30px;
  text-align: center;
  line-height: 60px;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.3s, background-color 0.3s;
  display: none;
}

#toggle-chat-widget:hover {
  transform: scale(1.1);
  background-color: #e21414;
}

.tooltip {
  visibility: hidden;
  position: absolute;
  bottom: 70px;
  right: 20px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 10px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 14px;
  white-space: nowrap;
}

#toggle-chat-widget:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

#typing-indicator {
  padding: 12px 20px;
  font-style: italic;
  color: #666;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  margin-left: 20px;
}

#typing-indicator::after {
  content: "";
  animation: typingDots 1.5s infinite;
  margin-left: 4px;
}

#typing-indicator.visible {
  opacity: 1;
}

/* Estilos para o markdown renderizado */
.message pre {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.user-message pre {
  background-color: rgba(255, 255, 255, 0.1);
}

.message code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
}

.user-message code {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.message p {
  margin: 0 0 8px 0;
}

.message ul,
.message ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message li {
  margin-bottom: 4px;
}

@media (max-width: 1240px) {
  .content-container {
    margin: 0 20px;
  }
}

@media (max-width: 768px) {
  .content-container {
    margin: 0;
    padding: 0;
  }

  #chat-header {
    border-radius: 0;
  }

  #chat-container {
    border-radius: 0;
  }

  #chat-messages {
    padding: 16px;
  }

  #user-input-container {
    padding: 12px 16px;
  }

  .message {
    font-size: 16px;
    max-width: 85%;
  }

  #auth-container {
    width: 85%;
    padding: 20px;
  }
}
