/**
 * WhatsApp Chat Widget - Estilo
 * Botão flutuante com chat bot interativo
 */

/* Botão Flutuante */
.whatsapp-float-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.whatsapp-float-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.whatsapp-float-btn svg {
  width: 32px;
  height: 32px;
  fill: white;
}

/* Badge de notificação */
.whatsapp-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid white;
}

/* Animação de pulso */
@keyframes pulse {
  0% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.8);
  }
  100% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  }
}

/* Chat Widget */
.whatsapp-chat-widget {
  position: fixed;
  bottom: 100px;
  right: 25px;
  width: 360px;
  max-height: 600px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.whatsapp-chat-widget.active {
  display: flex;
}

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

/* Header do Chat */
.whatsapp-chat-header {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.whatsapp-chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.whatsapp-chat-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.whatsapp-chat-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
}

.whatsapp-status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.whatsapp-chat-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.whatsapp-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Body do Chat */
.whatsapp-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #e5ddd5;
  background-image: 
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(255,255,255,.03) 10px,
      rgba(255,255,255,.03) 20px
    );
  max-height: 400px;
}

/* Mensagens */
.whatsapp-message {
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease;
}

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

.whatsapp-message-bubble {
  background: white;
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 80%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
}

.whatsapp-message.bot .whatsapp-message-bubble {
  background: white;
  border-radius: 0 8px 8px 8px;
}

.whatsapp-message.user .whatsapp-message-bubble {
  background: #dcf8c6;
  margin-left: auto;
  border-radius: 8px 0 8px 8px;
}

.whatsapp-message-text {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  margin: 0;
}

.whatsapp-message-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
  text-align: right;
}

/* Botões de opção */
.whatsapp-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.whatsapp-option-btn {
  background: white;
  border: 1px solid #25D366;
  color: #25D366;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.whatsapp-option-btn img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.whatsapp-option-btn:hover {
  background: #25D366;
  color: white;
  transform: translateX(5px);
}

/* Footer do Chat */
.whatsapp-chat-footer {
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

.whatsapp-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.whatsapp-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.whatsapp-input:focus {
  border-color: #25D366;
}

.whatsapp-send-btn {
  background: #25D366;
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.whatsapp-send-btn:hover {
  background: #128C7E;
  transform: scale(1.1);
}

.whatsapp-send-btn svg {
  width: 20px;
  height: 20px;
  fill: white;
}

/* Typing indicator */
.whatsapp-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
}

.whatsapp-typing-dot {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.whatsapp-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.whatsapp-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

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

/* Responsivo */
@media (max-width: 768px) {
  .whatsapp-chat-widget {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 90px;
    max-height: 500px;
  }

  .whatsapp-float-btn {
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
  }

  .whatsapp-float-btn svg {
    width: 28px;
    height: 28px;
  }
}
