/* ── SWT Quote Chatbot — selfworthtech.com ── */

#swt-chat *,
#swt-chat *::before,
#swt-chat *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#swt-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Launcher bubble ── */
#swt-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--swt-accent, #2563eb) 0%, #6318d2 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
#swt-launcher:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(37, 99, 235, 0.6);
}
#swt-launcher svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  transition: opacity 0.15s, transform 0.15s;
}
#swt-launcher .swt-icon-chat  { display: block; }
#swt-launcher .swt-icon-close { display: none; }
#swt-chat.swt-open .swt-icon-chat  { display: none; }
#swt-chat.swt-open .swt-icon-close { display: block; }

.swt-pulse-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.35);
  animation: swt-pulse 2.4s ease-out infinite;
}
#swt-chat.swt-open .swt-pulse-ring { display: none; }

@keyframes swt-pulse {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.55); }
}

/* ── Chat window ── */
#swt-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  height: 540px;
  background: #0f1629;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.22s, transform 0.22s;
}
#swt-chat.swt-open #swt-window {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ── Header ── */
.swt-header {
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.22) 0%, rgba(99, 24, 210, 0.18) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.swt-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--swt-accent, #2563eb), #6318d2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.swt-header-text { flex: 1; overflow: hidden; }
.swt-agent-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.swt-status {
  font-size: 11px;
  color: #6ee7b7;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.swt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6ee7b7;
  animation: swt-blink 2s ease-in-out infinite;
}
@keyframes swt-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.swt-powered { font-size: 10px; color: rgba(255, 255, 255, 0.28); flex-shrink: 0; }

/* ── Messages ── */
.swt-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
}
.swt-messages::-webkit-scrollbar { width: 4px; }
.swt-messages::-webkit-scrollbar-track { background: transparent; }
.swt-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* ── Bubbles ── */
.swt-msg { display: flex; flex-direction: column; gap: 2px; max-width: 86%; }
.swt-msg.swt-bot  { align-self: flex-start; }
.swt-msg.swt-user { align-self: flex-end; }

.swt-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
.swt-msg.swt-bot .swt-bubble {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.swt-msg.swt-user .swt-bubble {
  background: linear-gradient(135deg, var(--swt-accent, #2563eb), #1d4ed8);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.swt-msg-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.22);
  padding: 0 4px;
}
.swt-msg.swt-user .swt-msg-time { text-align: right; }

/* ── Typing indicator ── */
.swt-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 13px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.swt-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  animation: swt-bounce 0.9s ease-in-out infinite;
}
.swt-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.swt-typing-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes swt-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* ── Chips ── */
.swt-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.swt-chip {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid rgba(37, 99, 235, 0.5);
  background: rgba(37, 99, 235, 0.08);
  color: #93c5fd;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  font-family: inherit;
}
.swt-chip:hover {
  background: rgba(37, 99, 235, 0.22);
  border-color: rgba(37, 99, 235, 0.8);
  transform: translateY(-1px);
}
.swt-chip:active { transform: scale(0.97); }

/* ── Lead summary card ── */
.swt-lead-card {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 4px;
}
.swt-lead-title {
  font-size: 10px;
  font-weight: 600;
  color: #93c5fd;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.swt-lead-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.swt-lead-row:last-of-type { border-bottom: none; }
.swt-lead-key { color: rgba(255, 255, 255, 0.4); }
.swt-lead-val { color: rgba(255, 255, 255, 0.85); font-weight: 500; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swt-cta-btn {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  background: linear-gradient(135deg, var(--swt-accent, #2563eb), #6318d2);
  border: none;
  border-radius: 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.swt-cta-btn:hover { opacity: 0.88; }

/* ── Input bar ── */
.swt-input-bar {
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}
#swt-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: none;
  min-height: 38px;
  max-height: 90px;
  line-height: 1.45;
  transition: border-color 0.15s;
}
#swt-input::placeholder { color: rgba(255, 255, 255, 0.28); }
#swt-input:focus { border-color: rgba(37, 99, 235, 0.55); }
#swt-send {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--swt-accent, #2563eb), #6318d2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.1s;
}
#swt-send:hover { opacity: 0.88; }
#swt-send:active { transform: scale(0.95); }
#swt-send:disabled { opacity: 0.38; cursor: not-allowed; }
#swt-send svg { width: 17px; height: 17px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── Responsive ── */
@media (max-width: 420px) {
  #swt-chat { bottom: 16px; right: 12px; }
  #swt-window { width: calc(100vw - 24px); right: -12px; height: 72vh; max-height: 540px; }
}

@media (prefers-reduced-motion: reduce) {
  .swt-pulse-ring, .swt-dot, .swt-typing-dot { animation: none; }
  #swt-window { transition: none; }
}
