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

/* Floating Button */
.whatsapp-widget-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #25D366;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: none;
  position: relative;
}

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

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

/* Chat Panel */
.whatsapp-widget-panel {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 360px;
  height: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
  transform: scale(0.9);
}


.whatsapp-widget-panel.active {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.whatsapp-widget-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Header */
.whatsapp-widget-chat-header {
  background: #075E54;
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.whatsapp-widget-chat-avatar {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #075E54;
}

.whatsapp-widget-chat-avatar svg {
  width: 24px;
  height: 24px;
}

.whatsapp-widget-chat-info {
  flex: 1;
}

.whatsapp-widget-chat-info .name {
  display: block;
  font-weight: 600;
  font-size: 16px;
}

.whatsapp-widget-chat-info .status {
  display: block;
  font-size: 12px;
  opacity: 0.8;
}

.whatsapp-widget-close {
  background: none;
  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-widget-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Messages */
.whatsapp-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #E5DDD5;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%239C9292' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.whatsapp-widget-date {
  text-align: center;
  margin: 10px 0 20px;
  font-size: 12px;
  color: #667781;
  background: rgba(225, 232, 235, 0.9);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  align-self: center;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.whatsapp-widget-message {
  margin-bottom: 8px;
  display: flex;
}

.whatsapp-widget-message.outgoing {
  justify-content: flex-end;
}

.whatsapp-widget-message-bubble {
  max-width: 75%;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

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

.whatsapp-widget-message.outgoing .whatsapp-widget-message-bubble {
  background: #D9FDD3;
  border-radius: 8px 0 8px 8px;
}

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

.whatsapp-widget-message.outgoing .whatsapp-widget-message-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid #D9FDD3;
  border-right: 8px solid transparent;
}

/* Hide tail on bubble if it's not the first in a group? Simpler to just show all for now or skip tail */
.whatsapp-widget-message-bubble::before {
  display: block;
  /* enable tails */
}


.whatsapp-widget-message-time {
  font-size: 11px;
  color: #667781;
  float: right;
  margin-left: 8px;
  margin-top: 4px;
}

.whatsapp-widget-message-status {
  display: inline-block;
  margin-left: 4px;
  color: #53bdeb;
}

/* Input Area */
.whatsapp-widget-input {
  padding: 10px 10px;
  background: #F0F2F5;
  display: flex;
  gap: 8px;
  align-items: center;
}

.whatsapp-widget-input input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 20px;
  background: white;
  font-size: 14px;
  outline: none;
}

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

.whatsapp-widget-send:hover {
  background: rgba(0, 0, 0, 0.05);
}

.whatsapp-widget-send svg {
  color: #54656F;
  width: 24px;
  height: 24px;
}

.whatsapp-widget-send:not(:disabled) svg {
  color: #075E54;
}

.whatsapp-widget-loading {
  padding: 20px;
  text-align: center;
  color: #667781;
}

.whatsapp-widget-empty {
  padding: 40px 20px;
  text-align: center;
  color: #667781;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .whatsapp-widget-panel {
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
    max-width: 380px;
  }
}