/* ── Chatbot Widget ──────────────────────────────────────────────────────── */
/* Scoped under .rs-chat-* to avoid collisions with the landing page styles  */

/* Launcher button (bottom-right) */
.rs-chat-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  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 24px rgba(110, 231, 183, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.rs-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(110, 231, 183, 0.5);
}
.rs-chat-launcher svg {
  color: #0a0a0f;
}

/* Unread badge */
.rs-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #ff5252;
  border-radius: 50%;
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 0.65rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s, transform 0.2s;
}
.rs-chat-badge.visible {
  opacity: 1;
  transform: scale(1);
}

/* Chat panel */
.rs-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9001;
  width: 380px;
  max-height: 580px;
  background: var(--bg-card, #16161f);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(110, 231, 183, 0.06);
  /* Animate in/out */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.rs-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Panel header */
.rs-chat-header {
  padding: 16px 20px;
  background: var(--bg-elevated, #12121a);
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.rs-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim, rgba(110,231,183,0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.rs-chat-header-text h4 {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg, #e8e8ed);
  line-height: 1.2;
}
.rs-chat-header-text p {
  font-size: 0.75rem;
  color: var(--accent, #6ee7b7);
  line-height: 1.2;
}
.rs-chat-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-dim, #5a5a70);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.rs-chat-close:hover {
  color: var(--fg, #e8e8ed);
  background: rgba(255,255,255,0.06);
}

/* Messages container */
.rs-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.rs-chat-messages::-webkit-scrollbar { width: 4px; }
.rs-chat-messages::-webkit-scrollbar-track { background: transparent; }
.rs-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Individual message bubbles */
.rs-msg {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rs-msg.user { align-self: flex-end; align-items: flex-end; }
.rs-msg.assistant { align-self: flex-start; align-items: flex-start; }

.rs-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  font-family: var(--font-body, 'DM Sans', sans-serif);
}
.rs-msg.user .rs-msg-bubble {
  background: var(--accent, #6ee7b7);
  color: #0a0a0f;
  border-bottom-right-radius: 4px;
}
.rs-msg.assistant .rs-msg-bubble {
  background: var(--bg-elevated, #12121a);
  color: var(--fg, #e8e8ed);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.rs-typing {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: var(--bg-elevated, #12121a);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.rs-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-dim, #5a5a70);
  animation: rs-bounce 1.2s infinite ease-in-out;
}
.rs-typing span:nth-child(2) { animation-delay: 0.2s; }
.rs-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes rs-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); background: var(--accent); }
}

/* Lead capture success */
.rs-lead-captured {
  background: var(--accent-dim, rgba(110,231,183,0.12));
  border: 1px solid rgba(110, 231, 183, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--accent, #6ee7b7);
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-weight: 500;
  text-align: center;
  align-self: center;
}

/* Input row */
.rs-chat-input-row {
  padding: 12px 14px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
  display: flex;
  gap: 8px;
  background: var(--bg-card, #16161f);
  flex-shrink: 0;
}
.rs-chat-input {
  flex: 1;
  background: var(--bg-elevated, #12121a);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 10px;
  color: var(--fg, #e8e8ed);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 0.9rem;
  padding: 10px 14px;
  resize: none;
  outline: none;
  height: 42px;
  line-height: 1.4;
  transition: border-color 0.15s;
}
.rs-chat-input:focus {
  border-color: rgba(110, 231, 183, 0.3);
}
.rs-chat-input::placeholder { color: var(--fg-dim, #5a5a70); }
.rs-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent, #6ee7b7);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.rs-chat-send:hover { opacity: 0.88; transform: scale(1.04); }
.rs-chat-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.rs-chat-send svg { color: #0a0a0f; }

/* Mobile adjustments */
@media (max-width: 480px) {
  .rs-chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
  }
  .rs-chat-launcher {
    bottom: 20px;
    right: 20px;
  }
}
