/* BDT Agent Chatbot v4.0 */
#bdt-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #6c3fc5;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(108,63,197,0.5);
  z-index: 99999;
  transition: transform 0.2s, box-shadow 0.2s;
}
#bdt-chat-launcher:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(108,63,197,0.6); }
#bdt-chat-launcher svg { width: 26px; height: 26px; fill: #fff; }
#bdt-chat-launcher .bdt-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #e74c3c;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 10px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

#bdt-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 370px;
  max-width: calc(100vw - 40px);
  height: 570px;
  max-height: calc(100vh - 120px);
  background: #1a1a2e;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.55);
  z-index: 99998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: opacity 0.22s ease, transform 0.22s ease;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  pointer-events: none;
}
#bdt-chat-window.bdt-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.bdt-header {
  background: #6c3fc5;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.bdt-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.bdt-header-info { flex: 1; min-width: 0; }
.bdt-header-name { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.2; }
.bdt-header-status {
  color: rgba(255,255,255,0.78);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.bdt-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}
.bdt-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  padding: 5px;
  border-radius: 6px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.bdt-close-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* Messages */
.bdt-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.bdt-messages::-webkit-scrollbar { width: 4px; }
.bdt-messages::-webkit-scrollbar-track { background: transparent; }
.bdt-messages::-webkit-scrollbar-thumb { background: rgba(108,63,197,0.4); border-radius: 4px; }

/* Bubbles */
.bdt-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 90%;
}
.bdt-msg.bdt-bot { align-self: flex-start; }
.bdt-msg.bdt-user { align-self: flex-end; flex-direction: row-reverse; }
.bdt-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  word-wrap: break-word;
}
.bdt-msg.bdt-bot .bdt-bubble {
  background: #252542;
  color: #e8e8f0;
  border-bottom-left-radius: 4px;
}
.bdt-msg.bdt-user .bdt-bubble {
  background: #6c3fc5;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bdt-msg-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #6c3fc5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Quick action buttons */
.bdt-quick-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.bdt-quick-btn {
  background: #2e2e52;
  border: 1px solid rgba(108,63,197,0.4);
  color: #c5b3f5;
  padding: 9px 13px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
}
.bdt-quick-btn:hover {
  background: #3a3a6a;
  border-color: rgba(108,63,197,0.7);
  color: #d8ccff;
}

/* Product card */
.bdt-product-card {
  background: #252542;
  border: 1px solid rgba(108,63,197,0.3);
  border-radius: 12px;
  padding: 11px 13px;
  margin: 3px 0;
  align-self: flex-start;
  width: calc(100% - 36px);
  margin-left: 36px;
}
.bdt-product-header { display: flex; gap: 9px; align-items: flex-start; }
.bdt-product-thumb {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
  background: #3a3a6a;
}
.bdt-product-thumb-placeholder {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: #3a3a6a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bdt-product-info { flex: 1; min-width: 0; }
.bdt-product-name { color: #d8ccff; font-weight: 600; font-size: 13px; line-height: 1.3; margin-bottom: 2px; }
.bdt-product-cat { color: #7070a0; font-size: 11px; margin-bottom: 3px; }
.bdt-product-price { color: #4ade80; font-size: 13.5px; font-weight: 700; }
.bdt-product-desc { color: #9090b8; font-size: 12px; margin-top: 6px; line-height: 1.4; }
.bdt-product-link {
  display: inline-block;
  margin-top: 8px;
  background: #6c3fc5;
  color: #fff;
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12px;
  text-decoration: none;
  transition: background 0.15s;
  font-family: inherit;
  cursor: pointer;
}
.bdt-product-link:hover { background: #7d52d6; color: #fff; text-decoration: none; }

/* Category grid */
.bdt-category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
  align-self: flex-start;
  width: calc(100% - 36px);
  margin-left: 36px;
}
.bdt-cat-pill {
  background: #2e2e52;
  border: 1px solid rgba(108,63,197,0.35);
  border-radius: 9px;
  padding: 9px 8px;
  color: #c5b3f5;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: background 0.15s;
  line-height: 1.3;
}
.bdt-cat-pill:hover { background: #3a3a6a; color: #d8ccff; }

/* Loading spinner */
.bdt-loading {
  align-self: flex-start;
  margin-left: 36px;
  color: #7070a0;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bdt-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(108,63,197,0.3);
  border-top-color: #6c3fc5;
  border-radius: 50%;
  animation: bdtSpin 0.6s linear infinite;
}
@keyframes bdtSpin { to { transform: rotate(360deg); } }

/* Typing dots */
.bdt-typing .bdt-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 13px 16px;
}
.bdt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6c3fc5;
  animation: bdtBounce 1.2s ease infinite;
}
.bdt-dot:nth-child(2) { animation-delay: 0.18s; }
.bdt-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes bdtBounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Footer */
.bdt-footer {
  padding: 10px 12px;
  background: #16162a;
  border-top: 1px solid rgba(108,63,197,0.2);
  flex-shrink: 0;
}
.bdt-input-row {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 7px;
}
.bdt-input {
  flex: 1;
  background: #252542;
  border: 1px solid rgba(108,63,197,0.35);
  border-radius: 10px;
  color: #e8e8f0;
  padding: 9px 13px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}
.bdt-input::placeholder { color: #5a5a7a; }
.bdt-input:focus { border-color: rgba(108,63,197,0.7); }
.bdt-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #6c3fc5;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.bdt-send-btn:hover { background: #7d52d6; }
.bdt-send-btn svg { width: 16px; height: 16px; fill: #fff; }

.bdt-footer-tabs {
  display: flex;
  gap: 5px;
}
.bdt-tab-btn {
  flex: 1;
  background: #252542;
  border: 1px solid rgba(108,63,197,0.25);
  border-radius: 8px;
  color: #9090b8;
  padding: 6px 4px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.bdt-tab-btn:hover, .bdt-tab-btn.bdt-active {
  background: rgba(108,63,197,0.25);
  color: #c5b3f5;
  border-color: rgba(108,63,197,0.5);
}
.bdt-powered {
  text-align: center;
  font-size: 10.5px;
  color: #3d3d5c;
  margin-top: 7px;
}

/* Inline text links inside chat bubbles */
.bdt-inline-link {
  color: #c5b3f5;
  text-decoration: underline;
  text-decoration-color: rgba(197,179,245,0.4);
  transition: color 0.15s;
}
.bdt-inline-link:hover { color: #d8ccff; text-decoration-color: rgba(216,204,255,0.7); }

