/* =============================================
   QODEX CHAT WIDGET
============================================= */

.qx-chat {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 9999;
  font-family: 'Outfit', sans-serif;
}

/* Toggle Button */
.qx-chat-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #BFF747;
  color: #000;
  border: none;
  border-radius: 100px;
  padding: 14px 22px 14px 16px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 0 rgba(191,247,71,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: qx-pulse 3s ease-in-out infinite;
}

@keyframes qx-pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 0 rgba(191,247,71,0.4); }
  50% { box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 10px rgba(191,247,71,0); }
}

.qx-chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(0,0,0,0.4), 0 0 0 0 rgba(191,247,71,0.4);
  animation: none;
}

.qx-chat-toggle svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.qx-chat-toggle .qx-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #000;
  color: #BFF747;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  margin-left: 4px;
}

/* Chat Window */
.qx-chat-window {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 360px;
  background: #0d0d0d;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(191,247,71,0.08);
  display: none;
  flex-direction: column;
  max-height: 520px;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.qx-chat-window.is-open {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

/* Header */
.qx-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.qx-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #BFF747;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: #000;
  flex-shrink: 0;
}

.qx-chat-header-info {
  flex: 1;
}

.qx-chat-header-info strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.qx-chat-header-info span {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  gap: 5px;
}

.qx-chat-header-info span::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}

.qx-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.qx-chat-close:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* Messages */
.qx-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.qx-chat-messages::-webkit-scrollbar { width: 4px; }
.qx-chat-messages::-webkit-scrollbar-track { background: transparent; }
.qx-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Message Bubbles */
.qx-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.qx-msg.bot { align-self: flex-start; max-width: 88%; }
.qx-msg.user { align-self: flex-end; flex-direction: row-reverse; max-width: 80%; }

.qx-msg-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #BFF747;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #000;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.qx-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.6;
}

.qx-msg.bot .qx-msg-bubble {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
  border-radius: 4px 16px 16px 16px;
}

.qx-msg.user .qx-msg-bubble {
  background: #BFF747;
  color: #000;
  font-weight: 600;
  border-radius: 16px 4px 16px 16px;
}

/* Quick Reply Buttons */
.qx-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.qx-quick-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 100px;
  padding: 7px 14px;
  color: rgba(255,255,255,0.8);
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.qx-quick-btn:hover {
  background: rgba(191,247,71,0.1);
  border-color: rgba(191,247,71,0.3);
  color: #BFF747;
}

/* Typing indicator */
.qx-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px 16px 16px 16px;
  width: fit-content;
}

.qx-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: qx-dot 1.2s ease-in-out infinite;
}
.qx-typing span:nth-child(2) { animation-delay: 0.2s; }
.qx-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes qx-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Input Row */
.qx-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.qx-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 100px;
  padding: 9px 16px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.qx-chat-input::placeholder { color: rgba(255,255,255,0.25); }
.qx-chat-input:focus { border-color: rgba(191,247,71,0.4); }

.qx-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #BFF747;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.qx-chat-send:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(191,247,71,0.4); }
.qx-chat-send svg { width: 16px; height: 16px; stroke: #000; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* Mobile */
@media (max-width: 480px) {
  .qx-chat { bottom: 20px; left: 16px; }
  .qx-chat-window { width: calc(100vw - 32px); }
}
