/* ============================================
   WhatsApp Chat Widget — Standalone CSS
   Reusable across any project.
   ============================================ */

/* ---------- CSS Variables (scoped) ---------- */
.wa-widget {
  --wa-green: #25D366;
  --wa-green-dark: #128C7E;
  --wa-dark: #1d272c;
  --wa-dark-light: #202C33;
  --wa-chat-bg: #0B141A;
  --wa-bubble: #005C4B;
  --wa-bubble-in: #202C33;
  --wa-text: #E9EDEF;
  --wa-text-secondary: #8696A0;
  --wa-radius: 16px;
  --wa-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --wa-font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---------- Floating Button ---------- */
.wa-widget-btn {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 9998;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--wa-green);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 16px rgba(37, 211, 102, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.15);
  transition: var(--wa-transition);
  outline: none;
}

.wa-widget-btn:hover {
  transform: scale(1.08);
  box-shadow:
    0 6px 28px rgba(37, 211, 102, 0.55),
    0 2px 10px rgba(0, 0, 0, 0.2);
}

.wa-widget-btn:active {
  transform: scale(0.95);
}

/* Pulse ring animation */
.wa-widget-btn::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--wa-green);
  animation: wa-pulse 2s ease-out infinite;
  z-index: -1;
}

@keyframes wa-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* Icons inside button */
.wa-widget-btn svg {
  width: 34px;
  height: 34px;
  fill: #fff;
  transition: var(--wa-transition);
}

.wa-widget-btn .wa-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.wa-widget-btn.active .wa-icon-wa {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.wa-widget-btn.active .wa-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.wa-widget-btn.active::before {
  animation: none;
}

/* ---------- Tooltip Badge ---------- */
.wa-tooltip {
  position: fixed;
  bottom: 38px;
  left: 100px;
  background: #fff;
  color: var(--wa-dark);
  font-family: var(--wa-font);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  z-index: 9997;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(10px);
  animation: wa-tooltip-in 0.5s 3s forwards;
  pointer-events: none;
}

.wa-tooltip::after {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid #fff;
}

@keyframes wa-tooltip-in {
  to { opacity: 1; transform: translateX(0); }
}

.wa-widget-btn.active ~ .wa-tooltip {
  display: none;
}

/* ---------- Chat Popup Container ---------- */
.wa-chat-popup {
  position: fixed;
  bottom: 102px;
  left: 28px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 40px);
  border-radius: var(--wa-radius);
  overflow: hidden;
  box-shadow:
    0 12px 48px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.1);
  font-family: var(--wa-font);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: var(--wa-transition);
}

.wa-chat-popup.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ---------- Header ---------- */
.wa-chat-header {
  background: var(--wa-dark);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.wa-chat-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.wa-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--wa-green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.wa-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.wa-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

/* Online indicator */
.wa-header-info {
  flex: 1;
  min-width: 0;
}

.wa-header-name {
  color: var(--wa-text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.wa-header-status {
  color: var(--wa-text-secondary);
  font-size: 12.5px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
}
.wa-header-status::before {
    content: '';
    width: 15px;
    height: 15px;
    background: var(--wa-dark);
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    left: -24px;
}

.wa-header-status::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--wa-green);
    border-radius: 50%;
    display: inline-block;
    animation: wa-blink 2s ease-in-out infinite;
    position: absolute;
    left: -20px;
}

@keyframes wa-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.wa-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--wa-transition);
}

.wa-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.wa-close-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--wa-text-secondary);
}

/* ---------- Chat Body ---------- */
.wa-chat-body {
  background: var(--wa-chat-bg);
  padding: 24px 16px;
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  position: relative;
}

/* WhatsApp-style background pattern */
.wa-chat-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='20' cy='20' r='1.2' fill='%23ffffff' fill-opacity='0.03'/%3E%3C/pattern%3E%3C/defs%3E%3Crect fill='url(%23p)' width='200' height='200'/%3E%3C/svg%3E");
  opacity: 0.6;
  pointer-events: none;
}

/* Message bubble */
.wa-message {
  position: relative;
  background: var(--wa-bubble-in);
  padding: 10px 14px;
  border-radius: 8px 8px 8px 0;
  max-width: 85%;
  color: var(--wa-text);
  font-size: 14.2px;
  line-height: 1.5;
  animation: wa-msg-in 0.4s ease-out;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.13);
}

/* Little tail on bubble */
.wa-message::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-bottom: 8px solid var(--wa-bubble-in);
  border-left: 8px solid transparent;
}

/* Greeting lines */
.wa-greeting-line1 {
  font-size: 15.5px;
  font-weight: 600;
  margin-bottom: 2px;
}

.wa-greeting-line2 {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--wa-text-secondary);
}

.wa-message-time {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--wa-text-secondary);
  margin-top: 4px;
}

@keyframes wa-msg-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Services List ---------- */
.wa-services-container {
  margin-top: 12px;
  position: relative;
}

.wa-services-container.wa-msg-animate {
  animation: wa-msg-in 0.4s ease-out;
}

.wa-services-list {
  background: var(--wa-dark-light);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.wa-services-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--wa-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 14px 6px;
}

.wa-service-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--wa-text);
  font-family: var(--wa-font);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.2s ease;
  text-align: left;
}

.wa-service-item:hover {
  background: rgba(255, 0, 77, 0.04);
}

.wa-service-item:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.wa-service-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.wa-service-label {
  flex: 1;
  font-weight: 500;
}

.wa-service-arrow {
  font-size: 18px;
  color: var(--active);
  font-weight: 600;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.wa-service-item:hover .wa-service-arrow {
  transform: translateX(3px);
}

/* Typing indicator */
.wa-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px 16px;
}

.wa-typing-dot {
  width: 8px;
  height: 8px;
  background: var(--wa-text-secondary);
  border-radius: 50%;
  animation: wa-typing-bounce 1.4s infinite ease-in-out;
}

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

@keyframes wa-typing-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ---------- Chat Input / Send Area ---------- */
.wa-chat-footer {
  background: var(--wa-dark-light);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-input-wrapper {
  flex: 1;
  position: relative;
}

.wa-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--wa-chat-bg);
  border: none;
  outline: none;
  color: var(--wa-text);
  font-family: var(--wa-font);
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  transition: var(--wa-transition);
}

.wa-input::placeholder {
  color: var(--wa-text-secondary);
}

.wa-input:focus {
  box-shadow: 0 0 0 1.5px rgba(255, 0, 77, 0.3);
}

.wa-send-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  background: var(--active);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
  transition: var(--wa-transition);
}

.wa-send-btn:hover {
  background: var(--primary);
  transform: scale(1.06);
}

.wa-send-btn:active {
  transform: scale(0.94);
}

.wa-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  transform: rotate(-30deg) translateX(1px);
  flex-shrink: 0;
}

/* ---------- Powered-by footer ---------- */
.wa-powered {
  background: var(--wa-dark);
  text-align: center;
  padding: 7px 0;
  font-size: 11px;
  color: var(--wa-text-secondary);
  letter-spacing: 0.3px;
}

.wa-powered a {
  color: var(--bg-alt);
  text-decoration: none;
  font-weight: 600;
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
    .nav-cta {
        font-size: 0.8rem;
    }
}
@media (max-width: 480px) {
  .wa-chat-popup {
    width: calc(100vw - 55px);
    right: 10px;
    bottom: 96px;
    border-radius: 14px;
  }

  .wa-widget-btn {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .wa-widget-btn svg {
    width: 30px;
    height: 30px;
  }

  .wa-tooltip {
    display: none !important;
  }
}

/* ---------- Dark/Light mode aware ---------- */
@media (prefers-color-scheme: light) {
  .wa-tooltip {
    background: #fff;
    color: #1a1a1a;
  }
}
