/*!
 * Sales Chat Widget — front-of-funnel chatbot styles.
 *
 * Light theme, matches site palette (teal accent, off-white surface,
 * Plus Jakarta Sans). Never leaks into host page styles — every selector
 * is namespaced under .scw- (sales-chat-widget).
 *
 * Mobile: at <= 480px the panel goes fullscreen instead of a bottom-right
 * popup so prospects on phones don't see a tiny bubble.
 *
 * CREATED: 2026-05-07 by Claude (v36 sales chatbot).
 */

.scw-bubble,
.scw-panel {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  box-sizing: border-box;
}

.scw-bubble *,
.scw-panel * {
  box-sizing: border-box;
}

/* === Floating bubble (closed state) ============================== */

.scw-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #0D9488;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.32), 0 2px 6px rgba(0, 0, 0, 0.12);
  border: none;
  z-index: 999998;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.scw-bubble:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(13, 148, 136, 0.4), 0 3px 8px rgba(0, 0, 0, 0.16);
}

.scw-bubble:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 3px;
}

.scw-bubble[hidden] {
  display: none !important;
}

.scw-bubble-icon {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Attention pulse — fires after N seconds idle to nudge the prospect.
 * Subtle: a gentle ring expanding outward on a 2.4s cadence, only when
 * the .scw-pulse class is added by the widget. */
.scw-bubble.scw-pulse::before,
.scw-bubble.scw-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid #0D9488;
  opacity: 0;
  pointer-events: none;
  animation: scw-pulse-ring 2.4s ease-out infinite;
}

.scw-bubble.scw-pulse::after {
  animation-delay: 1.2s;
}

@keyframes scw-pulse-ring {
  0% { transform: scale(1); opacity: 0.7; }
  80% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

.scw-bubble-tooltip {
  position: absolute;
  right: 72px;
  top: 50%;
  transform: translateY(-50%);
  background: #1A1A1A;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.scw-bubble:hover .scw-bubble-tooltip {
  opacity: 1;
}

/* === Open panel ================================================= */

.scw-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 40px);
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 6px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999999;
  border: 1px solid #E5E0DA;
}

.scw-panel[hidden] {
  display: none !important;
}

.scw-panel-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, #0D9488 0%, #0F766E 100%);
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.scw-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.scw-header-text {
  flex: 1;
  min-width: 0;
}

.scw-header-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.scw-header-status {
  font-size: 12px;
  opacity: 0.85;
  margin: 2px 0 0;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scw-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.scw-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}

.scw-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.scw-close:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 1px;
}

/* === Message list =============================================== */

.scw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #FAFAF7;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.scw-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  color: #1A1A1A;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.scw-msg-bot {
  align-self: flex-start;
  background: white;
  border: 1px solid #E5E0DA;
  border-bottom-left-radius: 4px;
}

.scw-msg-user {
  align-self: flex-end;
  background: #0D9488;
  color: white;
  border-bottom-right-radius: 4px;
}

.scw-msg-typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  background: white;
  border: 1px solid #E5E0DA;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.scw-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6B6560;
  opacity: 0.5;
  animation: scw-typing 1.2s ease-in-out infinite;
}

.scw-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.scw-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes scw-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* === CTA button (model-emitted) ================================= */

.scw-cta {
  align-self: flex-start;
  margin-top: 4px;
}

.scw-cta-btn {
  background: #0D9488;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s ease, transform 0.1s ease;
}

.scw-cta-btn:hover {
  background: #0F766E;
  transform: translateY(-1px);
}

.scw-cta-btn:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

/* === Input bar ================================================== */

.scw-input-bar {
  padding: 12px;
  background: white;
  border-top: 1px solid #E5E0DA;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

.scw-input {
  flex: 1;
  border: 1px solid #E5E0DA;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  min-height: 40px;
  outline: none;
  transition: border-color 0.12s ease;
  color: #1A1A1A;
  background: #FAFAF7;
  line-height: 1.4;
}

.scw-input:focus {
  border-color: #0D9488;
  background: white;
}

.scw-input::placeholder {
  color: #9CA3AF;
}

.scw-send {
  background: #0D9488;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s ease;
}

.scw-send:hover:not(:disabled) {
  background: #0F766E;
}

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

.scw-send:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 1px;
}

.scw-send-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.scw-footer-note {
  text-align: center;
  font-size: 11px;
  color: #6B6560;
  padding: 6px 12px 8px;
  background: white;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

/* === Mobile fullscreen ========================================== */

@media (max-width: 480px) {
  .scw-panel {
    right: 0;
    bottom: 0;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .scw-bubble {
    right: 16px;
    bottom: 16px;
  }

  .scw-bubble-tooltip {
    display: none;
  }
}

/* === Reduced motion respect ===================================== */

@media (prefers-reduced-motion: reduce) {
  .scw-bubble.scw-pulse::before,
  .scw-bubble.scw-pulse::after,
  .scw-typing-dot,
  .scw-bubble,
  .scw-cta-btn {
    animation: none !important;
    transition: none !important;
  }
}
