.chatbot-root {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 200;
  font-family: var(--font, system-ui, sans-serif);
}

.chatbot-launcher {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.chatbot-fab-label {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: #111827;
  color: #f1f5f9;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(59, 130, 246, 0.45);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  pointer-events: none;
}

.chatbot-fab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-fab-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(59, 130, 246, 0.75);
  animation: chatbot-pulse 2.4s ease-out infinite;
  pointer-events: none;
}

.chatbot-fab-icon {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  display: block;
}

@keyframes chatbot-pulse {
  0% {
    transform: scale(1);
    opacity: 0.85;
  }
  70% {
    transform: scale(1.18);
    opacity: 0;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

.chatbot-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 12px 32px rgba(59, 130, 246, 0.55);
}

.chatbot-fab:hover .chatbot-fab-ring {
  animation-play-state: paused;
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 6.5rem;
  width: min(380px, calc(100vw - 2rem));
  height: 520px;
  max-height: calc(100vh - 6rem);
  background: #151d2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.chatbot-panel[hidden] {
  display: none !important;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #111827;
}

.chatbot-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #e8edf5;
}

.chatbot-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-msg {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-assistant {
  align-self: flex-start;
  background: #1a2438;
  color: #e8edf5;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 4px;
}

.chat-typing {
  opacity: 0.7;
  font-style: italic;
}

.chat-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chat-thumb-wrap {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-thumb {
  display: block;
  width: 88px;
  height: 64px;
  object-fit: cover;
  background: #fff;
}

.chatbot-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #111827;
}

.chatbot-input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #0a0e17;
  color: #e8edf5;
  font-family: inherit;
  font-size: 0.875rem;
}

.chatbot-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.chatbot-send {
  padding: 0.6rem 0.9rem;
  border: none;
  border-radius: 8px;
  background: #3b82f6;
  color: #fff;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chatbot-send:hover {
  background: #2563eb;
}

.chatbot-footnote {
  margin: 0;
  padding: 0 0.75rem 0.6rem;
  font-size: 0.6875rem;
  color: #64748b;
  background: #111827;
}

@media (max-width: 480px) {
  .chatbot-root {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .chatbot-panel {
    width: calc(100vw - 1.5rem);
  }
}
