/* rag-chat.css — floating RAG chat widget */

.rag-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

/* ── Toggle button ── */
.rag-chat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--navy, #0A1628);
  color: #fff;
  border: none;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(10, 22, 40, .35);
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.rag-chat-toggle:hover  { background: #1a2d4a; }
.rag-chat-toggle:active { transform: scale(.97); }

/* ── Chat panel ── */
.rag-chat-panel {
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 480px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(10, 22, 40, .18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
.rag-chat-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--navy, #0A1628);
  color: #fff;
  flex-shrink: 0;
}
.rag-chat-hdr__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rag-chat-hdr__info strong { font-size: 14px; }
.rag-chat-hdr__sub {
  font-size: 11px;
  color: rgba(255, 255, 255, .65);
}
.rag-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, .75);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
}
.rag-chat-close:hover { color: #fff; background: rgba(255, 255, 255, .1); }

/* ── Messages ── */
.rag-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.rag-msg { max-width: 88%; }
.rag-msg--user {
  align-self: flex-end;
  background: var(--navy, #0A1628);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  padding: 9px 13px;
}
.rag-msg--bot {
  align-self: flex-start;
  background: var(--bg-off, #F7F8FA);
  color: var(--navy, #0A1628);
  border-radius: 4px 14px 14px 14px;
  padding: 9px 13px;
}
.rag-msg p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Loading dots */
.rag-msg--loading {
  padding: 12px 16px;
  min-width: 54px;
}
.rag-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.rag-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--navy, #0A1628);
  opacity: .35;
  animation: rag-pulse 1.2s infinite;
}
.rag-dots span:nth-child(2) { animation-delay: .2s; }
.rag-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes rag-pulse {
  0%, 80%, 100% { opacity: .25; transform: scale(.85); }
  40%            { opacity: .9;  transform: scale(1);   }
}

/* ── Input form ── */
.rag-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #e5e7eb);
  flex-shrink: 0;
}
.rag-chat-input {
  flex: 1;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-body, 'Inter', sans-serif);
  color: var(--navy, #0A1628);
  background: var(--bg-off, #F7F8FA);
  outline: none;
  transition: border-color .15s;
}
.rag-chat-input:focus  { border-color: var(--navy, #0A1628); background: #fff; }
.rag-chat-submit {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--navy, #0A1628);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.rag-chat-submit:hover    { background: #1a2d4a; }
.rag-chat-submit:disabled { background: #9ca3af; cursor: not-allowed; }

/* ── Disclaimer ── */
.rag-chat-disclaimer {
  margin: 0;
  padding: 5px 14px 8px;
  font-size: 10px;
  color: var(--text-dim, #9ca3af);
  flex-shrink: 0;
}
.rag-chat-disclaimer a { color: inherit; }

/* ── Mobile ── */
@media (max-width: 480px) {
  .rag-chat-widget { bottom: 16px; right: 16px; }
  .rag-chat-toggle__lbl { display: none; }
  .rag-chat-toggle { padding: 14px; border-radius: 50%; }
  .rag-chat-panel {
    position: fixed;
    bottom: 76px;
    right: 16px;
    left: 16px;
    width: auto;
    height: calc(100vh - 112px);
  }
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .rag-dots span { animation: none; opacity: .5; }
}
