/* ========================================
   CHAT WIDGET - VENVARITA OFICIAL (SUPORTE)
   Cor: Laranja
   Versão: 2.1 - Com dois botões (Checkout + Ver Ofertas)
   ======================================== */

.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Botão flutuante */
.chat-widget .chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff7c43 0%, #ff5722 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 20px rgba(255, 124, 67, 0.4);
  transition: all 0.3s ease;
}

.chat-widget .chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(255, 124, 67, 0.5);
}

.chat-widget .chat-toggle svg {
  width: 28px;
  height: 28px;
}

/* Container do chat */
.chat-widget .chat-container {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 380px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s ease;
  max-height: 85vh;
}

.chat-widget .chat-container.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.chat-widget .chat-header {
  background: linear-gradient(135deg, #ff7c43 0%, #ff5722 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-widget .chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-widget .chat-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
}

.chat-widget .chat-avatar img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.chat-widget .chat-title {
  display: block;
  font-weight: 600;
  font-size: 15px;
}

.chat-widget .chat-status {
  display: block;
  font-size: 12px;
  color: #7fff00;
  font-weight: 500;
}

.chat-widget .chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: background 0.2s;
}

.chat-widget .chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-widget .chat-close svg {
  width: 20px;
  height: 20px;
}

/* Área de mensagens */
.chat-widget .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fa;
  min-height: 250px;
  max-height: 300px;
}

/* Mensagem de boas-vindas */
.chat-widget .welcome-message {
  background: white;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat-widget .welcome-message p {
  margin: 0;
  color: #333;
  line-height: 1.5;
  font-size: 14px;
}

/* Mensagens */
.chat-widget .message {
  max-width: 85%;
  animation: chatFadeIn 0.3s ease;
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-widget .message.user {
  align-self: flex-end;
}

.chat-widget .message.assistant {
  align-self: flex-start;
}

.chat-widget .message-content {
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14px;
}

.chat-widget .message.user .message-content {
  background: linear-gradient(135deg, #ff7c43 0%, #ff5722 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  font-weight: 400;
}

.chat-widget .message.user .message-content p {
  color: #ffffff;
  font-weight: 400;
  margin: 0;
}

.chat-widget .message.assistant .message-content {
  background: white;
  color: #333;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat-widget .message-content p {
  margin: 0;
}

/* CONTAINER DOS DOIS BOTÕES */
.chat-widget .action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

/* Botões de ação dentro das mensagens */
.chat-widget .action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.chat-widget .action-btn.checkout-btn {
  background: linear-gradient(135deg, #ff7c43 0%, #ff5722 100%);
  color: white;
}

.chat-widget .action-btn.checkout-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(255, 124, 67, 0.4);
}

/* BOTÃO AZUL - VER OUTRAS OFERTAS */
.chat-widget .action-btn.offers-btn {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
}

.chat-widget .action-btn.offers-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

/* BOTÃO RASTREIO */
.chat-widget .action-btn.tracking-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
  margin-top: 12px;
}

.chat-widget .action-btn.tracking-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.chat-widget .action-btn.whatsapp-btn {
  background: #25D366;
  color: white;
  margin-top: 12px;
}

.chat-widget .action-btn.whatsapp-btn:hover {
  background: #1da851;
  transform: scale(1.02);
}

/* Indicador de digitação */
.chat-widget .typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.chat-widget .typing span {
  width: 8px;
  height: 8px;
  background: #ccc;
  border-radius: 50%;
  animation: chatTyping 1.4s infinite ease-in-out;
}

.chat-widget .typing span:nth-child(1) { animation-delay: 0s; }
.chat-widget .typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-widget .typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatTyping {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* Quick Replies */
.chat-widget .quick-replies {
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: white;
  border-top: 1px solid #f0f0f0;
}

.chat-widget .quick-btn {
  font-size: 13px;
  padding: 8px 14px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #333;
  font-weight: 500;
}

.chat-widget .quick-btn:hover {
  background: linear-gradient(135deg, #ff7c43 0%, #ff5722 100%);
  color: white;
  border-color: transparent;
}

/* Input */
.chat-widget .chat-input-container {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #eee;
  display: flex;
  gap: 12px;
}

.chat-widget .chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-widget .chat-input:focus {
  border-color: #ff7c43;
}

.chat-widget .chat-input:disabled {
  background: #f5f5f5;
}

.chat-widget .chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff7c43 0%, #ff5722 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-widget .chat-send:hover:not(:disabled) {
  transform: scale(1.05);
}

.chat-widget .chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-widget .chat-send svg {
  width: 20px;
  height: 20px;
}

/* Barra de Ação Dinâmica */
.chat-widget .dynamic-action-bar {
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #f0f0f0;
}

.chat-widget .dynamic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 24px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.chat-widget .dynamic-btn.tracking-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
}

.chat-widget .dynamic-btn.tracking-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.chat-widget .dynamic-btn.whatsapp-btn {
  background: #25D366;
  color: white;
}

.chat-widget .dynamic-btn.whatsapp-btn:hover {
  background: #1da851;
  transform: scale(1.02);
}

.chat-widget .dynamic-btn.checkout-btn {
  background: linear-gradient(135deg, #ff7c43 0%, #ff5722 100%);
  color: white;
}

.chat-widget .dynamic-btn.checkout-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(255, 124, 67, 0.4);
}

/* Responsivo */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .chat-widget .chat-container {
    width: calc(100vw - 32px);
    max-height: 75vh;
    right: 0;
  }

  .chat-widget .chat-toggle {
    width: 56px;
    height: 56px;
  }

  .chat-widget .chat-messages {
    min-height: 200px;
    max-height: 250px;
  }
}

/* Scrollbar personalizada */
.chat-widget .chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-widget .chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

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

.chat-widget .chat-messages::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}