/* ─── VSL FUNNEL INTEL CHATBOT WIDGET ─── */

.fi-toggle {
  position: fixed;
  bottom: 24px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold-gradient);
  border: none;
  cursor: pointer;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(21, 94, 239, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.fi-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(21, 94, 239, 0.45);
}
.fi-toggle svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}
.fi-toggle .fi-close-icon { display: none; }
.fi-toggle.open .fi-chat-icon { display: none; }
.fi-toggle.open .fi-close-icon { display: block; }

/* ─── Chat Panel ─── */
.fi-panel {
  position: fixed;
  bottom: 92px;
  right: 28px;
  width: 400px;
  height: 540px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
  z-index: 1050;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.fi-panel.open {
  display: flex;
  animation: fi-slide-up 0.25s ease;
}

@keyframes fi-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Header ─── */
.fi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}
.fi-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fi-header-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--gold-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
}
.fi-header-icon svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}
.fi-header-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.fi-header-subtitle {
  font-size: 11px;
  color: #8b8fa3;
  font-weight: 400;
}
.fi-header-close {
  background: none;
  border: none;
  color: #8b8fa3;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.fi-header-close:hover { color: #fff; }

/* ─── Messages Area ─── */
.fi-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fi-messages::-webkit-scrollbar { width: 4px; }
.fi-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Message Bubbles */
.fi-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-wrap: break-word;
}
.fi-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.fi-msg-bot {
  align-self: flex-start;
  background: var(--muted);
  color: var(--foreground);
  border-bottom-left-radius: 4px;
}
.fi-msg-bot strong { font-weight: 600; }
.fi-msg-bot ul, .fi-msg-bot ol {
  margin: 6px 0 4px 16px;
  padding: 0;
}
.fi-msg-bot li { margin-bottom: 3px; }

/* Typing indicator */
.fi-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--muted);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.fi-typing-dot {
  width: 7px;
  height: 7px;
  background: var(--muted-foreground);
  border-radius: 50%;
  animation: fi-bounce 1.2s infinite;
}
.fi-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.fi-typing-dot:nth-child(3) { animation-delay: 0.3s; }

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

/* ─── Suggestions ─── */
.fi-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.fi-suggestion {
  padding: 6px 12px;
  font-size: 12px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(21, 94, 239, 0.15);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.fi-suggestion:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Input Area ─── */
.fi-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.fi-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--foreground);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}
.fi-input:focus {
  border-color: var(--accent);
}
.fi-input::placeholder {
  color: var(--muted-foreground);
}
.fi-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.fi-send:hover { background: #1250d4; }
.fi-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.fi-send svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

/* ─── Error State ─── */
.fi-msg-error {
  align-self: flex-start;
  background: var(--red-bg);
  color: var(--red);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
}

/* ─── Mobile ─── */
@media (max-width: 500px) {
  .fi-panel {
    right: 8px;
    left: 8px;
    bottom: 80px;
    width: auto;
    height: calc(90vh - 80px);
    max-height: 600px;
  }
  .fi-toggle {
    right: 16px;
    bottom: 16px;
  }
}
