/* WhatsApp Floating Chat Widget */
.whatsapp-float {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.whatsapp-button {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transition: all 0.3s ease;
  border: none;
  position: relative;
}

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

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

.whatsapp-button.active {
  background: #dc3545;
}

.whatsapp-button.active svg {
  display: none;
}

.whatsapp-button.active::before {
  content: '✕';
  color: white;
  font-size: 28px;
  font-weight: 300;
}

/* Notification Badge */
.whatsapp-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* Chat Window */
.whatsapp-chat {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 40px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow: hidden;
}

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

/* Chat Header */
.whatsapp-header {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

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

.whatsapp-info p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.9;
}

/* Chat Body */
.whatsapp-body {
  padding: 20px;
  background: #e5ddd5;
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%23e5ddd5'/%3E%3Cpath d='M30 30m-2 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0' fill='%23d1ccc0' opacity='0.3'/%3E%3C/svg%3E");
}

.whatsapp-message {
  background: white;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  max-width: 85%;
  animation: slideIn 0.3s ease;
}

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

.whatsapp-message::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 12px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 8px 8px 0;
  border-color: transparent white transparent transparent;
}

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

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

/* Quick Replies */
.whatsapp-quick-replies {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.quick-reply-btn {
  background: white;
  border: 1px solid #25d366;
  color: #25d366;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.quick-reply-btn:hover {
  background: #25d366;
  color: white;
  transform: translateX(4px);
}

/* Chat Footer */
.whatsapp-footer {
  background: #f0f0f0;
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.whatsapp-input {
  flex: 1;
  border: none;
  background: white;
  padding: 12px 16px;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.whatsapp-input::placeholder {
  color: #999;
}

.whatsapp-send {
  width: 44px;
  height: 44px;
  background: #25d366;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

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

.whatsapp-send:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: scale(1);
}

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

/* Responsive */
@media (max-width: 768px) {
  .whatsapp-float {
    bottom: 20px;
    right: 20px;
  }
  
  .whatsapp-chat {
    width: calc(100vw - 40px);
    bottom: 90px;
  }
  
  .whatsapp-button {
    width: 56px;
    height: 56px;
  }
  
  .whatsapp-button svg {
    width: 28px;
    height: 28px;
  }
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 8px;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

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

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

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