/* Chat runtime styles.
 *
 * Lifted verbatim from the chat block of index.html so the bot runtime, the
 * standalone /bot/<slug> page and the embed all render exactly like the
 * Concierge the client already approved — one stylesheet, one look.
 *
 * The :root block below repeats only the tokens this file consumes, with the
 * same values as index.html. The page still declares its own :root afterwards
 * with identical values, so including both is a no-op there; on /bot/<slug>,
 * where no page stylesheet exists, these are the only definitions.
 *
 * Per-bot theming overrides the custom properties inline on .chat-root, which
 * beats :root on specificity without touching this file.
 */

:root {
  --chat-bg: #F7F4EE;
  --ink: #1C1917;
  --ink-soft: #57534E;
  --ink-muted: #6B6258;
  --line: #DDD5C7;
  --line-soft: #E5E0D5;
  --terracotta: #96442B;
  --wine: #7A3B2E;
  --gold: #C99B3F;
  --gold-text: #8A621C;
  --gold-light: #F0CC7B;
  --gold-btn: #E9BE6C;
  --banner: #241F18;
  --banner-icon: #3D362C;
  --on-dark: #F5F1E9;
  --on-dark-muted: #E7DED0;
  --control-line: #9B8F7C;
  --focus: #96442B;
  --bubble-bot: #ECE8DF;
  --bubble-user: #6F6A62;
  --reco-1: #2A241C;
  --reco-2: #181410;
  --serif: Georgia, 'Times New Roman', 'Playfair Display', serif;
  --shadow-md: 0 4px 6px -1px rgba(28,25,23,.08), 0 2px 4px -2px rgba(28,25,23,.06);
  --shadow-lg: 0 12px 24px -8px rgba(28,25,23,.18);
}

/* The chat markup relies on these two rules from the page's base styles. */
.chat-root, .chat-root *, .chat-root *::before, .chat-root *::after { box-sizing: border-box; }
.chat-root [hidden], .chat-root[hidden] { display: none !important; }

/* The chat states its own ink instead of inheriting the host document's.
 *
 * Several surfaces here paint a light background and leave the text colour to
 * inheritance — fine on the page this was lifted from, where `body` is dark on
 * cream. It is not fine anywhere else: the builder's preview injects this file
 * into the panel itself, so when the panel went dark the option buttons became
 * near-white text on their own #fff background and vanished. The runtime also
 * renders unframed on /bot/<slug>, so any host with light text would do the
 * same. One declaration makes the whole subtree independent of that. */
.chat-root { color: var(--ink); }
/* ====================== Chat: overlay + sheet ====================== */
.chat-overlay {
  position: fixed; inset: 0;
  background: rgba(24,18,12,.45);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.chat-root.open .chat-overlay { opacity: 1; pointer-events: auto; }

.chat-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  margin: 0 auto;
  width: 100%;
  height: 90dvh;
  max-height: 90dvh;
  background: var(--chat-bg);
  border-radius: 1.5rem 1.5rem 0 0;
  box-shadow: 0 -12px 40px rgba(0,0,0,.22);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(105%);
  transition: transform .3s cubic-bezier(.32,.72,.32,1);
}
@supports not (height: 1dvh) {
  .chat-sheet { height: 90vh; max-height: 90vh; }
}
.chat-root.open .chat-sheet { transform: translateY(0); }

@media (min-width: 700px) {
  .chat-sheet {
    left: 50%; right: auto; bottom: auto;
    top: 50%;
    width: min(620px, calc(100vw - 3rem));
    height: min(780px, 92vh);
    max-height: 92vh;
    border-radius: 1.75rem;
    transform: translate(-50%, -46%);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
  }
  .chat-root.open .chat-sheet {
    transform: translate(-50%, -50%);
    opacity: 1;
    pointer-events: auto;
  }
}

/* ------------------------- Chat: header ------------------------- */
.chat-header {
  flex: none;
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem;
  background: #fff;
}
.chat-avatar {
  width: 44px; height: 44px;
  border-radius: 999px;
  object-fit: cover;
}
.chat-id { flex: 1; min-width: 0; }
.chat-name { font-weight: 700; font-size: .9375rem; }
.chat-status {
  display: flex; align-items: center; gap: .375rem;
  font-size: .8125rem; color: var(--ink-muted);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--gold-text);
}
.chat-close {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 999px;
  border: 0;
  background: #F0EDE6;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #57534E;
  transition: background .15s ease;
}
.chat-close:hover { background: #E5E0D5; }
.chat-close:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.chat-close svg { width: 16px; height: 16px; }

/* barra de progresso do diagnóstico (vinho, sob o header) */
.chat-progress {
  flex: none;
  height: 3px;
  background: rgba(122,59,46,.12);
}
.chat-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: var(--wine);
  transition: width .45s ease;
}

/* ---------------------- Welcome screen ---------------------- */
.chat-welcome {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 2rem 1.75rem calc(2rem + env(safe-area-inset-bottom));
}
.welcome-avatar-wrap {
  position: relative;
  width: 104px; height: 104px;
  border-radius: 999px;
  border: 1px solid #D8D2C4;
  padding: 5px;
  background: #fff;
}
.welcome-avatar {
  width: 100%; height: 100%;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}
.welcome-avatar-wrap::after {
  content: '';
  position: absolute;
  right: 6px; bottom: 6px;
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--gold-text);
  border: 2.5px solid #fff;
}
.welcome-kicker {
  margin-top: 1.5rem;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.welcome-title {
  margin: .625rem 0 0;
  font-family: var(--serif);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.25;
  max-width: 22ch;
}
.welcome-sub {
  margin: .75rem auto 0;
  max-width: 44ch;
  font-size: .9375rem;
  color: var(--ink-soft);
}
.welcome-start {
  margin-top: 1.5rem;
  width: 100%; max-width: 360px;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  background: var(--banner);
  color: #fff;
  border: 0;
  border-radius: 1rem;
  padding: .625rem .625rem .625rem 1.375rem;
  font-weight: 700;
  font-size: .9375rem;
  cursor: pointer;
  transition: transform .15s ease;
}
.welcome-start:hover { transform: scale(1.02); }
.welcome-start:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.welcome-start-arrow {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 999px;
  background: var(--gold-btn);
  color: #241E17;
  display: flex; align-items: center; justify-content: center;
}
.welcome-start-arrow svg { width: 16px; height: 16px; }
.welcome-note {
  margin-top: .875rem;
  font-size: .8125rem;
  color: var(--ink-muted);
}

/* ------------------------ Chat: mensagens ------------------------ */
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem 1.25rem .625rem;
  display: flex; flex-direction: column; gap: .625rem;
  overscroll-behavior: contain;
}
.chat-welcome,
.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(87,83,78,.42) transparent;
}
.chat-welcome::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-welcome::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-welcome::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(87,83,78,.36);
  border-radius: 999px;
}
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  max-width: 88%;
  animation: bubbleIn .28s ease both;
}
.msg-avatar {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 999px;
  background: #181410;
  color: var(--gold-btn);
  font-family: var(--serif);
  font-size: .8125rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .04em;
}
.bubble {
  padding: .625rem .875rem;
  font-size: .9375rem;
  line-height: 1.45;
  word-wrap: break-word;
  min-width: 0;
}
.bubble-bot {
  background: var(--bubble-bot);
  color: var(--ink);
  border-radius: 1.125rem 1.125rem 1.125rem .375rem;
}
.bubble-user {
  align-self: flex-end;
  max-width: 82%;
  background: var(--bubble-user);
  color: #fff;
  border-radius: 1.125rem 1.125rem .375rem 1.125rem;
  animation: bubbleIn .28s ease both;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.typing {
  display: flex; gap: 4px;
  padding: .75rem .875rem;
  background: var(--bubble-bot);
  border-radius: 1.125rem 1.125rem 1.125rem .375rem;
}
.typing span {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: #A8A196;
  animation: typingDot 1.1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* -------- opções numeradas (no fluxo das mensagens) -------- */
.choices {
  display: grid;
  gap: .625rem;
  margin: .25rem 0 .25rem 2.25rem; /* alinha com os balões (avatar 28px + gap) */
  animation: bubbleIn .28s ease both;
}
.chip {
  display: flex; align-items: center; gap: .75rem;
  width: 100%;
  min-height: 54px;
  background: #fff;
  /* Stated, not inherited. A <button> takes its colour from the user agent
     unless a reset says otherwise, and Tailwind's preflight — present in the
     panel, absent on the public page — sets `color: inherit`. Declaring it
     here makes the two environments render the same instead of one using the
     UA's button colour and the other whatever the host document inherits. */
  color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 1rem;
  padding: .75rem .875rem;
  text-align: left;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.chip:hover { transform: translateX(3px); box-shadow: var(--shadow-md); border-color: #D6D0C2; }
.chip:focus-visible { outline: 3px solid rgba(28,25,23,.35); outline-offset: 2px; }
.chip-num {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: #FAF8F3;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--ink-muted);
  display: flex; align-items: center; justify-content: center;
}
.chip-label { flex: 1; }
.chip svg { flex: none; width: 16px; height: 16px; color: var(--ink-muted); }

/* ------------------- Card de recomendação (escuro) ------------------- */
.reco-card {
  align-self: stretch;
  margin: .25rem 0 .25rem 2.25rem;
  background: linear-gradient(170deg, var(--reco-1), var(--reco-2));
  border-radius: 1.375rem;
  padding: 1.5rem 1.375rem;
  color: #F5F1E9;
  animation: bubbleIn .3s ease both;
}
.reco-check {
  width: 42px; height: 42px;
  border-radius: 999px;
  background: var(--gold-btn);
  color: #241E17;
  font-weight: 800;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.reco-kicker {
  margin-top: 1rem;
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold-btn);
}
.reco-name {
  margin-top: .375rem;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}
.reco-divider {
  margin: 1rem 0;
  border: 0;
  border-top: 1px solid rgba(245,241,233,.14);
}
.reco-tagline {
  font-size: .875rem;
  color: rgba(245,241,233,.75);
  line-height: 1.5;
}
.reco-bullets {
  list-style: none;
  margin: .875rem 0 0;
  padding: 0;
  display: grid;
  gap: .5rem;
}
.reco-bullets li {
  display: flex;
  gap: .5rem;
  font-size: .8125rem;
  color: rgba(245,241,233,.85);
}
.reco-bullets li::before {
  content: '✓';
  color: var(--gold-btn);
  font-weight: 700;
}
.reco-cta {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%;
  margin-top: 1.25rem;
  background: var(--gold-btn);
  color: #241E17;
  border: 0;
  border-radius: .875rem;
  padding: .9375rem 1.125rem;
  font-weight: 800;
  font-size: .9375rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease;
}
.reco-cta:hover { transform: scale(1.02); }
.reco-cta:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 3px; }
.reco-cta svg { width: 16px; height: 16px; }
.reco-unavailable {
  margin: 1.25rem 0 0;
  padding: .875rem 1rem;
  border: 1px solid rgba(245,241,233,.2);
  border-radius: .875rem;
  color: var(--on-dark-muted);
  font-size: .875rem;
  text-align: center;
}
.reco-restart {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin: .875rem auto 0;
  padding: .5rem .75rem;
  background: none;
  border: 0;
  font-size: .8125rem;
  color: rgba(245,241,233,.55);
  text-decoration: underline;
  cursor: pointer;
}
.reco-restart:hover { color: rgba(245,241,233,.8); }
.reco-restart:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; border-radius: .5rem; }

/* ---------------------- Chat: área de input ---------------------- */
.chat-input-area {
  flex: none;
  padding: .75rem 1.25rem calc(.875rem + env(safe-area-inset-bottom));
  background: var(--chat-bg);
}
.chat-input-area:empty { padding: 0 0 env(safe-area-inset-bottom); }
.text-input-row { display: flex; gap: .5rem; }
.text-input-row input {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: .625rem 1.125rem;
  font: inherit;
  font-size: 16px; /* evita zoom do iOS */
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.text-input-row input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(28,25,23,.08); }
.send-btn {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 999px;
  border: 0;
  background: var(--banner);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.send-btn:hover { transform: scale(1.06); }
.send-btn:disabled { opacity: .4; cursor: default; transform: none; }
.send-btn svg { width: 18px; height: 18px; }

.restart-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow .15s ease;
}
.restart-btn:hover { box-shadow: var(--shadow-md); }
.restart-btn:focus-visible,
.send-btn:focus-visible,
.chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-height: 650px) {
  .chat-welcome { justify-content: flex-start; }
  .welcome-avatar-wrap { width: 82px; height: 82px; }
  .welcome-kicker { margin-top: 1rem; }
  .welcome-title { font-size: 1.4rem; }
  .welcome-start { margin-top: 1rem; }
}

/* Scoped copy of the page's reduced-motion rule: the standalone bot page and
   the embed have no page stylesheet to inherit it from. Scoped to .chat-root so
   this file never disables animation on a host page. */
@media (prefers-reduced-motion: reduce) {
  .chat-root, .chat-root *, .chat-root *::before, .chat-root *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
