/* Matching styles are also injected by the widget. */

/* === UniFund SA chatbot widget === */
#ufs-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9100;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0E6E5C 0%, #0A4A3E 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(14,110,92,0.42);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  outline: none;
}
#ufs-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(14,110,92,0.55);
}
#ufs-toggle-btn:focus-visible {
  outline: 3px solid #C6963A;
  outline-offset: 3px;
}

#ufs-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 9100;
  width: 360px;
  max-height: 560px;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(22,36,31,0.24), 0 4px 16px rgba(22,36,31,0.10);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13.5px;
  color: #24312B;
  background: #F4F1E9;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateY(0);
  opacity: 1;
}
#ufs-panel.ufs-closed {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
}

/* Header */
#ufs-header {
  background: linear-gradient(118deg, #0A4A3E 0%, #0E6E5C 100%);
  color: #F5EFDD;
  padding: 13px 14px 13px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}
.ufs-logo { flex-shrink: 0; }
.ufs-header-text { flex: 1; line-height: 1.35; }
.ufs-header-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.1px;
}
.ufs-header-sub {
  font-size: 11px;
  opacity: 0.78;
  margin-top: 1px;
}
#ufs-close-btn {
  background: rgba(255,255,255,0.14);
  border: none;
  color: #F5EFDD;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  outline: none;
}
#ufs-close-btn:hover  { background: rgba(255,255,255,0.28); }
#ufs-close-btn:focus-visible { outline: 2px solid #C6963A; }

/* Messages */
#ufs-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#ufs-messages::-webkit-scrollbar { width: 4px; }
#ufs-messages::-webkit-scrollbar-track { background: transparent; }
#ufs-messages::-webkit-scrollbar-thumb { background: #C9C3B4; border-radius: 4px; }

.ufs-bubble {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 13px;
  word-break: break-word;
  white-space: pre-wrap;
}
.ufs-user {
  background: #0E6E5C;
  color: #FFFFFF;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.ufs-bot {
  background: #FFFFFF;
  color: #24312B;
  align-self: flex-start;
  border: 1px solid #EBE5D5;
  border-bottom-left-radius: 3px;
}
.ufs-error {
  background: #FBEAE6;
  color: #8A2E23;
  align-self: flex-start;
  border: 1px solid #EBC6BC;
  border-bottom-left-radius: 3px;
  font-size: 12.5px;
}

/* Typing indicator */
#ufs-typing {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid #EBE5D5;
  border-radius: 14px;
  border-bottom-left-radius: 3px;
  padding: 10px 14px;
  display: none;
  gap: 5px;
  align-items: center;
}
#ufs-typing.ufs-active { display: flex; }
.ufs-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0E6E5C;
  opacity: 0.3;
  animation: ufs-pulse 1.2s infinite ease-in-out;
}
.ufs-dot:nth-child(2) { animation-delay: 0.2s; }
.ufs-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ufs-pulse {
  0%,80%,100% { opacity: 0.25; transform: scale(0.9); }
  40%         { opacity: 1;    transform: scale(1.1); }
}

/* Input area */
#ufs-input-row {
  border-top: 1px solid #E1DAC7;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  background: #FFFFFF;
  flex-shrink: 0;
  align-items: flex-end;
}
#ufs-input {
  flex: 1;
  border: 1.5px solid #E1DAC7;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #24312B;
  background: #F6F3EB;
  resize: none;
  outline: none;
  line-height: 1.45;
  max-height: 88px;
  overflow-y: auto;
  transition: border-color 0.15s, background 0.15s;
}
#ufs-input:focus { border-color: #0E6E5C; background: #FFFFFF; }
#ufs-input::placeholder { color: #A09C90; }

#ufs-send-btn {
  background: #0E6E5C;
  color: #FFFFFF;
  border: none;
  border-radius: 9px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  outline: none;
}
#ufs-send-btn:hover:not(:disabled)  { background: #0A4A3E; }
#ufs-send-btn:focus-visible { outline: 2px solid #C6963A; }
#ufs-send-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Footer */
#ufs-footer {
  text-align: center;
  font-size: 10.5px;
  color: #8A9488;
  padding: 5px 0 8px;
  background: #FFFFFF;
  flex-shrink: 0;
  letter-spacing: 0.1px;
}

/* Responsive */
@media (max-width: 420px) {
  #ufs-panel       { width: calc(100vw - 20px); right: 10px; bottom: 80px; }
  #ufs-toggle-btn  { bottom: 16px; right: 16px; }
}

/* Accessible, compact layout with a configurable offset above site navigation. */
#ufs-panel, #ufs-panel *, #ufs-toggle-btn { box-sizing: border-box; }
#ufs-panel { width: min(390px, calc(100vw - 24px)); height: 590px; max-height: calc(100dvh - 130px - var(--ufs-bottom-offset, 0px)); bottom: calc(92px + var(--ufs-bottom-offset, 0px)); right: 20px; background:#f5f8f6; border:1px solid #dce7e0; border-radius:22px; }
#ufs-panel.ufs-closed { visibility:hidden; }
#ufs-toggle-btn { bottom:calc(22px + var(--ufs-bottom-offset, 0px)); right:20px; }
#ufs-header { padding:18px 16px; background:#094c3d; }
.ufs-header-title { font-size:15px; }
.ufs-header-sub { opacity:1; color:#c9e5d8; font-size:12px; margin-top:4px; }
#ufs-close-btn { width:36px; height:36px; }
#ufs-messages { min-height:0; padding:18px 14px; gap:14px; overscroll-behavior:contain; }
.ufs-bubble { font-size:14px; line-height:1.6; padding:12px 14px; max-width:90%; }
.ufs-bot { border-color:#e0e9e3; box-shadow:0 2px 4px #163c2510; }
.ufs-bubble a { color:inherit; text-decoration:underline; text-underline-offset:3px; }
#ufs-input { font-size:16px; min-width:0; background:#f7faf8; border-color:#c8d8ce; }
#ufs-input::placeholder { color:#66776c; }
#ufs-send-btn { width:44px; height:44px; }
#ufs-footer { color:#59695f; font-size:11px; padding:8px 12px 12px; line-height:1.5; }
#ufs-topic-label { font-size:11px; font-weight:600; color:#52685a; padding:8px 14px 6px; }
#ufs-shortcuts { display:flex; flex-wrap:wrap; gap:6px; padding:0 14px 12px; max-height:120px; overflow-y:auto; flex-shrink:0; }
.ufs-chip { background:#fff; color:#175e47; border:1px solid #c7dbcf; border-radius:20px; padding:8px 11px; min-height:36px; cursor:pointer; font:inherit; font-size:12px; }
.ufs-chip:hover { background:#eaf4ee; }
.ufs-chip:disabled { opacity:.5; cursor:wait; }
#ufs-toolbar { display:flex; justify-content:space-between; align-items:center; padding:6px 14px; border-bottom:1px solid #e0e9e3; background:#fff; }
#ufs-toolbar button, #ufs-toolbar a { font:inherit; font-size:12px; color:#175e47; background:none; border:0; padding:8px 0; cursor:pointer; text-decoration:underline; text-underline-offset:3px; }
#ufs-panel :focus-visible { outline:3px solid #bd8b2b; outline-offset:2px; }
.ufs-retry { display:block; margin-top:8px; color:inherit; background:#fff; border:1px solid currentColor; border-radius:6px; padding:7px 12px; font:inherit; cursor:pointer; }
#ufs-status { font-size:11px; color:#54665a; padding:0 14px 6px; min-height:20px; background:#fff; }
@media(max-width:600px) {
 #ufs-panel { right:12px; bottom:calc(84px + env(safe-area-inset-bottom) + var(--ufs-bottom-offset, 64px)); max-height:calc(100dvh - 110px - env(safe-area-inset-bottom) - var(--ufs-bottom-offset, 64px)); }
 #ufs-toggle-btn { right:16px; bottom:calc(16px + env(safe-area-inset-bottom) + var(--ufs-bottom-offset, 64px)); }
}
@media(prefers-reduced-motion:reduce) { #ufs-panel, #ufs-toggle-btn { transition:none; } #ufs-messages { scroll-behavior:auto; } .ufs-dot { animation:none; } }
