/* =====================================================================================
   Componente de chat dos formulários. Todo o visual vem dos tokens do tema (--f-*),
   definidos em server/themes.js. Nada de cor fixa aqui: um tema novo não precisa de CSS.
   Opções do tema: data-avatar="header|bubble" e data-press="1" (botões que afundam).
   ===================================================================================== */
.lf-chat {
  position: relative; display: flex; flex-direction: column; overflow: hidden; height: 100%;
  border-radius: 24px; color: var(--f-ink); font: var(--f-body-weight) 14.5px/1.45 var(--f-body);
  background-color: var(--f-bg); background-image: var(--f-bg-image); background-size: var(--f-bg-size);
}
.lf-head {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 11px 13px 10px;
  background-color: var(--f-head-bg); background-image: var(--f-head-image); background-size: 14px 14px;
  color: var(--f-head-ink); border-bottom: var(--f-head-border);
  backdrop-filter: blur(var(--f-blur)); -webkit-backdrop-filter: blur(var(--f-blur));
}
.lf-avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--f-avatar-bg); border: var(--f-avatar-ring); }
.lf-avatar img { width: 120%; max-width: none; height: auto; margin-top: 18%; }
.lf-title { font-family: var(--f-display); font-weight: var(--f-display-weight); font-size: var(--f-title-size); letter-spacing: var(--f-title-spacing); text-transform: var(--f-title-transform); line-height: 1.1; }
.lf-sub { font-size: 11.5px; opacity: .8; }
.lf-step { margin-left: auto; font-size: 11.5px; font-weight: 700; opacity: .85; font-variant-numeric: tabular-nums; }
.lf-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--f-track); }
.lf-progress i { display: block; height: 100%; background: var(--f-accent); box-shadow: var(--f-progress-glow); transition: width .4s ease; }

.lf-log { flex: 1; overflow-y: auto; padding: 16px 12px 10px; display: flex; flex-direction: column; gap: 7px; }
.lf-row { display: flex; align-items: flex-end; gap: 7px; }
.lf-row.user { justify-content: flex-end; }
.lf-msg { max-width: 84%; padding: 9px 13px; border-radius: var(--f-radius); overflow-wrap: anywhere; animation: lf-pop .25s ease both; }
.lf-msg.bot { background: var(--f-bot-bg); color: var(--f-bot-ink); border: var(--f-bot-border); box-shadow: var(--f-bot-shadow); border-bottom-left-radius: 6px; backdrop-filter: blur(calc(var(--f-blur) * .8)); }
.lf-msg.user { background: var(--f-user-bg); color: var(--f-user-ink); border: var(--f-user-border); box-shadow: var(--f-user-shadow); border-bottom-right-radius: 6px; font-weight: var(--f-user-weight); }
.lf-msg.big { font-family: var(--f-display); font-weight: var(--f-display-weight); font-size: var(--f-big-size); line-height: 1.15; }
/* avatar ao lado do balão (estilo chatbot comum): aparece só no último balão de cada sequência */
.lf-mini { display: none; width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--f-avatar-bg) url('/img/lipy-acenando.png') center 30% / 150% auto no-repeat; visibility: hidden; }
.lf-chat[data-avatar="bubble"] .lf-mini { display: block; }
.lf-row.tail .lf-mini { visibility: visible; }
.lf-chat[data-avatar="bubble"] .lf-row.user .lf-msg { margin-left: 33px; }

.lf-dock:empty { display: none; }
.lf-dock { max-height: 52%; overflow-y: auto; border-top: var(--f-dock-border); background: var(--f-dock-bg); padding: 11px 11px 13px; backdrop-filter: blur(var(--f-blur)); }
.lf-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.lf-chip {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: var(--f-chip-border); background: var(--f-chip-bg); color: var(--f-chip-ink); box-shadow: var(--f-chip-shadow);
  border-radius: var(--f-chip-radius); padding: 8px 12px; font: var(--f-chip-weight) 14px/1.2 var(--f-body); cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
}
.lf-chip:hover { background: var(--f-chip-hover); }
.lf-chip:disabled { opacity: .35; cursor: not-allowed; }
.lf-chat[data-press="1"] .lf-chip:active { transform: translateY(3px); box-shadow: none; }
.lf-flavor { justify-content: flex-start; }
.lf-dot { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 2px solid rgba(0, 0, 0, .22); }
/* escolha por imagem (ex.: embalagens): grade de cartões com a foto */
.lf-packs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.lf-pack { flex-direction: column; gap: 3px; padding: 6px 3px 7px; font-size: 11px; line-height: 1.1; min-width: 0; border-radius: min(var(--f-chip-radius), 14px); }
.lf-pack span { max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-align: center; }
.lf-pack img { width: 100%; max-width: 64px; aspect-ratio: 4 / 5; object-fit: contain; filter: var(--f-mascot-filter); }
.lf-cta {
  width: 100%; border: var(--f-cta-border); border-radius: var(--f-chip-radius); padding: 12px 16px; cursor: pointer;
  background: var(--f-cta-bg); color: var(--f-cta-ink); box-shadow: var(--f-cta-shadow);
  font-family: var(--f-display); font-weight: var(--f-display-weight); font-size: var(--f-cta-size); text-transform: var(--f-title-transform);
}
.lf-mascot { display: block; width: 140px; margin: 0 auto; filter: var(--f-mascot-filter); }

@keyframes lf-pop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lf-msg { animation: none; } .lf-progress i, .lf-chip { transition: none; } }

/* ---------- motor do chat: linhas, digitação, entradas ---------- */
.lf-row.mascot { justify-content: center; }
.lf-row.mascot .lf-mascot { width: 130px; animation: lf-pop .3s ease both; }
.lf-typing { display: inline-flex; gap: 4px; padding: 12px 13px; border-radius: var(--f-radius); background: var(--f-bot-bg); border: var(--f-bot-border); box-shadow: var(--f-bot-shadow); color: var(--f-bot-ink); }
.lf-typing i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .45; animation: lf-blink 1s infinite; }
.lf-typing i:nth-child(2) { animation-delay: .15s; } .lf-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes lf-blink { 50% { opacity: 1; transform: translateY(-2px); } }
.lf-img { max-width: 220px; border-radius: var(--f-radius); display: block; }
.lf-chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.lf-chip[aria-pressed="true"] { background: var(--f-cta-bg); color: var(--f-cta-ink); }
.lf-chip .lf-rank { font-weight: 900; min-width: 0; }
.lf-chip .lf-rank:empty { display: none; }
.lf-scale { display: grid; gap: 5px; }
.lf-num { flex-direction: column; gap: 1px; padding: 7px 0; }
.lf-num small { font-size: 11px; opacity: .75; }
.lf-face { font-size: 22px; line-height: 1; }
.lf-snack { width: 26px; height: 26px; object-fit: contain; }
.lf-big-num { font-size: 18px; font-weight: 800; }
.lf-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--f-muted); margin-top: 5px; font-weight: 700; }
.lf-hint { margin: 7px 0 0; text-align: center; font-size: 12.5px; color: var(--f-muted); }
.lf-row-input, .lf-date { display: flex; gap: 7px; align-items: stretch; }
.lf-date { display: grid; grid-template-columns: 1fr 1.3fr 1.2fr 46px; }
.lf-input { flex: 1; min-width: 0; width: 100%; border: var(--f-chip-border); background: var(--f-chip-bg); color: var(--f-ink); border-radius: min(var(--f-chip-radius), 14px); padding: 10px 12px; font: var(--f-chip-weight) 15px/1.3 var(--f-body); }
textarea.lf-input { resize: vertical; min-height: 64px; }
select.lf-input { padding: 10px 6px; }
.lf-input::placeholder { color: var(--f-muted); opacity: 1; }
.lf-input:focus { outline: 2px solid var(--f-accent); outline-offset: 1px; }
.lf-send { flex: none; width: 46px; border: var(--f-cta-border); border-radius: min(var(--f-chip-radius), 14px); background: var(--f-cta-bg); color: var(--f-cta-ink); box-shadow: var(--f-cta-shadow); cursor: pointer; font-size: 19px; font-weight: 900; }
.lf-skip { display: block; margin: 8px auto 0; background: none; border: 0; color: var(--f-muted); text-decoration: underline; cursor: pointer; font: 700 13px var(--f-body); }
.lf-err { color: #e5383b; font-size: 12.5px; font-weight: 800; text-align: center; margin-top: 6px; }
.lf-stack { display: grid; gap: 6px; }
.lf-stack .lf-cta, .lf-cta { display: block; text-align: center; text-decoration: none; }
.lf-link { text-align: center; color: var(--f-ink); font-size: 13px; font-weight: 700; }
.lf-share { display: flex; gap: 7px; align-items: center; background: var(--f-chip-bg); border: var(--f-chip-border); border-radius: min(var(--f-chip-radius), 14px); padding: 7px 7px 7px 12px; margin-bottom: 7px; }
.lf-share code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 12.5px ui-monospace, Menlo, monospace; color: var(--f-ink); }
.lf-wa { text-decoration: none; justify-content: center; }
.lf-chip:disabled, .lf-cta:disabled, .lf-send:disabled { opacity: .45; cursor: not-allowed; }
.lf-chat[data-press="1"] .lf-cta:active, .lf-chat[data-press="1"] .lf-send:active { transform: translateY(3px); box-shadow: none; }
