/* ── WeQbit AI Chatbot Widget ──────────────────────────────────────────────── */

#wq-chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: var(--font-body, 'Inter', system-ui, sans-serif);
}

/* Toggle Button */
#wq-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00C2A8 0%, #4A9EFF 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 194, 168, 0.45);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  position: relative;
  margin-left: auto;
}

#wq-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(0, 194, 168, 0.6);
}

#wq-chat-toggle .wq-icon-chat,
#wq-chat-toggle .wq-icon-close {
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#wq-chat-toggle .wq-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.8);
}

#wq-chat-widget.open #wq-chat-toggle .wq-icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.8);
}

#wq-chat-widget.open #wq-chat-toggle .wq-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Unread badge */
#wq-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #FF6B35;
  border-radius: 50%;
  border: 2px solid #0A1628;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  transition: opacity 0.2s ease;
}

#wq-chat-badge.hidden { opacity: 0; pointer-events: none; }

/* Chat Panel */
#wq-chat-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  height: 560px;
  background: #0A1628;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,194,168,0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

#wq-chat-widget.open #wq-chat-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#wq-chat-header {
  padding: 18px 20px;
  background: linear-gradient(135deg, #0D2149 0%, #1B3A6B 100%);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.wq-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00C2A8, #4A9EFF);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.wq-chat-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0D2149;
}

.wq-chat-header-info { flex: 1; min-width: 0; }

.wq-chat-header-info strong {
  display: block;
  font-family: var(--font-heading, 'Space Grotesk', sans-serif);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.wq-chat-header-info span {
  font-size: 12px;
  color: #00C2A8;
  font-weight: 500;
}

/* Messages area */
#wq-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#wq-chat-messages::-webkit-scrollbar { width: 4px; }
#wq-chat-messages::-webkit-scrollbar-track { background: transparent; }
#wq-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Message bubbles */
.wq-msg {
  display: flex;
  gap: 8px;
  max-width: 92%;
  animation: wq-msg-in 0.25s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

@keyframes wq-msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wq-msg.bot { align-self: flex-start; }
.wq-msg.user { align-self: flex-end; flex-direction: row-reverse; max-width: 80%; }

.wq-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00C2A8, #4A9EFF);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.wq-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #E2E8F0;
}

.wq-msg.bot .wq-msg-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom-left-radius: 4px;
}

.wq-msg.user .wq-msg-bubble {
  background: linear-gradient(135deg, #00C2A8, #4A9EFF);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.wq-msg-bubble a {
  color: #00E5C8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wq-msg-bubble ul {
  margin: 6px 0 4px 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wq-msg-bubble strong { color: #fff; font-weight: 600; }

/* Typing indicator */
.wq-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}

.wq-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00C2A8;
  display: inline-block;
  animation: wq-bounce 1.1s infinite ease-in-out;
}

.wq-typing span:nth-child(2) { animation-delay: 0.18s; }
.wq-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes wq-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* Quick replies */
#wq-quick-replies {
  padding: 8px 16px 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.wq-quick-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,194,168,0.35);
  background: rgba(0,194,168,0.07);
  color: #00C2A8;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
}

.wq-quick-btn:hover {
  background: rgba(0,194,168,0.18);
  border-color: #00C2A8;
  color: #fff;
}

/* Input area */
#wq-chat-input-row {
  padding: 12px 16px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

#wq-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: #E2E8F0;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
  resize: none;
  height: 42px;
}

#wq-chat-input::placeholder { color: rgba(255,255,255,0.3); }
#wq-chat-input:focus { border-color: rgba(0,194,168,0.5); }

#wq-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00C2A8, #4A9EFF);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#wq-chat-send:hover { transform: scale(1.08); }
#wq-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Responsive */
@media (max-width: 480px) {
  #wq-chat-widget { bottom: 16px; right: 16px; }
  #wq-chat-panel { width: calc(100vw - 32px); right: 0; height: 70vh; max-height: 520px; }
}
@media (max-width: 375px) {
  #wq-chat-widget { bottom: 12px; right: 12px; }
  #wq-chat-panel { width: calc(100vw - 24px); right: 0; height: 65vh; }
  #wq-chat-toggle { width: 52px; height: 52px; }
}
