/* ===== CHAT FAB ===== */
.chat-fab {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(124,58,237,0.45);
  z-index: 1000;
  transition: transform 0.2s;
  overflow: visible;
}
.chat-fab:hover { transform: scale(1.08); }
.chat-fab.open .icon-chat { display: none; }
.chat-fab.open .icon-close { display: block; }
.chat-fab .icon-close { display: none; }

.chat-fab-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(124,58,237,0.4);
  animation: pulse 2.5s infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.4); }
}

.chat-tooltip {
  position: absolute;
  right: 68px;
  white-space: nowrap;
  background: rgba(15,10,30,0.95);
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.chat-fab:hover .chat-tooltip { opacity: 1; }

/* ===== CHAT PANEL ===== */
.chat-panel {
  position: fixed;
  bottom: 100px; right: 28px;
  width: 360px;
  max-height: 520px;
  background: #0f0a1e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  z-index: 999;
  transform: translateY(16px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(124,58,237,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.chat-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  position: relative;
  flex-shrink: 0;
}
.chat-online {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0f0a1e;
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-info strong { display: block; font-size: 0.875rem; color: #fff; }
.chat-header-info span { font-size: 0.72rem; color: #64748b; }
.chat-header-actions { display: flex; gap: 6px; flex-shrink: 0; }
.chat-action-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  border: none;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.chat-action-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Messages */
.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;
}
.chat-msg { display: flex; gap: 8px; align-items: flex-end; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-word;
}
.chat-msg.bot .chat-bubble {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
  border-radius: 14px 14px 14px 4px;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}

/* Chips */
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px;
}
.chat-chip {
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(124,58,237,0.15);
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,0.3);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.chat-chip:hover { background: rgba(124,58,237,0.3); }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: 2px 0; }
.typing-dot {
  width: 6px; height: 6px;
  background: #64748b;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 0.875rem;
  padding: 10px 14px;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
}
.chat-input::placeholder { color: #475569; }
.chat-input:focus { border-color: rgba(124,58,237,0.5); }
.chat-send-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.chat-send-btn:hover { transform: scale(1.08); }

.chat-footer {
  text-align: center;
  font-size: 0.7rem;
  color: #334155;
  padding: 6px 16px 10px;
  flex-shrink: 0;
}
.chat-footer span { color: #7c3aed; }

@media (max-width: 420px) {
  .chat-panel { width: calc(100vw - 32px); right: 16px; }
}
