/* ─────────────────────────────────────────────────────────────────────────
   Storefront chat widget — anonymous shopper helper.
   Class-prefixed with `sfc-` to namespace against the rest of the site.
   ───────────────────────────────────────────────────────────────────────── */

.sfc-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: #1a0e0a;
  color: #faf7f4;

  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;

  box-shadow:
    0 8px 20px rgba(26, 14, 10, 0.18),
    0 2px 4px rgba(26, 14, 10, 0.12);

  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.sfc-launcher:hover {
  background: #c8622f;
  transform: translateY(-1px);
  box-shadow:
    0 10px 24px rgba(200, 98, 47, 0.28),
    0 2px 4px rgba(26, 14, 10, 0.14);
}

.sfc-launcher:focus-visible {
  outline: 2px solid #e8875a;
  outline-offset: 3px;
}

.sfc-launcher svg { display: block; }

.sfc-launcher-label { line-height: 1; }

/* ── Panel ───────────────────────────────────────────────────────────────── */

.sfc-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 9999;

  width: min(360px, calc(100vw - 32px));
  height: min(480px, calc(100vh - 120px));

  display: flex;
  flex-direction: column;

  background: #ffffff;
  color: #1a0e0a;
  border: 1px solid #d4c4b4;
  border-radius: 12px;
  box-shadow:
    0 16px 40px rgba(26, 14, 10, 0.16),
    0 4px 8px rgba(26, 14, 10, 0.08);

  font-family: 'DM Sans', system-ui, sans-serif;
  overflow: hidden;
}

.sfc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;

  background: #1a0e0a;
  color: #faf7f4;
  font-weight: 500;
}

.sfc-header-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.005em;
}

.sfc-close {
  background: transparent;
  border: none;
  color: #faf7f4;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.sfc-close:hover { background: rgba(250, 247, 244, 0.12); }
.sfc-close:focus-visible { outline: 2px solid #e8875a; outline-offset: 2px; }

.sfc-hint {
  padding: 10px 16px;
  font-size: 0.82rem;
  color: #6b5e52;
  background: #faf7f4;
  border-bottom: 1px solid #f0e8df;
}

.sfc-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fdfbf8;
}

.sfc-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 0.92rem;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: sfc-fade-in 160ms ease-out;
}

@keyframes sfc-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sfc-bubble-agent {
  align-self: flex-start;
  background: #f0e8df;
  color: #1a0e0a;
  border-bottom-left-radius: 4px;
}

.sfc-bubble-user {
  align-self: flex-end;
  background: #4f46e5;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.sfc-bubble-meta {
  margin-top: 4px;
  font-size: 0.7rem;
  color: #6b5e52;
  opacity: 0.8;
}

.sfc-bubble-hint {
  margin-top: 4px;
  font-size: 0.72rem;
  font-style: italic;
  color: #6b5e52;
  opacity: 0.75;
}

.sfc-bubble-pending { opacity: 0.7; }

/* ── Form ────────────────────────────────────────────────────────────────── */

.sfc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 12px 14px;
  border-top: 1px solid #f0e8df;
  background: #ffffff;
}

.sfc-input {
  flex: 1 1 auto;
  min-height: 44px;
  max-height: 160px;

  padding: 10px 12px;
  resize: none;
  overflow: auto;

  border: 1px solid #d4c4b4;
  border-radius: 10px;
  background: #faf7f4;
  color: #1a0e0a;

  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
}

.sfc-input:focus-visible {
  outline: none;
  border-color: #c8622f;
  box-shadow: 0 0 0 3px rgba(200, 98, 47, 0.18);
}

.sfc-input:disabled { opacity: 0.6; }

.sfc-send {
  flex: 0 0 auto;
  padding: 10px 16px;
  background: #c8622f;
  color: #ffffff;
  border: none;
  border-radius: 10px;

  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;

  transition: background 120ms ease, transform 80ms ease;
}

.sfc-send:hover { background: #b0531f; }
.sfc-send:active { transform: translateY(1px); }
.sfc-send:disabled,
.sfc-send.sfc-sending {
  background: #d4c4b4;
  cursor: not-allowed;
  transform: none;
}

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

/* ── Responsive nudges ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .sfc-launcher {
    right: 16px;
    bottom: 16px;
  }
  .sfc-panel {
    right: 16px;
    bottom: 80px;
    width: calc(100vw - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sfc-launcher,
  .sfc-bubble,
  .sfc-send { transition: none; }
  .sfc-bubble { animation: none; }
}
