/* In-app AI Assistant widget — matches navy app chrome */

#ff-assistant-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #0b1120;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  z-index: 1040;
  box-shadow: 0 8px 24px rgba(11, 17, 32, 0.35);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s;
}

#ff-assistant-launcher:hover,
#ff-assistant-launcher:focus-visible {
  transform: scale(1.08);
  background: #111827;
  outline: none;
}

#ff-assistant-launcher.is-open {
  display: none;
}

#ff-assistant-panel {
  display: none;
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: min(400px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  border-radius: 16px;
  background: var(--card-background, #fff);
  border: 1px solid var(--border-color, rgba(15, 23, 42, 0.08));
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  z-index: 1041;
  flex-direction: column;
  overflow: hidden;
}

#ff-assistant-panel.is-open {
  display: flex;
}

.ff-assistant-header {
  background: #0b1120;
  color: #f8fafc;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
}

.ff-assistant-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.ff-assistant-header p {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: rgba(226, 232, 240, 0.8);
}

.ff-assistant-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.ff-assistant-header-actions button {
  background: transparent;
  border: none;
  color: rgba(248, 250, 252, 0.9);
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ff-assistant-header-actions button:hover,
.ff-assistant-header-actions button:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.ff-assistant-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  background: var(--background-color, #f8fafc);
}

.ff-assistant-msg {
  display: flex;
  margin-bottom: 0.75rem;
}

.ff-assistant-msg--user {
  justify-content: flex-end;
}

.ff-assistant-msg--bot,
.ff-assistant-msg--system {
  justify-content: flex-start;
}

.ff-assistant-bubble {
  max-width: 88%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.ff-assistant-msg--user .ff-assistant-bubble {
  background: #0b1120;
  color: #f8fafc;
  border-bottom-right-radius: 4px;
}

.ff-assistant-msg--bot .ff-assistant-bubble a {
  color: #0d6efd;
  font-weight: 500;
  text-decoration: underline;
}

.ff-assistant-msg--bot .ff-assistant-bubble strong {
  font-weight: 600;
}

.ff-assistant-msg--error .ff-assistant-bubble {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.ff-assistant-msg--rate .ff-assistant-bubble {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.ff-assistant-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.ff-assistant-chip {
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: var(--card-background, #fff);
  color: var(--text-color, #0f172a);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.ff-assistant-chip:hover,
.ff-assistant-chip:focus-visible {
  border-color: #0d6efd;
  color: #0d6efd;
  outline: none;
}

.ff-assistant-typing {
  display: none;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted, #64748b);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.ff-assistant-typing.is-visible {
  display: flex;
}

.ff-assistant-typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: ff-assistant-bounce 1.2s infinite ease-in-out;
}

.ff-assistant-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ff-assistant-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ff-assistant-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.ff-assistant-footer {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding: 0.75rem;
  border-top: 1px solid var(--border-color, rgba(15, 23, 42, 0.08));
  background: var(--card-background, #fff);
}

.ff-assistant-footer textarea {
  flex: 1 1 auto;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  border-radius: 10px;
  background: var(--background-color, #f8fafc);
  color: var(--text-color, #0f172a);
  border-color: var(--border-color, #cbd5e1);
  font-size: 0.9rem;
  line-height: 1.35;
}

.ff-assistant-footer .btn {
  flex-shrink: 0;
}

[data-bs-theme="dark"] #ff-assistant-launcher {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

[data-bs-theme="dark"] .ff-assistant-msg--bot .ff-assistant-bubble {
  background: #1f2937;
}

[data-bs-theme="dark"] .ff-assistant-msg--error .ff-assistant-bubble {
  background: #450a0a;
  border-color: #7f1d1d;
  color: #fecaca;
}

[data-bs-theme="dark"] .ff-assistant-msg--rate .ff-assistant-bubble {
  background: #451a03;
  border-color: #92400e;
  color: #fde68a;
}

@media (max-width: 575.98px) {
  #ff-assistant-panel {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  #ff-assistant-launcher {
    bottom: 16px;
    right: 16px;
  }
}
