/* ═══════════════════════════════════════════════
   WhatsApp Sticky Button
═══════════════════════════════════════════════ */
#wa-sticky-btn {
  display: flex;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background-color: #25d366;
  color: #fff;
  border-radius: 50px;
  padding: 8px 14px 8px 10px;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-family: sans-serif;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: background-color 0.2s, transform 0.2s;
  border: none;
  cursor: pointer;
}
#wa-sticky-btn:hover {
  background-color: #1ebe5d;
  transform: translateY(-2px);
}
#wa-sticky-btn svg { flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   Overlay
═══════════════════════════════════════════════ */
#wa-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
#wa-overlay.wa-open { display: flex; }

/* ═══════════════════════════════════════════════
   Phone Shell
═══════════════════════════════════════════════ */
#wa-phone {
  width: 340px;
  max-width: 100%;
  min-height: 560px;
  border-radius: 36px;
  background: #111;
  box-shadow:
    0 0 0 6px #222,
    0 0 0 8px #333,
    0 30px 60px rgba(0,0,0,0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  animation: wa-popIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes wa-popIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

/* Phone notch */
#wa-phone::before {
  content: '';
  display: block;
  width: 90px;
  height: 22px;
  background: #111;
  border-radius: 0 0 16px 16px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
}

/* Status bar */
#wa-statusbar {
  background: #075e54;
  height: 26px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 16px 3px;
  gap: 6px;
}
#wa-statusbar span {
  color: rgba(255,255,255,0.8);
  font-size: 10px;
  font-family: sans-serif;
}

/* Chat header */
#wa-header {
  background: #075e54;
  padding: 8px 12px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
#wa-header-back {
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.85;
  flex-shrink: 0;
}
#wa-header-back:hover { opacity: 1; }
#wa-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #128c7e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  font-family: sans-serif;
  flex-shrink: 0;
  overflow: hidden;
}
#wa-avatar img { width: 100%; height: 100%; object-fit: cover; }
#wa-header-info { flex: 1; overflow: hidden; }
#wa-header-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#wa-header-status {
  color: rgba(255,255,255,0.75);
  font-size: 11px;
  font-family: sans-serif;
}
#wa-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  flex-shrink: 0;
}
#wa-close-btn:hover { color: #fff; }

/* Chat body */
#wa-chat-body {
  flex: 1;
  min-height: 300px;
  max-height: 380px;
  background: #ece5dd url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c4b99a' fill-opacity='0.18'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
}
#wa-chat-body::-webkit-scrollbar { width: 4px; }
#wa-chat-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }

/* Messages */
.wa-msg {
  max-width: 78%;
  padding: 7px 10px 14px;
  border-radius: 8px;
  font-family: sans-serif;
  font-size: 13px;
  line-height: 1.4;
  position: relative;
  word-break: break-word;
  animation: wa-fadeUp 0.2s ease;
}
@keyframes wa-fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wa-msg-time {
  position: absolute;
  bottom: 3px;
  right: 8px;
  font-size: 10px;
  opacity: 0.6;
  font-family: sans-serif;
}

/* Bot message (left) */
.wa-msg-bot {
  background: #fff;
  color: #111;
  align-self: flex-start;
  border-top-left-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.wa-msg-bot::before {
  content: '';
  position: absolute;
  top: 0; left: -7px;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: transparent #fff transparent transparent;
}

/* User message (right) */
.wa-msg-user {
  background: #dcf8c6;
  color: #111;
  align-self: flex-end;
  border-top-right-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.wa-msg-user::before {
  content: '';
  position: absolute;
  top: 0; right: -7px;
  border-width: 0 0 8px 8px;
  border-style: solid;
  border-color: transparent transparent transparent #dcf8c6;
}

/* Typing indicator */
.wa-typing {
  align-self: flex-start;
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  border-top-left-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  display: flex;
  gap: 4px;
  align-items: center;
}
.wa-typing span {
  width: 7px; height: 7px;
  background: #aaa;
  border-radius: 50%;
  animation: wa-bounce 1.2s infinite;
}
.wa-typing span:nth-child(2) { animation-delay: 0.2s; }
.wa-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wa-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* Quick-reply building buttons */
#wa-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 2px 2px;
  align-self: flex-start;
  max-width: 90%;
}
.wa-qr-btn {
  background: #fff;
  border: 1.5px solid #25d366;
  color: #075e54;
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.wa-qr-btn:hover {
  background: #25d366;
  color: #fff;
}

/* Input bar — always occupies space, visibility toggled to avoid height jumps */
#wa-input-bar {
  background: #f0f0f0;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #ddd;
  transition: visibility 0.15s;
}
#wa-input-bar.wa-hidden {
  visibility: hidden;
  pointer-events: none;
}
#wa-input {
  flex: 1;
  background: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: sans-serif;
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
#wa-send-btn {
  width: 36px; height: 36px;
  background: #25d366;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
#wa-send-btn:hover { background: #1ebe5d; }
#wa-send-btn:disabled { background: #aaa; cursor: default; }

/* Home bar */
#wa-homebar {
  background: #111;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#wa-homebar span {
  width: 80px; height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 4px;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 600px) {
  #wa-phone {
    width: 100%;
    min-height: 300px;
    height: 80vh;
    border-radius: 20px;
  }
  #wa-chat-body {
    min-height: 0;
    max-height: none;
  }
}
