/* ===== SST DEVELOPERS - AI PROPERTY ADVISOR CHAT WIDGET ===== */

/* Floating Launcher Button */
.sst-ai-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6d1e36 0%, #8e2b49 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(109, 30, 54, 0.45);
  cursor: pointer;
  z-index: 9998;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  outline: none;
}

.sst-ai-launcher:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 28px rgba(109, 30, 54, 0.45);
}

.sst-ai-launcher svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: transform 0.3s ease;
}

.sst-ai-launcher.active svg {
  transform: rotate(90deg);
}

/* Pulsing badge notification */
.sst-ai-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background-color: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: sstPulse 2s infinite;
}

@keyframes sstPulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Tooltip bubble on hover / first load */
.sst-ai-tooltip {
  position: absolute;
  right: 72px;
  background: #ffffff;
  color: #1e293b;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  font-size: 0.825rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(109, 30, 54, 0.15);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sst-ai-launcher:hover .sst-ai-tooltip {
  opacity: 1;
  transform: translateX(0);
}

.sst-ai-tooltip::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent transparent #ffffff;
}

@keyframes sstFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Chat Window Container */
.sst-chat-window {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 395px;
  height: 600px;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 7.5rem);
  background: #ffffff;
  border-radius: 1.25rem;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  border: 1px solid rgba(226, 232, 240, 0.8);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.sst-chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.sst-chat-header {
  background: linear-gradient(135deg, #6d1e36 0%, #821c3c 100%);
  color: #ffffff;
  padding: 0.875rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(109, 30, 54, 0.15);
}

.sst-chat-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sst-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.sst-avatar-online {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background-color: #10b981;
  border: 2px solid #6d1e36;
  border-radius: 50%;
}

.sst-chat-title h4 {
  margin: 0;
  font-size: 0.925rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sst-chat-title p {
  margin: 0;
  font-size: 0.7rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sst-chat-title p::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
}

.sst-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sst-icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.sst-icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.sst-icon-btn.active {
  background: #d4af37;
  color: #1e293b;
}

.sst-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Language Selector Bar */
.sst-lang-bar {
  background: #521326;
  padding: 0.35rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sst-lang-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}

.sst-lang-pills {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px;
  border-radius: 999px;
}

.sst-lang-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.sst-lang-btn:hover {
  color: #ffffff;
}

.sst-lang-btn.active {
  background: #ffffff;
  color: #6d1e36;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Messages Body */
.sst-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.875rem;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  scroll-behavior: smooth;
}

/* Individual Message Row */
.sst-msg-row {
  display: flex;
  gap: 0.5rem;
  max-width: 90%;
  animation: sstFadeIn 0.25s ease-out;
  position: relative;
}

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

.sst-msg-row.bot {
  align-self: flex-start;
}

.sst-msg-row.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.sst-msg-bubble {
  padding: 0.75rem 0.95rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  position: relative;
}

.sst-msg-row.bot .sst-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-top-left-radius: 0.25rem;
}

.sst-msg-row.user .sst-msg-bubble {
  background: linear-gradient(135deg, #6d1e36 0%, #821c3c 100%);
  color: #ffffff;
  border-top-right-radius: 0.25rem;
}

.sst-msg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.sst-msg-time {
  font-size: 0.65rem;
  opacity: 0.65;
}

.sst-msg-row.user .sst-msg-time {
  color: #e2e8f0;
}


/* Typing Indicator */
.sst-typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.85rem 1rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  border-top-left-radius: 0.25rem;
  width: fit-content;
}

.sst-dot {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: sstBounce 1.4s infinite ease-in-out both;
}

.sst-dot:nth-child(1) { animation-delay: -0.32s; }
.sst-dot:nth-child(2) { animation-delay: -0.16s; }
.sst-dot:nth-child(3) { animation-delay: 0s; }

@keyframes sstBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Suggestion Chips */
.sst-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.25rem;
  margin-bottom: 0.4rem;
}

.sst-chip-btn {
  background: #ffffff;
  border: 1px solid rgba(109, 30, 54, 0.25);
  color: #6d1e36;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.sst-chip-btn:hover {
  background: #6d1e36;
  color: #ffffff;
  border-color: #6d1e36;
  transform: translateY(-1px);
}

/* Lead Success & WhatsApp Card */
.sst-lead-card {
  background: #ffffff;
  border: 1px solid #10b981;
  border-radius: 0.875rem;
  padding: 0.875rem 1rem;
  margin-top: 0.5rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}

.sst-lead-card h5 {
  margin: 0 0 0.35rem;
  color: #065f46;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sst-lead-card p {
  margin: 0 0 0.75rem;
  color: #334155;
  font-size: 0.775rem;
  line-height: 1.4;
}

.sst-wa-direct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: #25d366;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  width: 100%;
  box-sizing: border-box;
  transition: background-color 0.2s ease;
}

.sst-wa-direct-btn:hover {
  background-color: #128c7e;
}

.sst-wa-direct-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Footer / Input Area */
.sst-chat-footer {
  padding: 0.75rem 0.875rem;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.sst-input-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sst-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.6rem 0.95rem;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.sst-chat-input:focus {
  border-color: #6d1e36;
  box-shadow: 0 0 0 2px rgba(109, 30, 54, 0.15);
}

.sst-chat-input.listening-active {
  border-color: #ef4444;
  background: #fef2f2;
}

/* Microphone Button */
.sst-mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  outline: none;
  position: relative;
}

.sst-mic-btn:hover {
  background: #e2e8f0;
  color: #6d1e36;
}

.sst-mic-btn.listening {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444;
  animation: sstMicPulse 1.2s infinite;
}

@keyframes sstMicPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.sst-mic-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Send Button */
.sst-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #6d1e36;
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  outline: none;
}

.sst-send-btn:hover:not(:disabled) {
  background: #821c3c;
  transform: scale(1.05);
}

.sst-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sst-send-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.sst-footer-note {
  font-size: 0.65rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 0.35rem;
}

/* Responsive on Mobile Phones */
@media (max-width: 768px) {
  .sst-ai-launcher {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }

  .sst-ai-launcher svg {
    width: 22px;
    height: 22px;
  }

  .sst-ai-tooltip {
    display: none !important;
  }

  .sst-chat-window {
    bottom: 0.5rem;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    height: calc(100vh - 1rem);
    max-width: 100%;
    max-height: 100%;
    border-radius: 1rem;
  }
}
