/* ============================================================
   Scout — Snaps Clothing Chat Widget
   snapsclothing.com aesthetic
   Brown #3B2A1A | Gold #7D5E25 | White #FFFFFF
   User bubble #F5EED8 | Bot bubble #F9F7F4 | Border #E8E0D5
   ============================================================ */

#scout-root {
  --sb:      #3B2A1A;      /* brown — primary actions */
  --sg:      #7D5E25;      /* gold — links & accents */
  --sw:      #FFFFFF;      /* white — window bg */
  --stext:   #1A1A1A;      /* near-black — body text */
  --suser:   #F5EED8;      /* warm champagne — user bubbles */
  --sbot:    #F9F7F4;      /* off-white — bot bubbles */
  --sborder: #E8E0D5;      /* warm gray — borders */
  --sradius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  box-sizing: border-box;
}

#scout-root *, #scout-root *::before, #scout-root *::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

/* ── Toggle Button ─────────────────────────────────────────── */
#scout-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483646;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sb);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(59,42,26,0.35), 0 1px 4px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

#scout-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 24px rgba(59,42,26,0.45), 0 1px 4px rgba(0,0,0,0.15);
}

#scout-btn:active { transform: scale(0.96); }
#scout-btn svg { pointer-events: none; }

#scout-btn .scout-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 13px;
  height: 13px;
  background: #2E8B57;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ── Chat Window ───────────────────────────────────────────── */
#scout-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 2147483645;
  width: 380px;
  height: 520px;
  background: var(--sw);
  border: 1px solid var(--sborder);
  border-radius: var(--sradius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  transform-origin: bottom right;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1),
              opacity 0.18s ease;
}

#scout-window.scout-closed {
  transform: scale(0.88) translateY(10px);
  opacity: 0;
  pointer-events: none;
}

/* ── Header ────────────────────────────────────────────────── */
#scout-header {
  background: var(--sb);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.scout-brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.scout-snap-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.92;
}

.scout-brand-text { line-height: 1.25; }

.scout-name {
  font-size: 15px;
  font-weight: 600;
  color: #FFFFFF;
  letter-spacing: 0.01em;
}

.scout-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scout-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}

.scout-status-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  animation: scout-blink 2.5s ease-in-out infinite;
}

@keyframes scout-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

#scout-close-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.8);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

#scout-close-btn:hover { background: rgba(255,255,255,0.18); }

/* ── Messages ──────────────────────────────────────────────── */
#scout-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: var(--sw);
}

#scout-messages::-webkit-scrollbar { width: 3px; }
#scout-messages::-webkit-scrollbar-track { background: transparent; }
#scout-messages::-webkit-scrollbar-thumb {
  background: var(--sborder);
  border-radius: 2px;
}

.scout-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: scout-fadein 0.18s ease;
}

@keyframes scout-fadein {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

.scout-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(59,42,26,0.08);
  border: 1px solid var(--sborder);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.scout-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  color: var(--stext);
}

.scout-msg.scout-bot .scout-bubble {
  background: var(--sbot);
  border: 1px solid var(--sborder);
  border-bottom-left-radius: 4px;
}

.scout-msg.scout-user .scout-bubble {
  background: var(--suser);
  border: 1px solid #DDD0B8;
  border-bottom-right-radius: 4px;
  color: var(--stext);
}

.scout-bubble strong { font-weight: 600; color: var(--stext); }
.scout-bubble em     { color: rgba(26,26,26,0.65); font-style: italic; }
.scout-bubble a      { color: var(--sg); text-decoration: underline; }

/* ── Typing Indicator ──────────────────────────────────────── */
#scout-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 8px;
  flex-shrink: 0;
}

#scout-typing .scout-avatar { opacity: 0.7; }

.scout-dots {
  display: flex;
  gap: 4px;
  padding: 9px 13px;
  background: var(--sbot);
  border: 1px solid var(--sborder);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.scout-dots span {
  width: 6px;
  height: 6px;
  background: rgba(26,26,26,0.25);
  border-radius: 50%;
  animation: scout-dot 1.3s ease-in-out infinite;
}
.scout-dots span:nth-child(2) { animation-delay: 0.2s; }
.scout-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes scout-dot {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.25; }
  40%           { transform: scale(1.1); opacity: 0.8; }
}

/* ── Email Capture Bar ─────────────────────────────────────── */
#scout-email-bar {
  background: #FAF7F3;
  border-top: 1px solid var(--sborder);
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

#scout-email-bar.scout-hidden { display: none; }

#scout-email-input {
  flex: 1;
  background: #FFFFFF;
  border: 1px solid var(--sborder);
  border-radius: 7px;
  color: var(--stext);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

#scout-email-input::placeholder { color: rgba(26,26,26,0.3); }
#scout-email-input:focus { border-color: var(--sb); }

#scout-email-submit {
  background: var(--sb);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  font-family: inherit;
  letter-spacing: 0.02em;
}

#scout-email-submit:hover { opacity: 0.82; }

/* ── Input Area ────────────────────────────────────────────── */
#scout-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--sborder);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--sw);
}

#scout-input {
  flex: 1;
  background: #FFFFFF;
  border: 1px solid var(--sborder);
  border-radius: 8px;
  color: var(--stext);
  font-size: 14px;
  line-height: 1.4;
  padding: 9px 12px;
  outline: none;
  resize: none;
  max-height: 100px;
  min-height: 38px;
  font-family: inherit;
  transition: border-color 0.15s;
}

#scout-input::placeholder { color: rgba(26,26,26,0.32); }
#scout-input:focus { border-color: rgba(59,42,26,0.45); }

#scout-send {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--sb);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}

#scout-send:hover  { opacity: 0.82; }
#scout-send:active { transform: scale(0.92); }
#scout-send:disabled { opacity: 0.3; cursor: default; }
#scout-send svg { pointer-events: none; }

/* ── Footer ────────────────────────────────────────────────── */
.scout-footer {
  text-align: center;
  font-size: 10px;
  color: rgba(26,26,26,0.22);
  padding: 0 0 7px;
  flex-shrink: 0;
  letter-spacing: 0.04em;
  font-family: inherit;
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #scout-window {
    width: 100vw;
    height: 100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
    border: none;
    transform-origin: bottom center;
  }

  #scout-window.scout-closed {
    transform: translateY(18px) scale(0.97);
  }

  #scout-btn {
    bottom: 16px;
    right: 16px;
  }
}

/* ── Product Cards ─────────────────────────────────────────── */
.scout-product-card {
  display: block;
  background: #fff;
  border: 1px solid #E8E0D5;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  margin-top: 10px;
  transition: box-shadow 0.15s, transform 0.12s;
  max-width: 220px;
}

.scout-product-card:hover {
  box-shadow: 0 4px 16px rgba(59,42,26,0.12);
  transform: translateY(-1px);
}

.scout-card-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #F5F0EB;
}

.scout-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scout-card-body {
  padding: 10px 12px 12px;
}

.scout-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #1A1A1A;
  margin-bottom: 3px;
  line-height: 1.3;
}

.scout-card-price {
  font-size: 13px;
  color: #7D5E25;
  font-weight: 500;
  margin-bottom: 8px;
}

.scout-card-btn {
  display: block;
  width: 100%;
  background: #3B2A1A;
  color: #EBE9DA;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 9px 10px;
  border-radius: 6px;
  letter-spacing: 0.03em;
  transition: opacity 0.12s;
}

.scout-product-card:hover .scout-card-btn {
  opacity: 0.88;
}
