/* ============================================
   WhatsApp Button - Estilos
   ============================================ */

.whatsapp-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
}

/* ============================================
   MENSAJE CHAT
   ============================================ */

.whatsapp-message {
  position: relative;
  max-width: 320px;
  animation: messageSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.whatsapp-message.closing {
  animation: messageSlideOut 0.3s ease forwards;
}

@keyframes messageSlideOut {
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
}

.message-bubble {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  margin-right: 0.75rem;
  position: relative;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.brand-mini {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #00bcd4, #8e24aa);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.message-sender {
  font-weight: 600;
  font-size: 0.875rem;
  color: #003366;
}

.message-status {
  font-size: 0.75rem;
  color: #6b7280;
}

.btn-close-message {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  padding: 0;
  margin-left: auto;
}

.btn-close-message:hover {
  background: #f3f4f6;
  color: #374151;
}

.message-content {
  padding: 0.5rem 0;
}

.message-text p {
  font-size: 0.875rem;
  color: #374151;
  margin-bottom: 0.75rem;
}

.message-text p:last-of-type {
  margin-bottom: 1rem;
}

.btn-whatsapp {
  background: #25d366;
  color: white;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  display: block;
  text-align: center;
  transition: all 0.3s ease;
  border: none;
}

.btn-whatsapp:hover {
  background: #20ba5a;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(37, 211, 102, 0.3);
  color: white;
}

.typing-indicator {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typingBounce 0.6s infinite;
}

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

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

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.3);
  }
}

.message-tail {
  position: absolute;
  bottom: -0.5rem;
  right: 2rem;
  width: 1rem;
  height: 1rem;
  background: white;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transform: rotate(45deg);
}

/* ============================================
   BOTON FLOTANTE
   ============================================ */

.whatsapp-button {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  background: #25d366;
  border-radius: 50%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
  animation: buttonPopIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.5s both;
  cursor: pointer;
  z-index: 10;
}

@keyframes buttonPopIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.whatsapp-button:hover {
  transform: scale(1.1);
  background: #20ba5a;
  box-shadow: 0 30px 60px -12px rgba(37, 211, 102, 0.4);
}

.whatsapp-button:active {
  transform: scale(0.9);
}

.whatsapp-icon {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.whatsapp-icon svg {
  width: 36px;
  height: 36px;
  color: white;
}

.pulse-ring {
  position: absolute;
  inset: 0;
  background: #25d366;
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  z-index: 1;
}

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

.notification-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid white;
  z-index: 3;
  animation: badgePop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) 1s both;
}

@keyframes badgePop {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.whatsapp-tooltip {
  position: absolute;
  right: calc(100% + 1rem);
  top: 50%;
  transform: translateY(-50%);
  background: #1f2937;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.whatsapp-tooltip::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.25rem;
  transform: translateY(-50%) rotate(45deg);
  width: 0.5rem;
  height: 0.5rem;
  background: #1f2937;
}

.whatsapp-button:hover .whatsapp-tooltip {
  opacity: 1;
}

@media (max-width: 768px) {
  .whatsapp-widget {
    bottom: 1rem;
    right: 1rem;
  }

  .whatsapp-message {
    max-width: 280px;
  }

  .whatsapp-button {
    width: 56px;
    height: 56px;
  }

  .whatsapp-icon svg {
    width: 32px;
    height: 32px;
  }

  .whatsapp-tooltip {
    display: none;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
