/* ===============================================================
   AI CHATBOT (mockup, presentation only)
   Floating bottom-right launcher + slide-up chat panel.
   Branded to match the RDMS site: cream paper, tricolor letterhead
   stripe, Georgia title, cooperative-green accents. Knowledge
   source is the .faq__item entries already in the FAQ section.
   =============================================================== */

/* Floating launcher — bottom-right pill, cooperative-green. */
.chatbot-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9990;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 14px 18px;
  border: 0;
  border-radius: 999px;
  background: #58cc6f;
  color: #0a2a18;
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition:
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 200ms ease-out,
    box-shadow 240ms ease-out;
}
.chatbot-launcher:hover {
  background: #1f6b3a;
  color: #f6f3ec;
  transform: translateY(-2px);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.34),
    0 0 0 4px rgba(88, 204, 111, 0.22);
}
.chatbot-launcher:focus-visible {
  outline: 2px solid #1f6b3a;
  outline-offset: 4px;
}
.chatbot-launcher.is-open {
  transform: scale(0.85);
  opacity: 0;
  pointer-events: none;
}
/* Tucked away while the footer is in view so it doesn't sit on top of
   the signature line (partner logos, copyright, Made-in-Rwanda coin).
   Slides down + fades; click target removed so it can't intercept
   footer links. */
.chatbot-launcher.is-tucked {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}
.chatbot-launcher__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
.chatbot-launcher__icon svg {
  width: 100%;
  height: 100%;
}

/* Chat panel — slide up from bottom-right. */
.chatbot-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: min(400px, calc(100vw - 40px));
  max-height: min(640px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  z-index: 9991;
  background: #f6f3ec;
  color: #2a2a2a;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.32),
    0 8px 24px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition:
    opacity 280ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.chatbot-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header — tricolor letterhead stripe + brand row. */
.chatbot-panel__stripe {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.chatbot-panel__stripe-bar {
  display: block;
  width: 100%;
}
.chatbot-panel__stripe-bar--blue {
  height: 4px;
  background: #00a1de;
}
.chatbot-panel__stripe-bar--yellow {
  height: 3px;
  background: #fad201;
}
.chatbot-panel__stripe-bar--green {
  height: 3px;
  background: #20603d;
}
.chatbot-panel__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #ece6d6;
  border-bottom: 1px solid rgba(10, 10, 10, 0.1);
}
.chatbot-panel__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.chatbot-panel__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: #f6f3ec;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.chatbot-panel__avatar img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}
.chatbot-panel__brand-text {
  min-width: 0;
}
.chatbot-panel__title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 400;
  color: #0a0a0a;
  margin: 0;
  letter-spacing: -0.005em;
}
.chatbot-panel__status {
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 11px;
  color: #4a4a4a;
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chatbot-panel__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #58cc6f;
  box-shadow: 0 0 0 3px rgba(88, 204, 111, 0.2);
  flex: none;
}
.chatbot-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #4a4a4a;
  cursor: pointer;
  transition: background-color 200ms ease-out, color 200ms ease-out;
}
.chatbot-panel__close:hover {
  background: rgba(10, 10, 10, 0.08);
  color: #0a0a0a;
}
.chatbot-panel__close:focus-visible {
  outline: 2px solid #1f6b3a;
  outline-offset: 2px;
}
.chatbot-panel__close svg {
  width: 18px;
  height: 18px;
}

/* Body — scrollable message log. */
.chatbot-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.chatbot-panel__body::-webkit-scrollbar {
  width: 6px;
}
.chatbot-panel__body::-webkit-scrollbar-thumb {
  background: rgba(10, 10, 10, 0.18);
  border-radius: 3px;
}

/* Messages. */
.chatbot-msg {
  display: flex;
  gap: 8px;
  max-width: 92%;
  animation: chatbotMsgIn 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes chatbotMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chatbot-msg--bot {
  align-self: flex-start;
}
.chatbot-msg--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chatbot-msg__bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.chatbot-msg--bot .chatbot-msg__bubble {
  background: #ffffff;
  color: #2a2a2a;
  border: 1px solid rgba(10, 10, 10, 0.08);
  border-bottom-left-radius: 4px;
}
.chatbot-msg--user .chatbot-msg__bubble {
  background: #58cc6f;
  color: #0a2a18;
  border-bottom-right-radius: 4px;
}
.chatbot-msg__bubble a {
  color: #1f6b3a;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chatbot-msg--user .chatbot-msg__bubble a {
  color: #0a2a18;
  text-decoration-color: rgba(10, 42, 24, 0.4);
}

/* Suggestion chips (under bot welcome, after answers). */
.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  padding-left: 0;
}
.chatbot-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid rgba(31, 107, 58, 0.3);
  border-radius: 999px;
  background: rgba(246, 243, 236, 0.6);
  color: #1f6b3a;
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition:
    background-color 200ms ease-out,
    border-color 200ms ease-out,
    color 200ms ease-out;
}
.chatbot-chip:hover {
  background: #1f6b3a;
  border-color: #1f6b3a;
  color: #f6f3ec;
}
.chatbot-chip:focus-visible {
  outline: 2px solid #1f6b3a;
  outline-offset: 2px;
}

/* Typing indicator (3 bouncing dots). */
.chatbot-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}
.chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4a4a4a;
  opacity: 0.4;
  animation: chatbotTypingDot 1.2s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatbotTypingDot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-3px); }
}

/* Footer (input + disclaimer). */
.chatbot-panel__footer {
  border-top: 1px solid rgba(10, 10, 10, 0.1);
  padding: 10px 16px 14px;
  background: #ece6d6;
}
.chatbot-panel__disclaimer {
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 11px;
  color: #4a4a4a;
  margin: 0 0 8px;
  line-height: 1.4;
}
.chatbot-panel__disclaimer a {
  color: #1f6b3a;
  text-decoration: underline;
}

.chatbot-input {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.chatbot-input__field {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid rgba(10, 10, 10, 0.18);
  border-radius: 999px;
  background: #f6f3ec;
  font-family: 'Google Sans', system-ui, sans-serif;
  font-size: 14px;
  color: #0a0a0a;
  transition: border-color 200ms ease-out, box-shadow 200ms ease-out;
}
.chatbot-input__field::placeholder {
  color: #7a7a7a;
}
.chatbot-input__field:focus {
  outline: 0;
  border-color: #1f6b3a;
  box-shadow: 0 0 0 3px rgba(31, 107, 58, 0.18);
}
.chatbot-input__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 50%;
  background: #58cc6f;
  color: #0a2a18;
  cursor: pointer;
  transition: background-color 200ms ease-out, transform 200ms ease-out;
}
.chatbot-input__send:hover {
  background: #1f6b3a;
  color: #f6f3ec;
  transform: translateY(-1px);
}
.chatbot-input__send:focus-visible {
  outline: 2px solid #1f6b3a;
  outline-offset: 2px;
}
.chatbot-input__send svg {
  width: 18px;
  height: 18px;
}
.chatbot-input__send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Mobile — full screen panel, smaller launcher. */
@media (max-width: 600px) {
  .chatbot-launcher {
    bottom: 16px;
    right: 16px;
    padding: 14px;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    gap: 0;
  }
  .chatbot-launcher__label {
    display: none;
  }
  .chatbot-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: auto;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-launcher,
  .chatbot-panel,
  .chatbot-msg,
  .chatbot-typing span {
    transition: none !important;
    animation: none !important;
  }
}
