:root {
  --primary-color: #3498db;
  --secondary-color: #2980b9;
  --background-color: #f5f7fa;
  --text-color: #2c3e50;
  --border-color: #e2e8f0;
  --highlight-color: #2ecc71;
  --section-bg: #f1f5f9;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Container geral do widget: mantém o botão fixo */
.chat-widget {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 10000;
  }
  
  /* Botão flutuante com imagem de robô */
  .chat-button {
    width: 80px;
    height: 80px;
    background: url('../img/assistente.png') no-repeat center center;
    background-size: 60%;
    border: none;
    border-radius: 50%;
    /* box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); */
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  
  /* Efeito hover para chamar atenção */
  .chat-button:hover {
    transform: scale(1.2);
    
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
  }
  
  /* Janela do chat – inicialmente oculta */
  .chat-container {
    z-index: 10001;
    visibility: hidden; /* Será ativada via classe 'open' */
    opacity: 0; 
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex; /* Adicionado display flex */
    flex-direction: column;
    position: fixed;
    bottom: 100px; /* Posicionada acima do botão */
    right: 80px;
    width: 450px;
    height: 600px; /* Altura fixa para desktop */
    max-height: 80vh; /* Limite para não ultrapassar a tela */
    background: #ffffff;
    border: 1px solid #dfe6ee;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
  }
  
  /* Exibe a janela quando aberta */
  .chat-container.open {
    visibility: visible;
    opacity: 1;
    display: flex; /* Garante que o flex esteja ativo ao abrir */
  }

  .scroll-top {
    visibility: visible;
    opacity: 1;
    display: flex; /* Garante que o flex esteja ativo ao abrir */
  }

  .scroll-top.close {
    visibility: hidden;
  }

  /* Cabeçalho do chat com gradiente azul */
  .chat-header {
    background: linear-gradient(45deg, #007bff, #00aaff);
    color: #fff;
    padding: 15px;
    font-size: 1.2em;
    text-align: center;
    font-weight: 500;
    border-radius: 10px 10px 0 0;
    position: relative;
  }
  
  /* Botão de fechar na header */
  .chat-header .close-button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
  }

  .chat-header .close-button:hover {
    background: rgba(255,255,255,0.4);
  }

  /* Área de mensagens: scroll e fundo neutro */
  .chat-messages {
    flex: 1; /* Ocupa todo espaço disponível */
    overflow-y: auto; /* Scroll vertical */
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    -webkit-overflow-scrolling: touch; /* Melhora scroll em dispositivos iOS */
    scroll-behavior: smooth; /* Rolagem suave */
  }
  
  /* Estilização das mensagens */
  .message {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    max-width: 85%;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    animation: messageAppear 0.3s ease;
  }

  @keyframes messageAppear {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .message p, .message ul, .message h3, .message h4 {
      margin-bottom: 0.75rem;
  }

  .message p:last-child, .message ul:last-child {
      margin-bottom: 0;
  }

  .message h3 {
      color: var(--primary-color);
      font-size: 1.1rem;
      font-weight: 600;
      margin-top: 1rem;
  }

  .message h4 {
      color: var(--secondary-color);
      font-size: 1rem;
      font-weight: 600;
  }

  .message ul {
      padding-left: 1.5rem;
  }

  .message ul li {
      margin-bottom: 0.5rem;
  }

  .message .highlight {
      color: var(--highlight-color);
      font-weight: 600;
  }

  .message .section {
      background-color: var(--section-bg);
      padding: 0.75rem;
      border-radius: 0.5rem;
      margin: 0.5rem 0;
  }

  .message .contact-info {
      margin-top: 1rem;
      padding-top: 1rem;
      border-top: 1px solid var(--border-color);
      font-weight: 500;
  }
    
  /* Balão do Usuário */
  .user {
    align-self: flex-end;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: white;
    border-bottom-right-radius: 0.25rem;
    margin-left: auto;
  }

  /* Balão do Asisstente */
  .assistant {
    align-self: flex-start;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    border-bottom-left-radius: 0.25rem;
    margin-right: auto;
  }

  /* Área de input do chat */
  .chat-input {
    display: flex;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background-color: #f8fafc;
  }
  
  .chat-input input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 1.5rem;
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  }
  
  .chat-input input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
  }
  
  .chat-input button {
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 1.5rem;
    margin-left: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  
  .chat-input button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  }
  
  .chat-input button:active {
    transform: translateY(0);
  }

  /*Indicação de digitação*/
  .typing-indicator {
    display: flex;
    align-items: center;
    margin-left: 1rem;
    gap: 0.25rem;
  }

  .typing-indicator span {
      width: 0.5rem;
      height: 0.5rem;
      background-color: #ccc;
      border-radius: 50%;
      animation: typing 1s infinite ease-in-out;
  }

  .typing-indicator span:nth-child(1) {
      animation-delay: 0s;
  }

  .typing-indicator span:nth-child(2) {
      animation-delay: 0.2s;
  }

  .typing-indicator span:nth-child(3) {
      animation-delay: 0.4s;
  }

  @keyframes typing {
      0% {
          transform: translateY(0);
      }
      50% {
          transform: translateY(-5px);
      }
      100% {
          transform: translateY(0);
      }
  }


  /* Animação para entrada suave do chat */
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
  .chat-container {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    height: 70vh;
    border-radius: 15px;
  }
  
  .chat-button {
    width: 90px;
    height: 90px;
    font-size: 0px;
    right: 0px;
    bottom: 0px;
    background-size: 70%;

  }
  
  .message {
    max-width: 90%;
  }
}

/* Versão mais compacta para telas muito pequenas */
@media (max-width: 480px) {
  .chat-container {
    height: 80vh;
    bottom: 0;
    border-radius: 15px 15px 0 0;
  }
}