:root {
  --whatsapp-primary: #25D366;
  --whatsapp-secondary: #128C7E;
  --whatsapp-dark: #075E54;
  --whatsapp-light: #FFFFFF;
  --whatsapp-chat-bg: #E5DDD5;
  --notification-color: #FF3B30;
  --shadow-glow: 0 0 16px rgba(37, 211, 102, 0.6);
  --text-dark: #333333;
  --text-light: #FFFFFF;
  --text-muted: #667781;
}

.whatsapp-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 10000;
  font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.whatsapp-button {
  position: relative;
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, var(--whatsapp-primary), var(--whatsapp-secondary));
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), var(--shadow-glow);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 10;
  overflow: hidden;
}

.whatsapp-button:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25), var(--shadow-glow);
}

.whatsapp-button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.whatsapp-button img {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s ease;
  z-index: 2;
}

.whatsapp-icon-inner {
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
  z-index: 1;
}

.whatsapp-button:hover img {
  transform: scale(1.1) rotate(5deg);
}

.notification-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  background-color: var(--notification-color);
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  animation: pulse 2s ease-in-out infinite;
  z-index: 20;
  display: none;
}

.message-bubble {
  position: absolute;
  bottom: 85px;
  right: 0;
  background: var(--whatsapp-light);
  color: var(--text-dark);
  padding: 0;
  border-radius: 18px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-width: 260px;
  line-height: 1.5;
  text-align: left;
  display: none;
  z-index: 15;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.message-bubble.show {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.message-bubble::after {
  content: "";
  position: absolute;
  bottom: -10px;
  right: 20px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 14px 10px 0 10px;
  border-color: var(--whatsapp-light) transparent transparent transparent;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.message-content {
  padding: 16px;
  background: var(--whatsapp-light);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.agent-name {
  font-weight: 600;
  color: var(--whatsapp-dark);
  font-size: 15px;
}

.typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 6px;
  height: 6px;
  background-color: var(--whatsapp-secondary);
  border-radius: 50%;
  animation: typingAnimation 1.4s infinite ease-in-out;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dot:nth-child(3) {
  animation-delay: 0.4s;
}

.message-bubble p {
  margin: 0;
  color: var(--text-dark);
}

.message-footer {
  background: rgba(0, 0, 0, 0.03);
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 0 10px rgba(255, 59, 48, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
  }
}

@keyframes typingAnimation {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .whatsapp-container {
    bottom: 20px;
    right: 20px;
  }

  .whatsapp-button {
    width: 60px;
    height: 60px;
  }

  .whatsapp-button img {
    width: 34px;
    height: 34px;
  }

  .message-bubble {
    font-size: 13px;
    max-width: 220px;
    bottom: 75px;
  }

  .message-content {
    padding: 14px;
  }

  .message-bubble::after {
    right: 15px;
  }
}

@media (prefers-color-scheme: dark) {
  .whatsapp-button {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), var(--shadow-glow);
  }

  .message-bubble {
    background: #2D3436;
    color: var(--text-light);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .message-bubble::after {
    border-color: #2D3436 transparent transparent transparent;
  }

  .message-content {
    background: #2D3436;
  }

  .message-bubble p {
    color: var(--text-light);
  }

  .agent-name {
    color: var(--whatsapp-primary);
  }

  .message-footer {
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
  }
}