/* ==========================================================
   Avennex — assistant
   Same widget, same conversation. The mascot is gone; the
   trigger and panel now speak the page's own language.
   ========================================================== */

.chatbot-panel {
  position: fixed;
  box-sizing: border-box;
  right: 22px;
  bottom: 22px;
  z-index: 190;
  width: min(392px, calc(100vw - 28px));
  /* a fixed height, so the panel keeps its size as the conversation grows */
  height: min(620px, calc(100vh - 44px));
  display: none;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 24px 64px rgba(16, 18, 22, 0.22);
}
.chatbot-panel.open { display: flex; }

/* the trigger steps aside while the panel is up */
.chatbot-trigger.trigger-closing { opacity: 0; pointer-events: none; }

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 14px 18px;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
  color: var(--panel-ink);
}
.chatbot-header-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--label);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.chatbot-header-title::before {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--mark-lit);
  flex: none;
}
.chatbot-close {
  color: var(--panel-ink-2);
  padding: 4px;
  transition: color var(--t-fast) var(--ease);
}
.chatbot-close:hover { color: var(--panel-ink); }

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.chatbot-msg {
  overflow-wrap: anywhere;
  font-size: 0.93rem;
  line-height: 1.6;
  letter-spacing: -0.008em;
  max-width: 92%;
}
.chatbot-msg-bot {
  align-self: flex-start;
  color: var(--ink);
  padding: 11px 14px;
  background: var(--royal-soft);
  border: 1px solid rgba(182, 156, 255, 0.24);
}
.chatbot-msg-user {
  align-self: flex-end;
  color: var(--ink);
  padding: 11px 14px;
  background: var(--paper-2);
  border: 1px solid var(--hair);
}
.chatbot-msg-sources {
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 8px;
}

.chatbot-typing { display: flex; gap: 5px; align-items: center; }
.chatbot-typing span {
  width: 4px;
  height: 4px;
  background: var(--ink-3);
  animation: chatbot-blink 1.2s steps(1) infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbot-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.2; } }
@media (prefers-reduced-motion: reduce) { .chatbot-typing span { animation: none; } }

.chatbot-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 18px 14px;
}
.chatbot-suggestions button {
  text-align: left;
  font-size: 0.88rem;
  letter-spacing: -0.008em;
  color: var(--ink-2);
  padding-block: 11px;
  border-top: 1px solid var(--hair);
  transition: color var(--t-fast) var(--ease), padding-left var(--t-fast) var(--ease-out);
}
.chatbot-suggestions button:hover { color: var(--ink); padding-left: 6px; }

.chatbot-suggestions.is-chips {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 7px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.chatbot-suggestions.is-chips::-webkit-scrollbar { display: none; }
.chatbot-suggestions.is-chips.is-dragging { cursor: grabbing; user-select: none; }
.chatbot-suggestions.is-chips.is-dragging button { pointer-events: none; }
.chatbot-suggestions.is-chips button {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 11px;
  border: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  font-family: var(--label);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.chatbot-suggestions.is-chips button:hover { padding-left: 11px; border-color: var(--ink); }

.chatbot-input-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-top: 1px solid var(--rule);
}
.chatbot-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  padding: 17px 0;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.chatbot-input::placeholder { color: var(--ink-3); }
.chatbot-input:focus { outline: 0; }
.chatbot-send {
  flex: none;
  color: var(--ink-3);
  padding: 6px;
  transition: color var(--t-fast) var(--ease);
}
.chatbot-send:hover { color: var(--ink); }

/* the opening line, set as a note rather than a speech bubble */
.chatbot-greeting {
  position: fixed;
  right: 22px;
  bottom: 74px;
  z-index: 185;
  max-width: 262px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 15px;
  background: var(--paper-2);
  border: 1px solid rgba(182, 156, 255, 0.4);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(7px);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease-out);
  pointer-events: none;
}
.chatbot-greeting.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.chatbot-greeting-text {
  font-size: 0.88rem;
  line-height: 1.5;
  letter-spacing: -0.008em;
  color: var(--ink-2);
}
.chatbot-greeting-close {
  flex: none;
  color: var(--ink-3);
  padding: 2px;
  margin: -2px -4px 0 0;
}
.chatbot-greeting-close:hover { color: var(--ink); }

@media (max-width: 720px) {
  .chatbot-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 84svh;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
  .chatbot-greeting { right: 14px; bottom: 66px; max-width: calc(100vw - 28px); }
}

.chatbot-wave {
  display: inline-block;
  margin-right: 6px;
  transform-origin: 70% 80%;
}
.chatbot-wave.is-waving { animation: chatbot-wave 1.4s ease-in-out 0.25s 1; }
@keyframes chatbot-wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(16deg); }
  20% { transform: rotate(-10deg); }
  40% { transform: rotate(-6deg); }
  50% { transform: rotate(10deg); }
}
@media (prefers-reduced-motion: reduce) {
  .chatbot-wave.is-waving { animation: none; }
}
