

.sangca-ai-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffffff 0%, #edf5ff 100%);
  color: #0f172a;
  padding: 0;
  box-shadow: 0 10px 25px -4px rgba(2, 132, 199, 0.28), 0 4px 12px rgba(15, 23, 42, 0.08);
  border: 1.5px solid #dbeafe;
  cursor: grab;
  touch-action: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.sangca-ai-trigger:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 14px 30px -4px rgba(2, 132, 199, 0.38), 0 6px 16px rgba(15, 23, 42, 0.12);
  background: linear-gradient(135deg, #ffffff 0%, #e0efff 100%);
  border-color: #bfdbfe;
}

.sangca-ai-trigger .ai-icon-pulse {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.sangca-ai-trigger .ai-pulse-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  border: 2px solid #ffffff;
  animation: aiPulse 2s infinite;
}

@keyframes aiPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sangca-ai-panel {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 420px;
  height: 600px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100000;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sangca-ai-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sangca-ai-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8fbff 0%, #ebf4ff 100%);
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dbeafe;
  box-shadow: 0 2px 8px -2px rgba(2, 132, 199, 0.06);
}

.sangca-ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sangca-ai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #ffffff;
  border: 1.5px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
  overflow: hidden;
  padding: 2px;
}

.sangca-ai-title-wrap h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.2px;
}

.sangca-ai-status {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-weight: 500;
}

.sangca-ai-status-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.sangca-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sangca-ai-btn-icon {
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.08);
  color: #475569;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.sangca-ai-btn-icon:hover {
  background: rgba(15, 23, 42, 0.1);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.15);
}

.sangca-ai-quick-prompts {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.sangca-ai-quick-prompts::-webkit-scrollbar {
  display: none;
}

.sangca-ai-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.sangca-ai-pill:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.sangca-ai-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #ffffff;
}

.sangca-ai-msg {
  display: flex;
  gap: 10px;
  max-width: 90%;
  animation: fadeInMsg 0.2s ease-out;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sangca-ai-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.sangca-ai-msg.ai {
  align-self: flex-start;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.sangca-ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  margin-top: 2px;
}

.sangca-ai-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 16px !important; 
  line-height: 1.55;
  word-break: break-word;
}

.sangca-ai-msg.user .sangca-ai-msg-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.sangca-ai-msg.ai .sangca-ai-msg-bubble {
  background: #f1f5f9;
  color: #0f172a;
  border-bottom-left-radius: 4px;
  border: 1px solid #e2e8f0;
}

.sangca-ai-msg.ai .sangca-ai-msg-bubble strong {
  color: #1e3a8a;
}

.sangca-ai-msg.ai .sangca-ai-msg-bubble ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.sangca-ai-msg.ai .sangca-ai-msg-bubble li {
  margin-bottom: 4px;
}

.sangca-ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #f1f5f9;
  border-radius: 16px;
  width: fit-content;
  border: 1px solid #e2e8f0;
}

.sangca-ai-typing-dot {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.sangca-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.sangca-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.sangca-ai-input-bar {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sangca-ai-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 16px !important; 
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  background: #f8fafc;
}

.sangca-ai-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sangca-ai-mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-right: 6px;
}
.sangca-ai-mic-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.sangca-ai-mic-btn.recording {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  animation: pulseRecordingWidget 1.4s infinite;
}
@keyframes pulseRecordingWidget {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.sangca-ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.sangca-ai-send-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: scale(1.05);
}

.sangca-ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .sangca-ai-input {
    font-size: 16px !important;
  }
  .sangca-ai-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 85vh;
    max-width: 100vw;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
  }
  .sangca-ai-trigger {
    bottom: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
    padding: 0;
  }
}

.sangca-ai-trigger:active {
  cursor: grabbing;
}

.sai-btn-sparkle {
  position: absolute !important;
  top: -6px !important;
  right: -6px !important;
  width: 22px !important;
  height: 22px !important;
  object-fit: contain !important;
  pointer-events: none !important;
  z-index: 10 !important;
  filter: drop-shadow(0 2px 5px rgba(59, 130, 246, 0.65)) !important;
  animation: saiSparkleGlow 3.5s ease-in-out infinite !important;
  user-select: none !important;
}

@keyframes saiSparkleGlow {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.5));
  }
  50% {
    transform: scale(1.18) rotate(6deg);
    filter: drop-shadow(0 3px 8px rgba(99, 102, 241, 0.8));
  }
}

.sai-pinmap-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 4px 10px !important;
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 11.5px !important;
  text-decoration: none !important;
  margin: 2px 2px 2px 0 !important;
  transition: all 0.15s ease !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.08) !important;
  cursor: pointer !important;
  white-space: nowrap !important;
}

.sai-pinmap-link:hover {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1e40af !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 6px rgba(2, 132, 199, 0.15) !important;
}

.sangca-ai-msg.ai .sangca-ai-msg-bubble table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 10px 0 !important;
  font-size: 12px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

.sangca-ai-msg.ai .sangca-ai-msg-bubble th {
  background: #f8fafc !important;
  padding: 8px 10px !important;
  font-weight: 700 !important;
  color: #334155 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  text-align: left !important;
}

.sangca-ai-msg.ai .sangca-ai-msg-bubble td {
  padding: 7px 10px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  color: #1e293b !important;
}

.sangca-ai-msg.ai .sangca-ai-msg-bubble a:not(.sai-pinmap-link) {
  color: #2563eb !important;
  font-weight: 700 !important;
  text-decoration: underline !important;
}
