/* ==========================================================================
   AURELIA COSMETICS — AI Sourcing page (sourcing.html)
   Extends css/style.css. Uses the same design tokens.
   ========================================================================== */

/* Screen-reader-only text (label for the composer textarea) */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Hero ---------- */
.sourcing-hero {
  padding: 84px 0 44px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, var(--rose-pale) 0%, transparent 62%),
    var(--cream);
}
.sourcing-hero h1 {
  font-size: clamp(34px, 5vw, 54px);
  margin-bottom: 16px;
}
.sourcing-hero h1 em {
  font-style: italic;
  color: var(--rose);
}
.sourcing-hero p {
  max-width: 660px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 17px;
}
.sourcing-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}
.sourcing-tags li {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
}

/* ---------- Chat shell ---------- */
.sourcing-chat {
  padding: 0 0 92px;
}
.chat-shell {
  max-width: 880px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 620px;
}

/* ---------- Message list ---------- */
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 8px;
  scroll-behavior: smooth;
}

/* Welcome state */
.chat-welcome {
  text-align: center;
  padding: 34px 8px 20px;
}
.welcome-avatar {
  width: 58px; height: 58px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: 24px;
  color: var(--white);
  background: linear-gradient(135deg, var(--rose) 0%, var(--terra) 100%);
}
.chat-welcome h2 {
  font-size: 28px;
  margin-bottom: 10px;
}
.chat-welcome p {
  max-width: 560px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 15px;
}
.chat-welcome p em {
  color: var(--rose);
  font-style: normal;
}

/* Starter / suggestion chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}
.chip {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--ink-soft);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all .22s var(--ease);
}
.chip:hover {
  background: var(--rose-pale);
  border-color: var(--rose-soft);
  color: var(--ink);
}

/* ---------- Messages ---------- */
.msg {
  display: flex;
  margin-bottom: 18px;
  animation: msg-in .28s var(--ease) both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.msg__bubble {
  max-width: 78%;
  padding: 13px 17px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg__bubble strong { font-weight: 600; color: var(--ink); }

/* Buyer (right) */
.msg--user { justify-content: flex-end; }
.msg--user .msg__bubble {
  background: var(--ink);
  color: var(--cream);
}
.msg--user .msg__bubble strong { color: var(--white); }

/* Assistant (left) */
.msg--bot { justify-content: flex-start; }
.msg--bot .msg__bubble {
  background: var(--cream);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

/* Streaming caret */
.msg__bubble.is-streaming::after {
  content: '';
  display: inline-block;
  width: 7px; height: 15px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--rose);
  animation: caret 1s steps(2, start) infinite;
}
@keyframes caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Thinking indicator (before the first token arrives) */
.msg--thinking .msg__bubble {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 16px 18px;
}
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--rose-soft);
  animation: dot 1.2s infinite ease-in-out both;
}
.dot:nth-child(2) { animation-delay: .18s; }
.dot:nth-child(3) { animation-delay: .36s; }
@keyframes dot {
  0%, 80%, 100% { opacity: .28; transform: scale(.85); }
  40%           { opacity: 1;   transform: scale(1); }
}

/* Error message */
.msg--error .msg__bubble {
  background: #FBEDEC;
  border-color: #E8BFC2;
  color: #8A3F45;
}

/* Suggested follow-up actions rendered under an assistant reply */
.msg__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 18px;
  max-width: 78%;
}
.msg__actions .chip { font-size: 12.5px; padding: 7px 14px; }

/* ---------- Composer ---------- */
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  background: var(--cream);
}
.chat-composer textarea {
  flex: 1;
  resize: none;
  max-height: 132px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 15px;
  outline: none;
  transition: border-color .22s var(--ease);
}
.chat-composer textarea:focus { border-color: var(--rose-soft); }
.chat-composer textarea::placeholder { color: var(--muted); }

.chat-send,
.chat-stop {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .22s var(--ease);
}
.chat-send { background: var(--rose); color: var(--white); }
.chat-send:hover { background: var(--terra); }
.chat-send svg { width: 20px; height: 20px; }
.chat-send:disabled { opacity: .45; cursor: not-allowed; }

.chat-stop { background: var(--sand); color: var(--ink); }
.chat-stop:hover { background: var(--rose-soft); }
.chat-stop svg { width: 16px; height: 16px; fill: currentColor; }

.chat-footnote {
  padding: 0 18px 16px;
  background: var(--cream);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .sourcing-hero { padding: 60px 0 32px; }
  .chat-shell { height: calc(100vh - 190px); min-height: 460px; }
  .chat-log { padding: 20px 18px 6px; }
  .msg__bubble,
  .msg__actions { max-width: 88%; }
  .chat-welcome { padding: 22px 4px 14px; }
}

@media (max-width: 480px) {
  .chat-shell { height: calc(100vh - 168px); border-radius: 10px; }
  .chat-composer { padding: 12px; gap: 8px; }
  .chat-send, .chat-stop { width: 40px; height: 40px; }
  .msg__bubble,
  .msg__actions { max-width: 94%; }
}
