/* ── AI ChatBot Pro – Widget CSS ─────────────────────────────────
   PREFIX RULE: every selector uses #acp- or .acp- ONLY.
   JS adds/removes class "acp-open". CSS vars use --acp-*.
──────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --acp-primary:   #2563eb;
  --acp-primary-d: #1d4ed8;
  --acp-bg:        #ffffff;
  --acp-surface:   #f1f5f9;
  --acp-text:      #0f172a;
  --acp-muted:     #64748b;
  --acp-border:    #e2e8f0;
  --acp-radius:    18px;
  --acp-font:      'Plus Jakarta Sans', sans-serif;
  --acp-shadow:    0 16px 56px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.08);
}

/* ══════════════════════════════════════════════════════
   LAUNCHER BUBBLE
══════════════════════════════════════════════════════ */
#acp-launcher {
  position: fixed;
  bottom: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--acp-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2147483646;
  box-shadow: 0 4px 24px rgba(37,99,235,.55);
  border: none;
  outline: none;
  user-select: none;
  transition: transform .22s ease, background .2s ease;
}
#acp-launcher.acp-right { right: 24px; }
#acp-launcher.acp-left  { left: 24px; }
#acp-launcher:hover      { transform: scale(1.1); background: var(--acp-primary-d); }
#acp-launcher:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }

/* Pulse ring */
.acp-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--acp-primary);
  opacity: .45;
  animation: acp-pulse 2.3s ease-out infinite;
  pointer-events: none;
}
@keyframes acp-pulse {
  0%   { transform: scale(1);    opacity: .5; }
  75%  { transform: scale(1.7);  opacity: 0;  }
  100% { transform: scale(1.7);  opacity: 0;  }
}
#acp-launcher.acp-open .acp-pulse { display: none; }

/* Bubble SVG icons */
#acp-launcher svg,
#acp-bubble-img {
  width: 28px;
  height: 28px;
  position: relative;
  z-index: 1;
  transition: opacity .2s, transform .2s;
  border-radius: 50%;
  object-fit: cover;
}
#acp-bubble-close {
  position: absolute !important;
  opacity: 0;
  transform: rotate(-90deg);
}
/* open state icon swap */
#acp-launcher.acp-open #acp-bubble-svg  { opacity: 0; transform: rotate(90deg); }
#acp-launcher.acp-open #acp-bubble-img  { opacity: 0; transform: rotate(90deg); }
#acp-launcher.acp-open #acp-bubble-close { opacity: 1; transform: rotate(0); }

/* ══════════════════════════════════════════════════════
   CHAT WINDOW
══════════════════════════════════════════════════════ */
#acp-window {
  position: fixed;
  bottom: 100px;
  width: 375px;
  max-height: 590px;
  background: var(--acp-bg);
  border-radius: var(--acp-radius);
  box-shadow: var(--acp-shadow);
  display: flex;
  flex-direction: column;
  z-index: 2147483645;
  font-family: var(--acp-font);
  overflow: hidden;
  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(.95);
  transition: opacity .28s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}
#acp-window.acp-right { right: 24px; }
#acp-window.acp-left  { left: 24px; }

/* VISIBLE — JS adds .acp-open */
#acp-window.acp-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ── Header ────────────────────────────────────────── */
#acp-header {
  background: var(--acp-primary);
  color: #fff;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
#acp-avatar-wrap { position: relative; flex-shrink: 0; }
#acp-bot-avatar  {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.2);
  display: block;
}
#acp-online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  background: #4ade80; border-radius: 50%;
  border: 2px solid var(--acp-primary);
}
#acp-header-info { flex: 1; min-width: 0; }
#acp-bot-name    { font-weight: 700; font-size: 15px; line-height: 1.2; }
#acp-bot-status  { font-size: 11px; opacity: .75; margin-top: 2px; }
#acp-minimize-btn {
  background: rgba(255,255,255,.15);
  border: none; color: #fff;
  width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s; flex-shrink: 0;
}
#acp-minimize-btn:hover { background: rgba(255,255,255,.3); }
#acp-minimize-btn svg { width: 16px; height: 16px; }

/* ── Messages ──────────────────────────────────────── */
#acp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  min-height: 0;
}
#acp-messages::-webkit-scrollbar       { width: 4px; }
#acp-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.acp-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  animation: acp-msg-in .22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes acp-msg-in {
  from { transform: scale(.88) translateY(6px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);   opacity: 1; }
}
.acp-msg-bot  {
  background: var(--acp-surface);
  color: var(--acp-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.acp-msg-user {
  background: var(--acp-primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* ── Typing dots ───────────────────────────────────── */
#acp-typing-wrap {
  padding: 0 16px 6px;
  flex-shrink: 0;
}
#acp-typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  background: var(--acp-surface);
  padding: 10px 14px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  animation: acp-msg-in .2s ease;
}
#acp-typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: acp-bounce 1.1s ease-in-out infinite;
}
#acp-typing-dots span:nth-child(2) { animation-delay: .18s; }
#acp-typing-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes acp-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-7px); }
}

/* ── Quick replies ─────────────────────────────────── */
#acp-quick-replies {
  padding: 6px 14px 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.acp-qr-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--acp-primary);
  color: var(--acp-primary);
  background: #fff;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--acp-font);
  cursor: pointer;
  transition: all .15s;
  line-height: 1.3;
}
.acp-qr-btn:hover { background: var(--acp-primary); color: #fff; }

/* ── Input row ─────────────────────────────────────── */
#acp-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--acp-border);
  flex-shrink: 0;
}
#acp-input {
  flex: 1;
  border: 1.5px solid var(--acp-border);
  border-radius: 14px;
  padding: 10px 13px;
  font-size: 14px;
  font-family: var(--acp-font);
  color: var(--acp-text);
  background: var(--acp-surface);
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  outline: none;
  transition: border-color .15s, background .15s;
  line-height: 1.45;
}
#acp-input:focus    { border-color: var(--acp-primary); background: #fff; }
#acp-input:disabled { opacity: .5; cursor: not-allowed; }

#acp-send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--acp-primary);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .15s;
}
#acp-send-btn:hover    { background: var(--acp-primary-d); transform: scale(1.08); }
#acp-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
#acp-send-btn svg { width: 17px; height: 17px; }

/* ── GDPR ──────────────────────────────────────────── */
#acp-gdpr-wrap {
  padding: 8px 14px 4px;
  font-size: 12px;
  color: var(--acp-muted);
  border-top: 1px solid var(--acp-border);
  display: flex;
  align-items: flex-start;
  gap: 7px;
  flex-shrink: 0;
}
#acp-gdpr-check { margin-top: 2px; accent-color: var(--acp-primary); flex-shrink: 0; }

/* ── Footer ────────────────────────────────────────── */
#acp-footer {
  text-align: center;
  font-size: 11px;
  color: #cbd5e1;
  padding: 5px 0 8px;
  flex-shrink: 0;
  font-family: var(--acp-font);
}
#acp-footer strong { color: var(--acp-muted); }

/* ══════════════════════════════════════════════════════
   MOBILE
══════════════════════════════════════════════════════ */
@media (max-width: 440px) {
  #acp-window { width: calc(100vw - 18px); bottom: 84px; }
  #acp-window.acp-right { right: 9px; }
  #acp-window.acp-left  { left: 9px; }
  #acp-launcher.acp-right { right: 12px; bottom: 14px; }
  #acp-launcher.acp-left  { left: 12px;  bottom: 14px; }
}
