/* ── AgilityPro Chatbot Widget ───────────────────────────────────────────────
   All rules scoped to .apchat-* to avoid Bootstrap conflicts.
   Include this file on any page where the chatbot should appear,
   alongside js/chatbot.js.
   ─────────────────────────────────────────────────────────────────────────── */

.apchat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0f1f3d;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(15,31,61,0.35);
  transition: background 0.2s, transform 0.2s;
  color: #fff;
}
.apchat-toggle:hover { background: #00b09b; transform: scale(1.06); }
.apchat-toggle svg { width: 24px; height: 24px; }
.apchat-toggle .apchat-close-icon { display: none; }
.apchat-toggle.is-open .apchat-open-icon  { display: none; }
.apchat-toggle.is-open .apchat-close-icon { display: block; }

.apchat-panel {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 9998;
  width: 370px;
  max-width: calc(100vw - 40px);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15,31,61,0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Open Sans', sans-serif;
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.apchat-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.apchat-header {
  background: #0f1f3d;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.apchat-logo {
  width: 36px; height: 36px;
  background: #00b09b;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; flex-shrink: 0;
}
.apchat-header-text { flex: 1; }
.apchat-header-text strong { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.apchat-header-text span  { font-size: 11.5px; color: rgba(255,255,255,0.5); }
.apchat-status {
  width: 7px; height: 7px;
  background: #00c9b1; border-radius: 50%; flex-shrink: 0;
  animation: apchat-pulse 2.5s ease-in-out infinite;
}
@keyframes apchat-pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(0,201,177,0.2); }
  50%      { box-shadow: 0 0 0 6px rgba(0,201,177,0.08); }
}

.apchat-messages {
  background: #fff;
  min-height: 280px;
  max-height: 340px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.apchat-messages::-webkit-scrollbar { width: 4px; }
.apchat-messages::-webkit-scrollbar-thumb { background: #e8e4dc; border-radius: 2px; }

.apchat-welcome {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 10px; padding: 12px 0;
  color: #4a4a6a;
}
.apchat-welcome strong { font-size: 14px; color: #1a1a2e; }
.apchat-welcome p { font-size: 12.5px; line-height: 1.55; }
.apchat-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.apchat-chip {
  padding: 5px 11px;
  border: 1.5px solid #e8e4dc;
  border-radius: 20px;
  font-size: 12px; color: #4a4a6a;
  cursor: pointer; background: #f7f5f0;
  transition: all 0.2s;
}
.apchat-chip:hover { border-color: #00b09b; color: #00b09b; background: rgba(0,176,155,0.05); }

.apchat-msg { display: flex; gap: 8px; animation: apchat-fadeup 0.25s ease; }
@keyframes apchat-fadeup {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.apchat-msg.user { flex-direction: row-reverse; }
.apchat-av {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; margin-top: 2px;
}
.apchat-av.bot { background: linear-gradient(135deg,#00b09b,#1a3260); color: #fff; }
.apchat-av.usr { background: #e8e4dc; color: #4a4a6a; }
.apchat-bubble {
  max-width: 80%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #1a1a2e;
}
.apchat-msg.bot  .apchat-bubble { background: #f7f5f0; border: 1px solid #e8e4dc; border-top-left-radius: 3px; }
.apchat-msg.user .apchat-bubble { background: #0f1f3d; color: #fff; border-top-right-radius: 3px; }
.apchat-bubble a { color: #00b09b; }
.apchat-msg.user .apchat-bubble a { color: #00c9b1; }
.apchat-bubble p + p { margin-top: 8px; }

.apchat-typing { display: flex; gap: 8px; align-items: center; }
.apchat-dots {
  display: flex; gap: 4px; padding: 11px 14px;
  background: #f7f5f0; border: 1px solid #e8e4dc;
  border-radius: 12px; border-top-left-radius: 3px;
}
.apchat-dots span {
  width: 6px; height: 6px; background: #00b09b; border-radius: 50%;
  animation: apchat-bounce 1.3s ease-in-out infinite;
}
.apchat-dots span:nth-child(2) { animation-delay: 0.15s; }
.apchat-dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes apchat-bounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

.apchat-input-area {
  background: #fff;
  border-top: 1px solid #e8e4dc;
  padding: 10px 12px;
  display: flex; gap: 8px; align-items: flex-end;
}
.apchat-input-area textarea {
  flex: 1;
  border: 1.5px solid #e8e4dc;
  border-radius: 8px;
  padding: 8px 11px;
  font-family: 'Open Sans', sans-serif;
  font-size: 13px; color: #1a1a2e;
  resize: none; outline: none;
  background: #f7f5f0;
  min-height: 38px; max-height: 100px;
  line-height: 1.45;
  transition: border-color 0.2s;
}
.apchat-input-area textarea:focus { border-color: #00b09b; }
.apchat-input-area textarea::placeholder { color: #8888aa; }
.apchat-send {
  width: 38px; height: 38px;
  background: #00b09b; border: none; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.2s; color: #fff;
}
.apchat-send:hover:not(:disabled) { background: #00c9b1; }
.apchat-send:disabled { background: #e8e4dc; cursor: not-allowed; }
.apchat-send svg { width: 16px; height: 16px; }

.apchat-disclaimer {
  background: #fff;
  border-top: 1px solid #e8e4dc;
  padding: 6px 12px;
  text-align: center;
  font-size: 10.5px;
  color: #8888aa;
  line-height: 1.4;
}
.apchat-disclaimer a { color: #00b09b; text-decoration: none; }

.apchat-lead-confirmed {
  margin: 12px;
  background: #fff;
  border: 1.5px solid #00b09b;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  font-size: 13px;
  color: #1a1a2e;
  line-height: 1.5;
  animation: apchat-fadeup 0.4s ease;
}
.apchat-lead-confirmed .apchat-tick { font-size: 22px; display: block; margin-bottom: 6px; }
.apchat-lead-confirmed strong { color: #0f1f3d; }
.apchat-lead-confirmed a { color: #00b09b; text-decoration: none; }
