/* ============================================================
   24/7 Assistant — Chat Widget Styles
   ============================================================ */

/* Launcher CSS — two layers of defence:
   1. These !important rules beat any theme/plugin stylesheet regardless of specificity.
   2. JS (applyBrandColor) also applies the same values as *inline* !important, which
      beats stylesheet !important. A MutationObserver reapplies them if wiped.
   The CSS layer covers the rare race where a script wipes element.style before
   the observer fires. */
#asst-launcher {
  position:         fixed   !important;
  bottom:           24px    !important;
  right:            24px    !important;
  width:            56px    !important;
  height:           56px    !important;
  min-width:        56px    !important;
  min-height:       56px    !important;
  border-radius:    50%     !important;
  background:       #4f46e5 !important;
  border:           none    !important;
  outline:          none    !important;
  padding:          0       !important;
  margin:           0       !important;
  cursor:           pointer !important;
  display:          flex    !important;
  visibility:       visible !important;
  opacity:          1       !important;
  align-items:      center  !important;
  justify-content:  center  !important;
  box-shadow:       0 4px 20px rgba(79,70,229,.5);
  z-index:          2147483647 !important;
  transition:       transform .2s ease, box-shadow .2s ease;
  pointer-events:   auto    !important;
  clip-path:        none    !important;
  overflow:         visible !important;
  box-sizing:       content-box !important;
  flex-shrink:      0       !important;
  text-decoration:  none    !important;
  line-height:      1       !important;
}
/* Hover is handled by JS mouseenter/mouseleave (CSS :hover can't override inline !important). */
#asst-launcher img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
#asst-launcher svg { width: 26px; height: 26px; }
#asst-launcher .asst-launcher-logo { width: 100% !important; height: 100% !important; border-radius: 50% !important; object-fit: cover !important; }

/* ── Window ─────────────────────────────────────────────── */
#asst-window {
  position: fixed !important;
  bottom: 92px !important;
  right: 24px !important;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  z-index: 2147483646 !important;
  overflow: hidden;
  transition: opacity .22s, transform .22s;
  transform-origin: bottom right;
  visibility: visible !important;
}
#asst-window.hidden {
  opacity: 0 !important;
  transform: scale(.92) translateY(12px);
  pointer-events: none !important;
  visibility: hidden !important;
}

/* ── Header ─────────────────────────────────────────────── */
#asst-header {
  background: #1e1b4b;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#asst-header-logo {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  display: none;
  flex-shrink: 0;
}
.asst-header-icon {
  width: 34px; height: 34px;
  background: #4f46e5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#asst-bot-name { font-size: 15px; font-weight: 700; flex: 1; }
.asst-status {
  font-size: 11px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 5px;
}
.asst-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

#asst-header-btns { display: flex; gap: 6px; }
.asst-icon-btn {
  background: rgba(255,255,255,.12);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.asst-icon-btn:hover { background: rgba(255,255,255,.22); }

/* ── Lead capture form ───────────────────────────────────── */
#asst-capture {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#asst-capture h4 { font-size: 15px; font-weight: 700; color: #1e293b; }
#asst-capture p  { font-size: 13px; color: #64748b; }
.capture-field { display: flex; flex-direction: column; gap: 5px; }
.capture-field label { font-size: 13px; font-weight: 600; color: #374151; }
.capture-field input {
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.capture-field input:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.btn-start-chat {
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 11px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: background .15s;
  font-family: inherit;
}
.btn-start-chat:hover { background: #4338ca; }

/* ── Messages ────────────────────────────────────────────── */
#asst-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.asst-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
}
.asst-msg.bot  { align-self: flex-start; }
.asst-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.asst-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  overflow: hidden;
}
.asst-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.asst-msg-avatar svg { width: 15px; height: 15px; }

.asst-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 100%;
  word-wrap: break-word;
}
.asst-msg.bot  .asst-bubble { background: #f1f5f9; color: #1e293b; border-bottom-left-radius: 4px; }
.asst-msg.user .asst-bubble { background: #4f46e5; color: #fff;    border-bottom-right-radius: 4px; }

/* ── Typing indicator ────────────────────────────────────── */
.asst-typing { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.asst-typing span {
  width: 7px; height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: asst-bounce .9s ease-in-out infinite;
}
.asst-typing span:nth-child(2) { animation-delay: .15s; }
.asst-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes asst-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

/* ── Follow-up chips ─────────────────────────────────────── */
#asst-followups {
  padding: 0 14px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex-shrink: 0;
}
.asst-chip {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
}
.asst-chip:hover { background: #e0e7ff; }

/* ── Input area ──────────────────────────────────────────── */
#asst-input-area {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #f1f5f9;
  flex-shrink: 0;
}
#asst-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10.5px 14px !important;
  font-size: 14px;
  line-height: 21px !important;
  font-family: inherit;
  resize: none;
  box-sizing: border-box !important;
  min-height: 44px !important;
  max-height: 120px;
  color: #1e293b;
  transition: border-color .18s;
  overflow-y: auto;
}
#asst-input:focus { outline: none; border-color: #4f46e5; }
#asst-send {
  flex: 0 0 auto;
  width: 40px;
  height: 44px;
  background: #4f46e5;
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
#asst-send:hover  { background: #4338ca; }
#asst-send:disabled { background: #e2e8f0; cursor: default; }

/* ── Bot message formatting ──────────────────────────────── */
.asst-bot-content p { margin: 0 0 6px; }
.asst-bot-content p:last-child { margin-bottom: 0; }
.asst-bot-content ul,
.asst-bot-content ol { margin: 4px 0 6px; padding-left: 18px; }
.asst-bot-content li { margin: 3px 0; }
.asst-bot-content ul:last-child,
.asst-bot-content ol:last-child { margin-bottom: 0; }

/* ── Links in bot messages ───────────────────────────────── */
.asst-link {
  color: #4f46e5;
  text-decoration: underline;
  word-break: break-all;
}
.asst-link:hover { opacity: .8; }

/* ── Lead capture skip button ────────────────────────────── */
.asst-skip-btn {
  background: transparent;
  border: 1px solid #4f46e5;
  color: #4f46e5;
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  align-self: center;
  transition: background .15s;
}
.asst-skip-btn:hover { background: rgba(79,70,229,.06); }

/* ── Bottom wrapper (input + powered-by) ────────────────── */
#asst-bottom { flex-shrink: 0; }

/* ── Powered by footer ──────────────────────────────────── */
#asst-powered-by {
  text-align: center;
  padding: 5px 12px 7px;
  flex-shrink: 0;
  background: #fff;
}
#asst-powered-by a {
  font-size: 11px;
  color: #94a3b8;
  text-decoration: none;
}
#asst-powered-by a:hover { color: #64748b; text-decoration: underline; }

/* Mobile — launcher position handled by JS resize listener; only window needs CSS */
@media (max-width: 420px) {
  #asst-window { width: calc(100vw - 16px) !important; right: 8px !important; bottom: 80px !important; }
}
