/* Guide chatbot widget — FAB + panel. Self-contained; injected flag-gated
   from base.html so every tool gets it without template changes. */

.chatbot-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  font-size: 1.4rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 1080; /* below toasts (1090) */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.chatbot-fab:hover {
  transform: scale(1.06);
}
.chatbot-fab:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.4);
  outline-offset: 2px;
}

.chatbot-panel {
  position: fixed;
  bottom: 88px;
  right: 20px;
  width: 360px;
  height: 480px;
  max-height: calc(100vh - 110px);
  background: var(--bs-body-bg, #fff);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
  z-index: 1080;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chatbot-panel[hidden] {
  display: none;
}

.chatbot-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
}
.chatbot-header .chatbot-title {
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 0.95rem;
}
.chatbot-header button {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  opacity: 0.85;
}
.chatbot-header button:hover {
  opacity: 1;
}

.chatbot-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bs-tertiary-bg, #f6f7f9);
}

.chatbot-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.chatbot-msg.user {
  align-self: flex-end;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chatbot-msg.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom-left-radius: 4px;
}

.chatbot-suggestions {
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 90%;
}
.chatbot-suggestions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  text-decoration: none;
}

.chatbot-chips {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 95%;
}
.chatbot-chips button {
  border: 1px solid var(--bs-primary, #0d6efd);
  background: #fff;
  color: var(--bs-primary, #0d6efd);
  border-radius: 999px;
  font-size: 0.8rem;
  padding: 3px 12px;
  cursor: pointer;
}
.chatbot-chips button:hover {
  background: var(--bs-primary, #0d6efd);
  color: #fff;
}

.chatbot-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
}
.chatbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9aa0a6;
  animation: chatbot-blink 1.2s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.chatbot-typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes chatbot-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

.chatbot-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--bs-body-bg, #fff);
}
.chatbot-input-row textarea {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.875rem;
  height: 38px;
  max-height: 96px;
}
.chatbot-input-row button {
  border: none;
  border-radius: 8px;
  background: var(--bs-primary, #0d6efd);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}
.chatbot-input-row button:disabled {
  opacity: 0.5;
  cursor: default;
}

.chatbot-disclaimer {
  font-size: 0.7rem;
  color: var(--bs-secondary-color, #6c757d);
  text-align: center;
  padding: 0 10px 8px;
  background: var(--bs-body-bg, #fff);
}

@media (max-width: 576px) {
  .chatbot-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    height: 70vh;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-fab,
  .chatbot-typing span {
    transition: none;
    animation: none;
  }
}
