/* ── Sales Chat Widget ─────────────────────────────────────────────────────── */

#sc-root {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Bubble */
.sc-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #000;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  transition: transform 160ms cubic-bezier(0.23,1,0.32,1), box-shadow 160ms;
  margin-left: auto;
}
.sc-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,0.3);
}
.sc-bubble svg { pointer-events: none; }

/* Notification dot */
.sc-dot {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  opacity: 0;
  transition: opacity 200ms;
}
.sc-dot.visible { opacity: 1; }

/* Chat window */
.sc-window {
  position: absolute;
  bottom: 68px;
  right: 0;
  width: 340px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: transform 220ms cubic-bezier(0.23,1,0.32,1), opacity 200ms;
}
.sc-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.sc-header {
  background: #000;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #222;
  border: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sc-header-info { flex: 1; min-width: 0; }
.sc-header-name { color: #fff; font-size: 14px; font-weight: 600; }
.sc-header-sub  { color: #666; font-size: 11px; margin-top: 1px; }
.sc-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 4px;
  display: flex;
  transition: color 150ms;
}
.sc-close:hover { color: #fff; }

/* Messages */
.sc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  scroll-behavior: smooth;
}
.sc-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: sc-pop 180ms cubic-bezier(0.23,1,0.32,1);
}
.sc-msg.agent {
  background: #f3f3f3;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  color: #111;
}
.sc-msg.user {
  background: #000;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.sc-typing {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: #f3f3f3;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.sc-typing span {
  width: 7px; height: 7px;
  background: #999;
  border-radius: 50%;
  animation: sc-bounce 1.2s infinite;
}
.sc-typing span:nth-child(2) { animation-delay: 0.2s; }
.sc-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Input */
.sc-input-area {
  padding: 12px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
}
.sc-input {
  flex: 1;
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13px;
  outline: none;
  resize: none;
  font-family: inherit;
  transition: border-color 150ms;
}
.sc-input:focus { border-color: #000; }
.sc-send {
  width: 36px; height: 36px;
  background: #000;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 150ms, transform 100ms;
}
.sc-send:hover   { background: #222; }
.sc-send:active  { transform: scale(0.92); }
.sc-send:disabled { background: #ccc; cursor: not-allowed; }

/* Success state */
.sc-success {
  padding: 24px 20px;
  text-align: center;
  font-size: 13.5px;
  color: #444;
  line-height: 1.6;
  display: none;
}
.sc-success.visible { display: block; }
.sc-success-icon { font-size: 32px; margin-bottom: 8px; }

@keyframes sc-pop {
  from { transform: scale(0.9) translateY(4px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes sc-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

@media (max-width: 400px) {
  .sc-window { width: calc(100vw - 24px); right: -4px; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-window, .sc-msg, .sc-bubble { transition: none !important; animation: none !important; }
}
