:root {
  --wa-green: #25d366;
  --wa-green-dark: #128c7e;
  --wa-dark: #075e54;
  --wa-bg: #e5ddd5;
  --bg-surface: #ffffff;
  --text-primary: #111b21;
  --text-secondary: #8696a0;
  --shadow-lg: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --font-family: "Outfit", sans-serif;
}

/* Scoped Reset & Base Styles */
.wa-widget,
.wa-widget * {
  box-sizing: border-box;
}

.wa-widget {
  font-family: var(--font-family);
}

/* Widget Container */
.wa-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

/* Launcher Button */
.wa-launcher {
  width: 60px;
  height: 60px;
  background: var(--wa-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.wa-launcher:hover {
  transform: scale(1.1);
}

.wa-launcher i {
  font-size: 32px;
  color: white;
}

/* Notification Badge */
.wa-notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff3b30;
  color: white;
  font-size: 12px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.wa-notification-badge.show {
  opacity: 1;
  transform: scale(1);
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(255, 59, 48, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
  }
}

/* Chat Box */
.wa-chat-box {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  height: 500px;
  /* Max height */
  max-height: calc(100vh - 120px);
  /* Responsive max height */
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

.wa-chat-box.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
}

/* Header */
.wa-chat-header {
  background: var(--wa-green-dark);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.wa-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-avatar {
  position: relative;
  width: 44px;
  height: 44px;
}

.wa-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.wa-online-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #00ff40;
  border: 2px solid var(--wa-green-dark);
  border-radius: 50%;
}

.wa-header-info h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.wa-header-info p {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 2px;
}

.wa-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.wa-close-btn:hover {
  opacity: 1;
}

/* Body */
.wa-chat-body {
  flex: 1;
  background-color: var(--wa-bg);
  background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
  /* Classic WA Pattern */
  background-repeat: repeat;
  background-size: 400px;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.wa-message {
  max-width: 85%;
  margin-bottom: 20px;
  animation: fade-in-up 0.4s ease-out forwards;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wa-message-content {
  background: white;
  padding: 10px 14px;
  border-radius: 0 12px 12px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.wa-message.received .wa-message-content {
  border-top-left-radius: 0;
}

.wa-message.received .wa-message-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: -10px;
  width: 0;
  height: 0;
  border: 10px solid transparent;
  border-top-color: white;
  border-right: 0;
  margin-top: 0px;
  margin-right: -10px;
}

.wa-time {
  display: block;
  font-size: 10px;
  color: var(--text-secondary);
  text-align: right;
  margin-top: 4px;
}

/* Footer */
.wa-chat-footer {
  padding: 12px 14px;
  background: #f0f2f5;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.wa-input-group {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#wa-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  padding: 8px 0;
}

#wa-send-btn {
  background: none;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wa-input:not(:placeholder-shown) + #wa-send-btn {
  color: var(--wa-green);
  transform: rotate(0deg);
}
