/* === CHATBOT WIDGET === */
#chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: 'DM Sans', system-ui, sans-serif;
}

/* Toggle button */
#chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(200, 255, 0, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

#chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(200, 255, 0, 0.4);
}

#chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: #080b12;
  transition: opacity 0.2s;
}

#chat-toggle .icon-chat { display: block; }
#chat-toggle .icon-close { display: none; }
#chat-toggle.open .icon-chat { display: none; }
#chat-toggle.open .icon-close { display: block; }

/* Notification dot */
#chat-toggle .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #ff4d4d;
  border-radius: 50%;
  border: 2px solid #080b12;
  display: none;
}

#chat-toggle.has-notif .notif-dot { display: block; }

/* Chat window */
#chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  max-height: 560px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#chat-window.open { display: flex; }

/* Chat header */
#chat-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-alt);
}

#chat-header .bot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #c8ff00 0%, #a3d400 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#chat-header .bot-avatar svg {
  width: 22px;
  height: 22px;
  fill: #080b12;
}

#chat-header-info { flex: 1; }

#chat-header-info .bot-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 2px;
}

#chat-header-info .bot-status {
  font-size: 12px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 5px;
}

#chat-header-info .bot-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

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

#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-track { background: transparent; }
#chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Message bubbles */
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  animation: msgIn 0.25s ease-out;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #080b12;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}

.msg.system {
  align-self: center;
  background: rgba(200, 255, 0, 0.08);
  border: 1px solid rgba(200, 255, 0, 0.2);
  color: var(--accent);
  font-size: 12px;
  text-align: center;
  max-width: 90%;
}

/* Lead capture form */
#lead-form {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  display: none;
}

#lead-form.active { display: block; }

#lead-form .lead-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

#lead-form .lead-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 10px;
}

#lead-form input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 8px;
  box-sizing: border-box;
}

#lead-form input::placeholder { color: var(--fg-muted); }
#lead-form input:focus { border-color: var(--accent); }

#lead-form .btn-row { display: flex; gap: 8px; }

#lead-form button {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}

#lead-form button:hover { opacity: 0.85; }

#lead-form .btn-submit {
  background: var(--accent);
  color: #080b12;
}

#lead-form .btn-skip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

/* Chat input */
#chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

#chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

#chat-input::placeholder { color: var(--fg-muted); }
#chat-input:focus { border-color: var(--accent); }

#chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

#chat-send:hover { opacity: 0.85; }
#chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

#chat-send svg {
  width: 18px;
  height: 18px;
  fill: #080b12;
}

/* Typing indicator */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-muted);
  animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Suggested prompts */
.suggested-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
}

.suggested-prompts button {
  background: rgba(200, 255, 0, 0.06);
  border: 1px solid rgba(200, 255, 0, 0.15);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--fg-muted);
  font-family: 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.suggested-prompts button:hover {
  border-color: rgba(200, 255, 0, 0.4);
  color: var(--accent);
}

@media (max-width: 480px) {
  #chat-window {
    width: calc(100vw - 32px);
    right: -8px;
    bottom: 80px;
  }
}