.chatbot-fab-wrapper {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10030;
}
.chatbot-fab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--btn-primary-bg, var(--color-primary, #4e7661));
  color: #fff !important;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  font-family: var(--brand-font-body, 'Outfit', sans-serif);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.3s, box-shadow 0.3s;
  white-space: nowrap;
}
.chatbot-fab-label {
  color: #fff !important;
}
.chatbot-fab-icon {
  color: #fff !important;
}
.chatbot-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(0,0,0,0.35);
}
.chatbot-fab-image {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 50%;
  flex-shrink: 0;
}
.chatbot-fab-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}
.chatbot-fab .chatbot-close-icon { display: none; }
.chatbot-fab.state-open .chatbot-close-icon { display: block; }

.chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  z-index: 10030;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--brand-font-body, 'Outfit', sans-serif);
}
.chatbot-window.open {
  display: flex;
  animation: chatbotSlideUp 0.3s ease;
}
@keyframes chatbotSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chatbot-header {
  background: var(--btn-primary-bg, var(--color-primary, #4e7661));
  color: #fff !important;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.chatbot-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.chatbot-header-info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #fff !important;
  font-family: var(--brand-font-heading, var(--brand-font-body, 'Outfit', sans-serif));
}
.chatbot-header-info p {
  margin: 0;
  font-size: 12px;
  color: #fff !important;
  opacity: 0.85;
}
.chatbot-header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  flex-shrink: 0;
  margin-left: auto;
  transition: background 0.2s;
}
.chatbot-header-btn:hover { background: rgba(255,255,255,0.3); }

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fafb;
}
.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 10px;
}

.chatbot-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--ds-btn-radius, 14px);
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
}
.chatbot-msg.user {
  align-self: flex-end;
  background: var(--btn-primary-bg, var(--color-primary, #4e7661));
  color: var(--btn-primary-text, #fff);
  border-bottom-right-radius: 4px;
}
.chatbot-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: var(--ds-text-body, #1f2937);
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.chatbot-msg.bot p {
  margin: 0 0 8px;
  line-height: 1.55;
}
.chatbot-msg.bot p:last-child {
  margin-bottom: 0;
}
.chatbot-msg.bot a {
  color: var(--color-primary, #4e7661);
  text-decoration: underline;
}
.chatbot-msg.bot strong { font-weight: 700; }
.chatbot-msg.bot em { font-style: italic; }
.chatbot-msg.bot code {
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: #e11d48;
}
.chatbot-msg.bot pre {
  background: #1f2937;
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 6px 0;
  font-size: 12px;
  line-height: 1.5;
}
.chatbot-msg.bot pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.chatbot-msg.bot table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
  font-size: 12px;
}
.chatbot-msg.bot th,
.chatbot-msg.bot td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
}
.chatbot-msg.bot th {
  background: #f9fafb;
  font-weight: 700;
  font-size: 11px;
  color: #555;
}
.chatbot-msg.bot h2,
.chatbot-msg.bot h3,
.chatbot-msg.bot h4 {
  margin: 8px 0 4px;
  font-weight: 700;
  line-height: 1.3;
}
.chatbot-msg.bot h2 { font-size: 15px; }
.chatbot-msg.bot h3 { font-size: 14px; }
.chatbot-msg.bot h4 { font-size: 13px; }
.chatbot-msg.bot ul,
.chatbot-msg.bot ol {
  margin: 4px 0;
  padding-left: 20px;
}
.chatbot-msg.bot li {
  margin-bottom: 2px;
  line-height: 1.45;
}

.chatbot-typing {
  align-self: flex-start;
  display: none;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--ds-btn-radius, 14px);
  border-bottom-left-radius: 4px;
}
.chatbot-typing.visible {
  display: flex;
}
.chatbot-typing span {
  width: 7px;
  height: 7px;
  background: var(--color-primary-soft, #a78bfa);
  border-radius: 50%;
  animation: chatbotDot 1.2s infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbotDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chatbot-welcome {
  text-align: center;
  padding: 20px 12px;
  color: var(--ds-text-subtle, #6b7280);
}
.chatbot-welcome h4 {
  margin: 0 0 6px;
  color: var(--ds-text-title, #1f2937);
  font-size: 15px;
  font-family: var(--brand-font-heading, var(--brand-font-body, 'Outfit', sans-serif));
}
.chatbot-welcome p {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.5;
}
.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.chatbot-suggestions button {
  background: var(--color-primary-pale, #f3f0ff);
  color: var(--color-primary, #4e7661);
  border: 1px solid var(--color-primary-soft, #e0d4fc);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--brand-font-body, 'Outfit', sans-serif);
}
.chatbot-suggestions button:hover {
  background: var(--color-primary, #4e7661);
  color: var(--btn-primary-text, #fff);
  border-color: var(--color-primary, #4e7661);
}

.chatbot-input-area {
  padding: 12px 14px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
  background: #fff;
  align-items: flex-end;
}
.chatbot-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  font-size: 13.5px;
  outline: none;
  font-family: var(--brand-font-body, 'Outfit', sans-serif);
  transition: border-color 0.2s;
}
.chatbot-input-area input:focus {
  border-color: var(--color-primary, #4e7661);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.chatbot-input-area button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--btn-primary-bg, var(--color-primary, #4e7661));
  color: var(--btn-primary-text, #fff);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.chatbot-input-area button:hover {
  transform: scale(1.05);
}
.chatbot-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.chatbot-input-area button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

@media (max-width: 1080px) {
  /* Hide floating button on mobile — chatbot is opened from the profile drawer */
  .chatbot-fab-wrapper {
    display: none !important;
  }
}
.chatbot-status {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: var(--ds-btn-radius, 14px);
  border-bottom-left-radius: 4px;
  font-size: 12px;
  color: #888;
}
.chatbot-status-dots {
  display: inline-flex;
  gap: 3px;
}
.chatbot-status-dots span {
  width: 6px;
  height: 6px;
  background: var(--color-primary, #4e7661);
  border-radius: 50%;
  animation: chatbotDot 1.2s infinite;
}
.chatbot-status-dots span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-status-dots span:nth-child(3) { animation-delay: 0.4s; }
.chatbot-status-icon {
  flex-shrink: 0;
}
.chatbot-status-icon.spin {
  animation: chatbotSpin 1s linear infinite;
}
@keyframes chatbotSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.chatbot-window.fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  z-index: 99999 !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
}
.chatbot-window.fullscreen .chatbot-header {
  padding: 12px 20px;
  border-bottom: 1px solid #e5e7eb;
}
.chatbot-window.fullscreen .chatbot-messages {
  flex: 1;
  overflow-y: auto;
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px;
}
.chatbot-window.fullscreen .chatbot-input-area {
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  border-top: 1px solid #e5e7eb;
  padding: 14px 16px;
}
.chatbot-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99998;
}
.chatbot-overlay.visible {
  display: block;
}

@media (max-width: 480px) {
  .chatbot-window {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .chatbot-fab {
    bottom: 16px;
    right: 16px;
  }
}
