/* Bandago AI Chat Widget — all classes prefixed bdg-chat- */

.bdg-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 60px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ff9814;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
}

.bdg-chat-launcher:hover {
  transform: scale(1.08);
  background: #e88a0f;
}

.bdg-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.bdg-chat-launcher .bdg-chat-close-icon {
  display: none;
}

.bdg-chat-launcher.bdg-chat-open .bdg-chat-msg-icon {
  display: none;
}

.bdg-chat-label {
  position: fixed;
  bottom: 38px;
  right: 124px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  z-index: 99998;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  opacity: 1;
  transition: opacity 0.2s;
}

.bdg-chat-label.bdg-chat-hidden {
  opacity: 0;
}

.bdg-chat-launcher.bdg-chat-open .bdg-chat-close-icon {
  display: block;
}

/* Panel */
.bdg-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 60px;
  width: 380px;
  height: 520px;
  background: #2a2a2a;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 99997;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.bdg-chat-panel.bdg-chat-visible {
  display: flex;
}

/* Header */
.bdg-chat-header {
  background: #222;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #3a3a3a;
  flex-shrink: 0;
}

.bdg-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ff9814;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bdg-chat-avatar svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.bdg-chat-header-text {
  flex: 1;
}

.bdg-chat-header-title {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.bdg-chat-header-subtitle {
  color: #999;
  font-size: 12px;
  margin: 0;
  line-height: 1.4;
}

/* Messages area */
.bdg-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bdg-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.bdg-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.bdg-chat-messages::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 3px;
}

/* Message bubbles */
.bdg-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.bdg-chat-msg a {
  color: #ff9814;
  text-decoration: underline;
}

.bdg-chat-msg-user {
  background: #ff9814;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.bdg-chat-msg-user a {
  color: #fff;
}

.bdg-chat-msg-assistant {
  background: #3a3a3a;
  color: #e5e7eb;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.bdg-chat-msg-agent {
  background: #2d4a2d;
  color: #e5e7eb;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border-left: 3px solid #4caf50;
}

/* Tool status */
.bdg-chat-tool-status {
  align-self: flex-start;
  color: #999;
  font-size: 12px;
  font-style: italic;
  padding: 4px 0;
}

/* Typing indicator */
.bdg-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #3a3a3a;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.bdg-chat-typing-dot {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: bdg-chat-bounce 1.4s infinite ease-in-out;
}

.bdg-chat-typing-dot:nth-child(1) { animation-delay: 0s; }
.bdg-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.bdg-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bdg-chat-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.bdg-chat-input-area {
  padding: 12px 16px;
  background: #222;
  border-top: 1px solid #3a3a3a;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.bdg-chat-input {
  flex: 1;
  background: #3a3a3a;
  border: 1px solid #555;
  border-radius: 20px;
  padding: 10px 16px;
  color: #e5e7eb;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  outline: none;
  line-height: 1.4;
}

.bdg-chat-input::placeholder {
  color: #777;
}

.bdg-chat-input:focus {
  border-color: #ff9814;
}

.bdg-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ff9814;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.bdg-chat-send:hover {
  background: #e88a0f;
}

.bdg-chat-send:disabled {
  background: #555;
  cursor: not-allowed;
}

.bdg-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .bdg-chat-panel {
    width: 100%;
    height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .bdg-chat-launcher {
    right: 20px;
  }

  .bdg-chat-label {
    display: none;
  }
}
