/* ═══════════════════════════════════════════
   PLERP SYSTEMS — Chatbot Widget
   Palette matches Corporate Theme
═══════════════════════════════════════════ */

/* ── Bubble ────────────────────────────────── */
#chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(11,79,71,0.35);
  z-index: 9999;
  transition: transform var(--transition), box-shadow var(--transition);
}
#chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 32px rgba(11,79,71,0.45);
}
#chat-bubble svg { width: 28px; height: 28px; fill: #fff; }
#chat-bubble .chat-notif {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  font-family: var(--font);
}

/* ── Chat Window ───────────────────────────── */
#chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 360px;
  max-height: 560px;
  background: var(--bg);
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  font-family: var(--font);
}
#chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ─────────────────────────────── */
#chat-header {
  background: var(--accent);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chat-avatar {
  width: 38px;
  height: 38px;
  background: var(--accent-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-avatar svg { width: 20px; height: 20px; fill: #fff; }
.chat-header-info { flex: 1; }
.chat-header-info strong { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.chat-header-info span { font-size: 12px; color: rgba(255,255,255,0.7); }
.chat-online-dot {
  width: 8px; height: 8px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
#chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
#chat-close:hover { color: #fff; }
#chat-close svg { width: 18px; height: 18px; fill: currentColor; }

/* ── Messages Area ──────────────────────── */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-alt);
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 90%;
  animation: msgIn 0.2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.msg-avatar svg { width: 14px; height: 14px; fill: #fff; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
}
.chat-msg.bot  .msg-bubble { background: #fff; color: var(--text); border-bottom-left-radius: 4px; box-shadow: var(--shadow-sm); }
.chat-msg.user .msg-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }

/* ── Options (pill buttons) ─────────────── */
.chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 2px 36px;
  animation: msgIn 0.25s ease;
}
.chat-option-btn {
  background: #fff;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}
.chat-option-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ── Typing Indicator ───────────────────── */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  animation: msgIn 0.2s ease;
}
.typing-dots {
  background: #fff;
  border-radius: 16px;
  padding: 10px 16px;
  display: flex;
  gap: 5px;
  box-shadow: var(--shadow-sm);
}
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--accent-2);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* ── WhatsApp CTA button ────────────────── */
.chat-wa-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  width: 100%;
  margin-top: 6px;
  text-decoration: none;
  transition: background 0.2s;
}
.chat-wa-btn:hover { background: #1ebe5d; color: #fff; }
.chat-wa-btn svg { width: 20px; height: 20px; fill: #fff; }

/* ── Input Area ─────────────────────────── */
#chat-input-area {
  padding: 12px 14px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
#chat-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-alt);
  outline: none;
  transition: border-color 0.2s;
}
#chat-input:focus { border-color: var(--accent-2); background: #fff; }
#chat-input::placeholder { color: var(--text-faint); }
#chat-send {
  width: 40px; height: 40px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
#chat-send:hover { background: var(--accent-2); }
#chat-send svg { width: 18px; height: 18px; fill: #fff; }

/* ── Mobile ─────────────────────────────── */
@media (max-width: 480px) {
  #chat-window {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 90px;
  }
  #chat-bubble { right: 18px; bottom: 18px; }
}
