/* ===== FLOATING CHAT FAB ===== */
.chat-fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1500;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--gradient);
  color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 6px 24px var(--accent-glow), 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
}
.chat-fab:hover { transform: scale(1.1); box-shadow: 0 8px 32px var(--accent-glow); }
.chat-fab:active { transform: scale(0.95); }
.chat-fab .fab-icon { transition: transform 0.3s ease, opacity 0.3s ease; }
.chat-fab.open .fab-icon { transform: rotate(90deg); }
.chat-fab-badge {
  position: absolute; top: -2px; right: -2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #30d158; border: 2px solid var(--bg);
  animation: pulse-dot 2s infinite;
}

/* Floating chat window */
.chat-float {
  position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 1500;
  width: 380px; max-height: 520px;
  border-radius: 24px;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.chat-float.open { opacity: 1; pointer-events: all; transform: translateY(0) scale(1); }

.chat-float-header {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(94,92,230,0.06);
}
.chat-float-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.75rem; font-weight: 800;
}
.chat-float-header-info h4 { font-size: 0.88rem; font-weight: 700; }
.chat-float-header-info p { font-size: 0.7rem; color: var(--text-dim); }
.chat-float-close {
  margin-left: auto; background: none; border: none;
  color: var(--text-dim); cursor: pointer; font-size: 1rem;
  padding: 4px; border-radius: 50%; transition: var(--transition);
}
.chat-float-close:hover { color: var(--text); background: var(--glass-inner); }

.chat-float-messages {
  flex: 1; padding: 1rem; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.8rem;
  min-height: 280px; max-height: 340px;
}
.chat-float-messages::-webkit-scrollbar { width: 4px; }
.chat-float-messages::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 2px; }

.cf-msg { display: flex; gap: 0.6rem; max-width: 88%; animation: msgIn 0.3s ease; }
.cf-msg.bot { align-self: flex-start; }
.cf-msg.user { align-self: flex-end; flex-direction: row-reverse; }
@keyframes msgIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.cf-msg-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 800;
}
.cf-msg.bot .cf-msg-avatar { background: var(--gradient); color: #fff; }
.cf-msg.user .cf-msg-avatar { background: var(--glass-inner); border: 1px solid var(--glass-border); color: var(--text-dim); font-size: 0.6rem; }
.cf-msg-bubble {
  padding: 0.65rem 0.9rem; border-radius: 14px;
  font-size: 0.84rem; line-height: 1.55;
}
.cf-msg.bot .cf-msg-bubble { background: var(--glass-inner); border: 1px solid var(--glass-border); color: var(--text); }
.cf-msg.user .cf-msg-bubble { background: var(--gradient); color: #fff; }

.chat-float-input-wrap {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-top: 1px solid var(--glass-border);
}
.chat-float-input {
  flex: 1; background: var(--glass-inner); border: 1px solid var(--glass-border);
  border-radius: 980px; padding: 0.55rem 0.9rem;
  font-family: var(--font); font-size: 0.85rem; color: var(--text); outline: none;
}
.chat-float-input:focus { border-color: var(--accent); }
.chat-float-input::placeholder { color: var(--text-dim); }
.chat-float-send {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--gradient); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--spring); flex-shrink: 0;
}
.chat-float-send:hover { transform: scale(1.08); }
.chat-float-send:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-float-send svg { width: 0.9rem; height: 0.9rem; }

.cf-typing { display: flex; gap: 3px; padding: 0.3rem 0; }
.cf-typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--text-dim); animation: typing 1.4s infinite; }
.cf-typing span:nth-child(2) { animation-delay: 0.2s; }
.cf-typing span:nth-child(3) { animation-delay: 0.4s; }

.chat-float-api {
  padding: 0.5rem 1rem; font-size: 0.68rem; color: var(--text-dim);
  border-top: 1px solid var(--glass-border); text-align: center;
}
.chat-float-api a { font-weight: 600; }

@media(max-width:480px) {
  .chat-float { right: 0; bottom: 4.5rem; width: 100vw; max-height: 75vh; border-radius: 20px 20px 0 0; }
  .chat-fab { bottom: 0.8rem; right: 0.8rem; width: 50px; height: 50px; font-size: 1.2rem; }
  .chat-float-messages { min-height: 220px; max-height: 300px; }
  .cf-msg-bubble { font-size: 0.8rem; padding: 0.55rem 0.75rem; }
  .chat-float-input { font-size: 0.82rem; padding: 0.5rem 0.8rem; }
}
