/* VinSnap chatbot widget — floating bubble + panel. On-brand, responsive, a11y. */

.vs-chatbot,
.vs-chatbot * {
  box-sizing: border-box;
}

/* Launcher bubble */
.vs-chat-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: #2563EB;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.vs-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(37, 99, 235, 0.45); }
.vs-chat-launcher:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.vs-chat-launcher svg { width: 26px; height: 26px; }

/* Panel */
.vs-chat-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.vs-chat-panel.vs-open { display: flex; }

.vs-chat-header {
  background: #2563EB;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vs-chat-header h3 {
  margin: 0;
  font-family: 'Outfit', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
}
.vs-chat-header p { margin: 2px 0 0; font-size: 0.75rem; opacity: 0.9; }
.vs-chat-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.vs-chat-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }

.vs-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9fafb;
}

.vs-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.vs-msg-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #1F2937;
  border-bottom-left-radius: 4px;
}
.vs-msg-user {
  align-self: flex-end;
  background: #2563EB;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.vs-msg a { color: inherit; text-decoration: underline; }
.vs-msg-bot a { color: #2563EB; }

.vs-typing { display: flex; gap: 4px; align-items: center; }
.vs-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9ca3af;
  animation: vs-bounce 1.2s infinite ease-in-out;
}
.vs-typing span:nth-child(2) { animation-delay: 0.15s; }
.vs-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes vs-bounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* Lead capture inline form */
.vs-lead {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
}
.vs-lead p { margin: 0; font-size: 0.82rem; color: #1e3a8a; }
.vs-lead-row { display: flex; gap: 6px; }
.vs-lead input {
  flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid #bfdbfe;
  border-radius: 8px; font-size: 0.88rem;
}
.vs-lead button {
  padding: 8px 12px; background: #2563EB; color: #fff; border: none;
  border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 0.85rem;
}
.vs-lead button:disabled { opacity: 0.6; cursor: default; }

/* Footer / composer */
.vs-chat-foot {
  border-top: 1px solid #e5e7eb;
  padding: 10px;
  display: flex;
  gap: 8px;
  background: #fff;
}
.vs-chat-input {
  flex: 1; min-width: 0; resize: none; max-height: 90px;
  padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 10px;
  font-size: 0.9rem; font-family: inherit; line-height: 1.35;
}
.vs-chat-input:focus { outline: 2px solid #93c5fd; outline-offset: 0; border-color: #2563EB; }
.vs-chat-send {
  flex: 0 0 auto; width: 42px; border: none; border-radius: 10px;
  background: #2563EB; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.vs-chat-send:disabled { opacity: 0.5; cursor: default; }
.vs-chat-send svg { width: 20px; height: 20px; }

.vs-chat-hint {
  font-size: 0.7rem; color: #9ca3af; text-align: center;
  padding: 0 10px 8px; background: #fff; margin: 0;
}

@media (max-width: 480px) {
  .vs-chat-panel {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%; height: 100%; max-height: 100%;
    border-radius: 0;
  }
  .vs-chat-launcher { bottom: 16px; right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .vs-chat-launcher, .vs-typing span { transition: none; animation: none; }
}
