.bf-support-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 9999px;
  background: #111827;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999999;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  user-select: none;
}

.bf-support-fab:hover {
  background: #0f172a;
}

.bf-support-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.bf-support-panel {
  position: fixed;
  right: 18px;
  bottom: 86px;
  width: 380px;
  max-width: calc(100vw - 36px);
  height: 540px;
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
  z-index: 999999;
  overflow: hidden;
  display: flex; /* Changed from none to flex for animation */
  flex-direction: column;
  border: 1px solid rgba(15, 23, 42, 0.12);
  
  /* Animation states */
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bf-support-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.bf-support-panel * {
  box-sizing: border-box;
}

.bf-support-header {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #0b1220;
  color: #fff;
}

.bf-support-header-title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.2px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.bf-support-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bf-support-header-btn {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bf-support-header-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.bf-support-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  overflow: hidden;
  position: relative;
}

.bf-support-form {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.bf-support-input,
.bf-support-textarea {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  outline: none;
}

.bf-support-textarea {
  min-height: 120px;
  resize: vertical;
}

.bf-support-primary {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.bf-support-primary:hover {
  background: #1d4ed8;
}

.bf-support-chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0; /* Ensures flex child scrolls properly */
}

/* Typing Indicator */
.bf-support-typing {
  align-self: flex-start;
  background: #f1f5f9;
  padding: 12px 16px;
  border-radius: 12px;
  border-bottom-left-radius: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  width: fit-content;
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.bf-support-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: bf-typing 1.4s infinite ease-in-out both;
}

.bf-support-dot:nth-child(1) { animation-delay: -0.32s; }
.bf-support-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bf-typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.bf-support-msg {
  max-width: 86%;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  white-space: pre-wrap;
  word-break: break-word;
}

.bf-support-msg.user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.bf-support-msg.system,
.bf-support-msg.agent {
  align-self: flex-start;
  background: #fff;
  color: #0f172a;
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.bf-support-footer {
  padding: 10px;
  display: flex;
  gap: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  flex-shrink: 0;
  z-index: 10;
}

.bf-support-send {
  width: 44px;
  min-width: 44px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: #111827;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.bf-support-send:hover {
  background: #0f172a;
}

.bf-support-note {
  padding: 10px 12px;
  font-size: 11px;
  color: rgba(15, 23, 42, 0.7);
  border-top: 1px dashed rgba(15, 23, 42, 0.15);
  background: #fff;
  flex-shrink: 0;
}