/* AiGent FAQ chatbot widget */
.aig-chat,
.aig-chat * { box-sizing: border-box; }

.aig-chat {
  --aig-grad: linear-gradient(135deg, var(--p1, #AAC8F0), var(--p2, #C9B7EF) 55%, var(--p3, #F3CDB3));
  --aig-ink: #1c1c22;
  --aig-ink-soft: #6b6b76;
  --aig-line: rgba(28,28,34,.10);
  --aig-bot-bg: #f4f3f7;
  font-family: var(--font-sans, "Instrument Sans", system-ui, sans-serif);
}

/* Floating button */
.aig-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 9998;
  width: 60px; height: 60px; border: none; border-radius: 50%;
  background: var(--aig-grad); color: #1c1c22; cursor: pointer;
  box-shadow: 0 14px 34px -10px rgba(28,28,34,.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.aig-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 18px 42px -12px rgba(28,28,34,.5); }
.aig-fab svg { width: 28px; height: 28px; }
.aig-fab .aig-x { display: none; }
.aig-chat.is-open .aig-fab .aig-chat-ico { display: none; }
.aig-chat.is-open .aig-fab .aig-x { display: block; }

/* Panel */
.aig-panel {
  position: fixed; right: 22px; bottom: 94px; z-index: 9999;
  width: 372px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 130px);
  background: #fff; border: 1px solid var(--aig-line); border-radius: 20px;
  box-shadow: 0 40px 90px -36px rgba(28,28,34,.5), 0 14px 36px -24px rgba(28,28,34,.3);
  display: none; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease;
}
.aig-chat.is-open .aig-panel { display: flex; opacity: 1; transform: translateY(0); }

.aig-head {
  background: var(--aig-grad); color: #1c1c22;
  padding: 16px 18px; display: flex; align-items: center; gap: 11px;
}
.aig-head .aig-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.55);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.aig-head .aig-avatar svg { width: 20px; height: 20px; }
.aig-head .aig-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
.aig-head .aig-sub { font-size: 12px; opacity: .72; }
.aig-head .aig-close {
  margin-left: auto; background: none; border: none; cursor: pointer; color: inherit;
  width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.aig-head .aig-close:hover { background: rgba(255,255,255,.35); }
.aig-head .aig-close svg { width: 18px; height: 18px; }

.aig-body {
  flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px;
  background: #fff;
}
.aig-msg { max-width: 84%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.aig-msg.bot { align-self: flex-start; background: var(--aig-bot-bg); color: var(--aig-ink); border-bottom-left-radius: 5px; }
.aig-msg.bot strong { font-weight: 700; }
.aig-msg.bot a { color: #4f5bbf; text-decoration: underline; }
.aig-msg.bot a:hover { opacity: .8; }
.aig-msg.user { align-self: flex-end; background: var(--aig-ink); color: #fff; border-bottom-right-radius: 5px; }

.aig-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.aig-suggest button {
  border: 1px solid var(--aig-line); background: #fff; color: var(--aig-ink);
  border-radius: 999px; padding: 7px 12px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; transition: background .15s ease, border-color .15s ease;
}
.aig-suggest button:hover { background: var(--aig-bot-bg); border-color: rgba(28,28,34,.2); }

.aig-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: var(--aig-bot-bg); border-radius: 14px; border-bottom-left-radius: 5px; }
.aig-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b6b6c0; animation: aig-bounce 1.2s infinite; }
.aig-typing i:nth-child(2) { animation-delay: .18s; }
.aig-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes aig-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.aig-foot { border-top: 1px solid var(--aig-line); padding: 12px; display: flex; gap: 8px; align-items: flex-end; background: #fff; }
.aig-foot textarea {
  flex: 1; resize: none; border: 1px solid var(--aig-line); border-radius: 12px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; color: var(--aig-ink);
  max-height: 110px; line-height: 1.4; outline: none;
}
.aig-foot textarea:focus { border-color: color-mix(in oklab, var(--p2, #C9B7EF) 70%, var(--aig-line)); }
.aig-send {
  flex: none; width: 42px; height: 42px; border: none; border-radius: 12px; cursor: pointer;
  background: var(--aig-grad); color: #1c1c22; display: flex; align-items: center; justify-content: center;
}
.aig-send:disabled { opacity: .5; cursor: default; }
.aig-send svg { width: 19px; height: 19px; }

.aig-foot-note { font-size: 10.5px; color: var(--aig-ink-soft); text-align: center; padding: 0 12px 9px; background: #fff; }

@media (max-width: 480px) {
  .aig-panel { right: 8px; left: 8px; width: auto; bottom: 86px; height: calc(100vh - 110px); }
  .aig-fab { right: 16px; bottom: 16px; }
}
