/* ScanBeyond Scam Triage Assistant — chat widget */
.sb-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999998;
  width: 60px;
  height: 60px;
  border-radius: 30px;
  border: none;
  background: linear-gradient(135deg, #0a84ff 0%, #0066cc 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(10, 132, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(.2,.8,.2,1), box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.sb-chat-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 32px rgba(10, 132, 255, 0.45); }
.sb-chat-fab:active { transform: scale(0.96); }
.sb-chat-fab svg { width: 28px; height: 28px; }
.sb-chat-fab[hidden] { display: none; }

.sb-chat-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 36px;
  border: 2px solid rgba(10, 132, 255, 0.4);
  animation: sb-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes sb-pulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.4); opacity: 0; }
}

.sb-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 48px));
  background: rgba(20, 20, 22, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.45), 0 2px 10px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  transform-origin: bottom right;
  animation: sb-pop-in 0.28s cubic-bezier(.2,.8,.2,1);
}
@keyframes sb-pop-in {
  from { transform: scale(0.94) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.sb-chat-panel[hidden] { display: none; }

.sb-chat-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(10,132,255,0.16), rgba(10,132,255,0));
}
.sb-chat-avatar {
  width: 36px; height: 36px; border-radius: 18px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.sb-chat-avatar svg { width: 20px; height: 20px; }
.sb-chat-title { flex: 1; min-width: 0; }
.sb-chat-title h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.sb-chat-title p { margin: 1px 0 0; font-size: 11px; color: rgba(245,245,247,0.6); display: flex; align-items: center; gap: 5px; }
.sb-chat-title p::before {
  content: ''; width: 6px; height: 6px; border-radius: 3px;
  background: #30d158;
  box-shadow: 0 0 6px rgba(48, 209, 88, 0.7);
}
.sb-chat-close {
  background: rgba(255,255,255,0.08);
  border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 15px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
.sb-chat-close:hover { background: rgba(255,255,255,0.16); }
.sb-chat-close svg { width: 14px; height: 14px; }

.sb-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.sb-chat-body::-webkit-scrollbar { width: 6px; }
.sb-chat-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }

.sb-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.sb-chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0a84ff, #0066cc);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.sb-chat-msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.08);
  color: #f5f5f7;
  border-bottom-left-radius: 6px;
}
.sb-chat-msg.system-error {
  align-self: center;
  background: rgba(255, 69, 58, 0.15);
  color: #ff6961;
  font-size: 12px;
  border-radius: 10px;
  padding: 8px 12px;
}

.sb-chat-upsell {
  align-self: stretch;
  margin: 4px 0;
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(10,132,255,0.18), rgba(94,92,230,0.18));
  border: 1px solid rgba(10,132,255,0.35);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.sb-chat-upsell-icon {
  width: 44px; height: 44px; border-radius: 22px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 18px rgba(10,132,255,0.4);
}
.sb-chat-upsell-icon svg { width: 22px; height: 22px; }
.sb-chat-upsell h4 {
  margin: 4px 0 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: #f5f5f7;
}
.sb-chat-upsell p {
  margin: 0; font-size: 13px; line-height: 1.45; color: rgba(245,245,247,0.75);
}
.sb-chat-upsell-actions {
  display: flex; gap: 8px; margin-top: 6px; width: 100%;
}
.sb-chat-upsell-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #f5f5f7;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.sb-chat-upsell-btn:hover { background: rgba(255,255,255,0.12); }
.sb-chat-upsell-btn:active { transform: scale(0.97); }
.sb-chat-upsell-btn.primary {
  background: linear-gradient(135deg, #0a84ff, #0066cc);
  border-color: transparent;
  color: #fff;
}
.sb-chat-upsell-btn.primary:hover { filter: brightness(1.1); background: linear-gradient(135deg, #0a84ff, #0066cc); }

.sb-chat-tools {
  align-self: flex-start;
  font-size: 11px;
  color: rgba(245,245,247,0.55);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -4px 0 4px 4px;
}
.sb-chat-tools .tool {
  background: rgba(255,255,255,0.06);
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
}

.sb-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.08);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
}
.sb-chat-typing span {
  width: 6px; height: 6px;
  border-radius: 3px;
  background: rgba(245,245,247,0.5);
  animation: sb-bounce 1.2s infinite ease-in-out;
}
.sb-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.sb-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes sb-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.sb-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 8px;
}
.sb-chat-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #f5f5f7;
  padding: 6px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  font-family: inherit;
}
.sb-chat-chip:hover { background: rgba(10,132,255,0.18); border-color: rgba(10,132,255,0.4); }
.sb-chat-chip:active { transform: scale(0.97); }

.sb-chat-input-wrap {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 12px 14px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: rgba(0,0,0,0.18);
}
.sb-chat-input {
  flex: 1;
  resize: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  color: #f5f5f7;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
  font-family: inherit;
  max-height: 120px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sb-chat-input:focus { border-color: rgba(10,132,255,0.6); background: rgba(255,255,255,0.09); }
.sb-chat-input::placeholder { color: rgba(245,245,247,0.4); }

.sb-chat-send {
  width: 38px; height: 38px;
  border-radius: 19px;
  border: none;
  background: linear-gradient(135deg, #0a84ff, #0066cc);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.sb-chat-send:hover:not(:disabled) { transform: scale(1.05); }
.sb-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.sb-chat-send svg { width: 16px; height: 16px; }

.sb-chat-disclaimer {
  font-size: 10px;
  color: rgba(245,245,247,0.4);
  text-align: center;
  padding: 4px 14px 0;
  margin: 0;
}

@media (max-width: 480px) {
  .sb-chat-panel {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  .sb-chat-fab { bottom: 16px; right: 16px; }
}

@media (prefers-color-scheme: light) {
  /* keep dark — looks better with brand */
}
