/* Sales Prime Chatbot – Estilo em tons de azul com Sistema de Feedback */

/* Container principal */
.sp-chatbot-container {
  position: fixed;
  bottom: 0;
  right: 20px;
  width: 350px;
  height: 500px;
  background: #f7f9fc; /* fundo suave, quase branco com matiz azulosa */
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sp-chatbot-container.sp-open {
  transform: translateY(0);
  bottom: 90px;
}

/* Cabeçalho */
.sp-chatbot-header {
  background-image: linear-gradient(90deg, #1670f2 0, #6603f2 100%);
  color: #ffffff;
  padding: 15px;
  text-align: center;
  position: relative;
}

.sp-chatbot-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
}

.sp-chatbot-header .sp-subtitle {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 4px;
}

.sp-close-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sp-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Área das mensagens */
.sp-chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #e8edf4; /* azul muito suave no fundo das mensagens */
}

.sp-message {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.sp-message.sp-bot {
  align-items: flex-start;
}

.sp-message.sp-user {
  align-items: flex-end;
}

.sp-message-content {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 14px;
}

.sp-message.sp-bot .sp-message-content {
  background: #ffffff;
  color: #001f3f;
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

.sp-message.sp-user .sp-message-content {
  background: #0074d9; /* azul mais vibrante para contraste */
  color: #ffffff;
  border-bottom-right-radius: 5px;
}

/* Sistema de Feedback */
.sp-feedback-container {
  margin-top: 8px;
  max-width: 80%;
}

.sp-feedback-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f0f4f8;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #e1e8ed;
  font-size: 12px;
  color: #5a6c7d;
}

/* Adicionar ao final do arquivo CSS */
.sp-support-message {
    animation: sp-fade-in 0.3s ease;
}

@keyframes sp-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sp-feedback-question span {
  margin-right: 10px;
}

.sp-feedback-buttons {
  display: flex;
  gap: 5px;
}

.sp-feedback-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sp-like-btn:hover {
  background: #e8f5e8;
  transform: scale(1.1);
}

.sp-dislike-btn:hover {
  background: #ffeaea;
  transform: scale(1.1);
}

.sp-feedback-thanks {
  background: #e8f5e8;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  text-align: center;
  border: 1px solid #c3e6c3;
}

/* Mensagem de Suporte */
.sp-support-message {
  background: #fff3cd;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #ffeaa7;
  margin-top: 5px;
}

.sp-support-message p {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: #856404;
  line-height: 1.4;
}

.sp-whatsapp-support-btn {
  background: #25d366 !important;
  color: #ffffff !important;
  border: none;
  padding: 8px 12px;
  border-radius: 15px;
  font-size: 12px;
  text-decoration: none !important;
  display: inline-block;
  transition: all 0.3s ease;
  font-weight: 500;
}

.sp-whatsapp-support-btn:hover {
  background: #128c7e !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

/* Campo de entrada */
.sp-chat-input-container {
  padding: 15px;
  background: #ffffff;
  border-top: 1px solid #ccd6e0;
}

.sp-chat-input {
  width: 93%;
  padding: 12px;
  border: 1px solid #bbcddf;
  border-radius: 25px;
  outline: none;
  font-size: 14px;
}

.sp-chat-input:focus {
  border-color: #6603f2;
  box-shadow: 0 0 0 2px rgba(0, 116, 217, 0.2);
}

/* Botão WhatsApp (mantém verde por familiaridade) */
.sp-whatsapp-btn {
  background: #25d366 !important;
  color: #ffffff !important;
  border: none;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 12px;
  margin-top: 10px;
  text-decoration: none !important;
  display: inline-block;
  transition: background 0.3s ease;
}

.sp-whatsapp-btn:hover {
  background: #128c7e !important;
}

/* Botão toggle de abertura/fechamento do chatbot */
.sp-chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background-image: linear-gradient(90deg, #1670f2 0, #6603f2 100%);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
  z-index: 10000;
  transition: transform 0.3s ease;
  padding-top: 10px;
}

.sp-chat-toggle:hover {
  transform: scale(1.1);
    background-image: linear-gradient(90deg, #6603f2 0, #1670f2 100%);

}

/* Indicador de digitação */
.sp-typing-indicator {
  display: none;
  padding: 10px 15px;
  background: #ffffff;
  border-radius: 18px;
  border-bottom-left-radius: 5px;
  margin-bottom: 15px;
  max-width: 80%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

.sp-typing-dots {
  display: flex;
  gap: 3px;
}

.sp-typing-dots span {
  width: 8px;
  height: 8px;
  background: #999999;
  border-radius: 50%;
  animation: sp-typing 1.4s infinite ease-in-out;
}

.sp-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.sp-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes sp-typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ===== MELHORIAS PARA MOBILE ===== */
@media (max-width: 480px) {
  .sp-chatbot-container {
    width: 100% !important;
    height: 100% !important;
    bottom: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
  }

  .sp-chat-messages {
    padding: 10px;
    height: calc(100% - 140px) !important;
  }

  .sp-message-content {
    max-width: 90% !important;
    font-size: 14px !important;
    line-height: 1.4;
  }

  .sp-chat-input-container {
    padding: 10px;
    position: fixed;
    bottom: 0;
    width: 100%;
    background: #ffffff;
    box-sizing: border-box;
  }

  .sp-chat-input {
    width: 85% !important;
    padding: 12px;
    font-size: 16px !important; /* Melhora a acessibilidade em mobile */
  }

  .sp-feedback-container {
    max-width: 90% !important;
  }

  .sp-feedback-question {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
  }

  .sp-feedback-buttons {
    align-self: stretch;
    justify-content: space-between;
    width: 100%;
  }

  .sp-feedback-btn {
    padding: 8px 12px;
    font-size: 18px; /* Botões maiores para touch */
    flex: 1;
    margin: 0 5px;
    text-align: center;
  }

  .sp-support-message {
    margin: 10px 0;
    padding: 12px;
  }

  .sp-whatsapp-support-btn {
    padding: 12px 16px;
    font-size: 14px;
    display: block;
    text-align: center;
    margin-top: 8px;
  }

  /* Melhorias no cabeçalho */
  .sp-chatbot-header {
    padding: 12px 15px;
  }

  .sp-chatbot-header h3 {
    font-size: 16px;
  }

  .sp-subtitle {
    font-size: 11px;
  }

  /* Ajuste no botão toggle */
  .sp-chat-toggle {
    bottom: 15px;
    right: 15px;
    width: 55px;
    height: 55px;
    font-size: 22px;
  }

  /* Melhoria na área de mensagens */
  .sp-chat-messages::-webkit-scrollbar {
    width: 4px;
  }
}

/* Melhoria para tablets */
@media (min-width: 481px) and (max-width: 768px) {
  .sp-chatbot-container {
    width: 380px !important;
    right: 10px !important;
  }
}

/* Prevenir zoom no iOS ao focar no input */
@media screen and (max-width: 480px) {
  .sp-chat-input {
    font-size: 16px !important;
  }
}

/* Melhorias de acessibilidade para botões */
.sp-feedback-btn:focus {
  outline: 2px solid #0074d9;
  outline-offset: 2px;
}

.sp-whatsapp-support-btn:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Melhorias de performance para mobile */
.sp-chatbot-container {
  will-change: transform;
  backface-visibility: hidden;
}

/* Estilização de barra de rolagem */
.sp-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.sp-chat-messages::-webkit-scrollbar-track {
  background: #e8edf4;
  border-radius: 3px;
}

.sp-chat-messages::-webkit-scrollbar-thumb {
  background: #aabed6;
  border-radius: 3px;
}

.sp-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #92b7ce;
}