/* QuickFinds AI Assistant Widget */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

#qf-ai-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: 'DM Sans', sans-serif;
}

/* ── Bubble ── */
#qf-bubble {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff5c1a, #e03e00);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255,92,26,0.45);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
#qf-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(255,92,26,0.6); }
#qf-bubble .bubble-icon { font-size: 1.6rem; line-height: 1; }

.bubble-pulse {
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255,92,26,0.4);
  animation: bubblePulse 2.5s ease-out infinite;
}
@keyframes bubblePulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}

.bubble-badge {
  position: absolute; top: -2px; right: -2px;
  width: 18px; height: 18px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: badgePop 0.4s ease;
}
.bubble-badge.hidden { display: none; }
@keyframes badgePop { from{transform:scale(0)} to{transform:scale(1)} }

/* ── Panel ── */
#qf-panel {
  position: absolute;
  bottom: 74px; right: 0;
  width: 360px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid #ede8e0;
  overflow: hidden;
  display: none;
  flex-direction: column;
  max-height: 560px;
  animation: panelIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
#qf-panel.open { display: flex; }
@keyframes panelIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); transform-origin: bottom right; }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Header ── */
.qf-header {
  background: linear-gradient(135deg, #1a1a2e, #2d2d5e);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.qf-header-left { display: flex; align-items: center; gap: 10px; }
.qf-avatar {
  width: 38px; height: 38px;
  background: rgba(255,92,26,0.2);
  border: 1.5px solid rgba(255,92,26,0.5);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.qf-header-info strong { display: block; color: #fff; font-size: 0.9rem; font-weight: 600; }
.qf-header-info span { color: rgba(255,255,255,0.55); font-size: 0.72rem; }

.qf-header-right { display: flex; align-items: center; gap: 10px; }

/* Wave */
.qf-wave { display: flex; align-items: center; gap: 2px; height: 16px; }
.qf-wave span {
  display: block; width: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.3);
  animation: waveIdle 2s ease-in-out infinite;
}
.qf-wave span:nth-child(1){height:4px;animation-delay:0s}
.qf-wave span:nth-child(2){height:8px;animation-delay:0.1s}
.qf-wave span:nth-child(3){height:12px;animation-delay:0.2s}
.qf-wave span:nth-child(4){height:8px;animation-delay:0.1s}
.qf-wave span:nth-child(5){height:4px;animation-delay:0s}
@keyframes waveIdle{0%,100%{opacity:0.3;transform:scaleY(0.5)}50%{opacity:0.8;transform:scaleY(1)}}
.qf-wave.speaking span { background:#ff5c1a; animation:waveSpeaking 0.35s ease-in-out infinite; }
.qf-wave.thinking span { background:#a78bfa; animation:waveIdle 0.6s ease-in-out infinite; }
@keyframes waveSpeaking{0%,100%{transform:scaleY(0.4)}50%{transform:scaleY(1.6)}}
.qf-wave.speaking span:nth-child(1){animation-delay:0s}
.qf-wave.speaking span:nth-child(2){animation-delay:0.07s}
.qf-wave.speaking span:nth-child(3){animation-delay:0.14s}
.qf-wave.speaking span:nth-child(4){animation-delay:0.07s}
.qf-wave.speaking span:nth-child(5){animation-delay:0s}

#qf-close {
  background: rgba(255,255,255,0.1); border: none;
  color: rgba(255,255,255,0.7); width: 28px; height: 28px;
  border-radius: 8px; cursor: pointer; font-size: 0.85rem;
  transition: background 0.2s;
}
#qf-close:hover { background: rgba(255,255,255,0.2); color:#fff; }

/* ── Messages ── */
#qf-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 180px;
  scrollbar-width: thin; scrollbar-color: #e0dbd4 transparent;
}

.qf-msg { display: flex; gap: 8px; animation: msgIn 0.25s ease; }
@keyframes msgIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.qf-msg-av {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 0.85rem;
}
.qf-msg.bot .qf-msg-av { background: rgba(255,92,26,0.1); border: 1px solid rgba(255,92,26,0.2); }
.qf-msg.user { flex-direction: row-reverse; }
.qf-msg.user .qf-msg-av { background: rgba(26,26,46,0.07); border: 1px solid rgba(26,26,46,0.1); }

.qf-msg-text {
  max-width: 80%; padding: 9px 13px; border-radius: 14px;
  font-size: 0.875rem; line-height: 1.5;
}
.qf-msg.bot .qf-msg-text {
  background: #f0f0f8; color: #1a1a2e; border-bottom-left-radius: 3px;
}
.qf-msg.user .qf-msg-text {
  background: #1a1a2e; color: #fff; border-bottom-right-radius: 3px;
}

.typing-dots { display:flex; gap:4px; align-items:center; padding:2px 0; }
.typing-dots span { width:6px;height:6px;border-radius:50%;background:#94a3b8;animation:dot 1.2s infinite; }
.typing-dots span:nth-child(2){animation-delay:0.2s}
.typing-dots span:nth-child(3){animation-delay:0.4s}
@keyframes dot{0%,80%,100%{opacity:0.3;transform:scale(0.8)}40%{opacity:1;transform:scale(1)}}

/* ── Chips ── */
#qf-chips {
  padding: 0 12px 10px;
  display: flex; flex-wrap: wrap; gap: 6px;
  flex-shrink: 0;
}
.qf-chip {
  background: #f4f1ec; border: 1px solid #e8e3dc;
  border-radius: 100px; padding: 5px 11px;
  font-size: 0.75rem; cursor: pointer; color: #1a1a2e;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.18s;
}
.qf-chip:hover { background: #ff5c1a; border-color: #ff5c1a; color: #fff; transform: translateY(-1px); }

/* ── Input ── */
.qf-input-row {
  display: flex; gap: 6px; align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #ede8e0;
  background: #fafaf8;
  flex-shrink: 0;
}
#qfInput {
  flex: 1; border: 1.5px solid #e0dbd4; border-radius: 10px;
  padding: 8px 12px; font-size: 0.875rem; font-family: 'DM Sans', sans-serif;
  color: #1a1a2e; outline: none; background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#qfInput:focus { border-color: #ff5c1a; box-shadow: 0 0 0 3px rgba(255,92,26,0.1); }
#qfInput::placeholder { color: #b0a89a; }

#qfMic {
  width: 36px; height: 36px; border-radius: 9px;
  border: 1.5px solid #e0dbd4; background: #fff;
  cursor: pointer; font-size: 1rem; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
#qfMic:hover { border-color: #f59e0b; background: #fffbf0; }
#qfMic.active { background: #fff8e1; border-color: #f59e0b; animation: micPulse 0.8s infinite; }
@keyframes micPulse{0%,100%{box-shadow:0 0 0 0 rgba(245,158,11,0.35)}50%{box-shadow:0 0 0 7px rgba(245,158,11,0)}}

#qfSend {
  width: 36px; height: 36px; border-radius: 9px;
  background: #ff5c1a; border: none; color: #fff;
  font-size: 0.9rem; cursor: pointer;
  box-shadow: 0 3px 10px rgba(255,92,26,0.3);
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
#qfSend:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(255,92,26,0.45); }

/* ── Footer ── */
.qf-footer {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: #f7f4f0;
  border-top: 1px solid #ede8e0;
  font-size: 0.7rem; color: #a09880;
  flex-shrink: 0;
}
.qf-voice-toggle {
  margin-left: auto; display: flex; align-items: center; gap: 4px; cursor: pointer;
  color: #a09880; user-select: none;
}
.qf-voice-toggle input { cursor: pointer; }

/* Mobile responsive */
@media (max-width: 480px) {
  #qf-panel { width: calc(100vw - 32px); right: 0; bottom: 70px; }
  #qf-ai-widget { bottom: 16px; right: 16px; }
}
