/* public/chatbot.css
   Floating chatbot bubble + panel. All classes are prefixed .aspi-chat- so
   nothing in the SPA can collide with them. Matches primary #2B4BE0 and
   the Plus Jakarta Sans font already loaded by index.html. */

:root {
  --aspi-chat-primary: #2B4BE0;
  --aspi-chat-primary-dark: #1e3ac0;
  --aspi-chat-bg: #ffffff;
  --aspi-chat-fg: #16233c;
  --aspi-chat-muted: #6a7488;
  --aspi-chat-line: #e5e8ef;
  --aspi-chat-bot-bg: #f2f4f9;
  --aspi-chat-shadow: 0 8px 32px rgba(16, 24, 48, 0.16);
}
[data-theme="dark"] {
  --aspi-chat-bg: #1a1f2c;
  --aspi-chat-fg: #ecf1fa;
  --aspi-chat-muted: #8891a5;
  --aspi-chat-line: #2b3244;
  --aspi-chat-bot-bg: #232a3a;
  --aspi-chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* -------------------- floating bubble -------------------- */
.aspi-chat-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--aspi-chat-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--aspi-chat-shadow);
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.aspi-chat-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(43, 75, 224, 0.35);
}
.aspi-chat-bubble svg {
  width: 28px;
  height: 28px;
  display: block;
}
.aspi-chat-bubble[data-open="true"] { display: none; }

/* Unread indicator (small red dot) */
.aspi-chat-bubble[data-unread="true"]::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff4a4a;
  border: 2px solid var(--aspi-chat-primary);
}

/* -------------------- panel -------------------- */
.aspi-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 40px);
  background: var(--aspi-chat-bg);
  color: var(--aspi-chat-fg);
  border-radius: 16px;
  box-shadow: var(--aspi-chat-shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
.aspi-chat-panel[data-open="true"] { display: flex; }

@media (max-width: 600px) {
  .aspi-chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 75vh;
    max-height: 75vh;
    border-radius: 16px 16px 0 0;
  }
}

/* -------------------- header -------------------- */
.aspi-chat-head {
  background: var(--aspi-chat-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.aspi-chat-head-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  margin: 0;
}
.aspi-chat-head-sub {
  font-size: 11.5px;
  opacity: 0.85;
  margin-top: 2px;
  line-height: 1.2;
}
.aspi-chat-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aspi-chat-close:hover { background: rgba(255, 255, 255, 0.28); }

/* -------------------- message list -------------------- */
.aspi-chat-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--aspi-chat-bg);
}
.aspi-chat-list::-webkit-scrollbar { width: 6px; }
.aspi-chat-list::-webkit-scrollbar-thumb { background: var(--aspi-chat-line); border-radius: 6px; }

/* Message bubbles */
.aspi-chat-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  animation: aspi-chat-fadein 0.15s ease;
}
@keyframes aspi-chat-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.aspi-chat-msg-user {
  background: var(--aspi-chat-primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.aspi-chat-msg-bot {
  background: var(--aspi-chat-bot-bg);
  color: var(--aspi-chat-fg);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Link chips under a bot message */
.aspi-chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.aspi-chat-link {
  display: inline-block;
  padding: 6px 10px;
  background: #fff;
  color: var(--aspi-chat-primary);
  border: 1px solid var(--aspi-chat-primary);
  border-radius: 999px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.12s ease, color 0.12s ease;
}
.aspi-chat-link:hover {
  background: var(--aspi-chat-primary);
  color: #fff;
}
[data-theme="dark"] .aspi-chat-link {
  background: transparent;
  color: #7ea1ff;
  border-color: #7ea1ff;
}

/* Feedback row */
.aspi-chat-feedback {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  align-self: flex-start;
  padding-left: 4px;
}
.aspi-chat-fb-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--aspi-chat-muted);
  opacity: 0.7;
  transition: opacity 0.12s ease, background 0.12s ease;
}
.aspi-chat-fb-btn:hover { opacity: 1; background: var(--aspi-chat-bot-bg); }
.aspi-chat-fb-btn.selected { opacity: 1; color: var(--aspi-chat-primary); }

/* Suggestion chips */
.aspi-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 4px 0;
  align-self: stretch;
}
.aspi-chat-chip {
  padding: 6px 11px;
  background: transparent;
  border: 1px solid var(--aspi-chat-line);
  color: var(--aspi-chat-fg);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12.5px;
  font-family: inherit;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.aspi-chat-chip:hover {
  border-color: var(--aspi-chat-primary);
  background: rgba(43, 75, 224, 0.06);
}

/* Typing indicator */
.aspi-chat-typing {
  display: inline-flex;
  gap: 3px;
  padding: 10px 14px;
  background: var(--aspi-chat-bot-bg);
  border-radius: 14px;
  align-self: flex-start;
}
.aspi-chat-typing span {
  width: 6px; height: 6px; background: var(--aspi-chat-muted);
  border-radius: 50%; display: inline-block;
  animation: aspi-chat-bounce 1.2s infinite ease-in-out;
}
.aspi-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.aspi-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aspi-chat-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

/* Lead capture (email form) */
.aspi-chat-lead {
  align-self: stretch;
  margin-top: 4px;
  padding: 12px;
  background: var(--aspi-chat-bot-bg);
  border-radius: 12px;
  border: 1px dashed var(--aspi-chat-line);
}
.aspi-chat-lead-label {
  font-size: 12px;
  color: var(--aspi-chat-muted);
  margin: 0 0 6px;
}
.aspi-chat-lead-row {
  display: flex;
  gap: 6px;
}
.aspi-chat-lead input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--aspi-chat-line);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--aspi-chat-bg);
  color: var(--aspi-chat-fg);
  outline: none;
}
.aspi-chat-lead input:focus { border-color: var(--aspi-chat-primary); }
.aspi-chat-lead button {
  padding: 8px 14px;
  background: var(--aspi-chat-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.aspi-chat-lead button:hover { background: var(--aspi-chat-primary-dark); }
.aspi-chat-lead button:disabled { opacity: 0.6; cursor: not-allowed; }
.aspi-chat-lead-msg {
  font-size: 12px;
  margin-top: 6px;
}
.aspi-chat-lead-msg.err { color: #d02020; }
.aspi-chat-lead-msg.ok  { color: #1e8e3e; }

/* -------------------- input bar -------------------- */
.aspi-chat-input {
  border-top: 1px solid var(--aspi-chat-line);
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--aspi-chat-bg);
  flex-shrink: 0;
}
.aspi-chat-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--aspi-chat-line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--aspi-chat-bg);
  color: var(--aspi-chat-fg);
  max-height: 100px;
  min-height: 38px;
  line-height: 1.35;
}
.aspi-chat-input textarea:focus { border-color: var(--aspi-chat-primary); }
.aspi-chat-send {
  background: var(--aspi-chat-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 42px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s ease;
}
.aspi-chat-send:hover  { background: var(--aspi-chat-primary-dark); }
.aspi-chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.aspi-chat-send svg { width: 18px; height: 18px; }

/* -------------------- footer -------------------- */
.aspi-chat-foot {
  padding: 6px 12px 8px;
  font-size: 10.5px;
  color: var(--aspi-chat-muted);
  text-align: center;
  background: var(--aspi-chat-bg);
  border-top: 1px solid var(--aspi-chat-line);
  flex-shrink: 0;
}
