/* ============================================================
   VESTA — Ask Stylist / Try-On (#screen-tryon)
   Chat da estilista: header fixo-pegajoso, balões, input bar
   acima da bottom-nav, resultado da prova com .unveil.
   ============================================================ */

/* tela em coluna: o chat cresce e o dock (sugestões + input) gruda no fim,
   sempre acima da nav — dimensionado pelo shell, nunca pela viewport */
#screen-tryon.active { display: flex; flex-direction: column; padding-bottom: 0; }
#screen-tryon .st-chat { flex: 1; }

.st-title {
  text-align: center; font-size: var(--fs-14); font-weight: 600;
  padding: var(--sp-3) 0 var(--sp-2);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

/* ── zen: nenhuma mensagem ainda — brilho pêssego, saudação e chips centrais ── */
#screen-tryon.st-zen {
  background: radial-gradient(90% 64% at 50% 44%, #F3D9C8 0%, #F9EFE7 58%, var(--bg) 100%);
}
#screen-tryon.st-zen .st-title,
#screen-tryon.st-zen .st-head { background: transparent; border-color: transparent; }
#screen-tryon.st-zen .st-dock { background: transparent; border-top: 0; }
#screen-tryon.st-zen .st-chat { justify-content: center; }
.st-empty {
  display: grid; gap: var(--sp-5); justify-items: center;
  padding: var(--sp-6) var(--sp-4);
  animation: rise-in var(--t-slow) var(--ease-out) both;
}
.st-hello {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--fs-20); line-height: 1.35; text-align: center;
  max-width: 24ch;
}
.st-empty .st-chips {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-2);
}
.st-empty .chip { background: var(--surface); box-shadow: var(--shadow-1); border-color: transparent; color: var(--ink); padding: 12px 20px; }

/* ---- Header: estilista + quota + My avatar ---- */
.st-head {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.st-who { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.st-avatar {
  width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 50%; box-shadow: var(--shadow-1);
}
.st-idwrap { min-width: 0; }
.st-name {
  font-weight: 600; font-size: var(--fs-15); line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st-active {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-12); font-weight: 500; color: var(--success);
}
.st-active i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(46, 125, 79, .16);
}
.st-quota { flex: 0 0 auto; white-space: nowrap; }
.st-quota.low { color: var(--rust-deep); border-color: #EAD3C8; background: var(--rust-tint); }

.st-mybtn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 14px; flex: 0 0 auto;
  border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line-strong);
  font-size: var(--fs-13); font-weight: 500; color: var(--ink);
  transition: border-color var(--t-fast) var(--ease-out);
}
.st-mybtn:hover { border-color: var(--ink-soft); }
.st-mybtn svg { width: 16px; height: 16px; }


/* ---- Corpo do chat ---- */
.st-chat {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-5);
}

.st-msg {
  display: flex; flex-direction: column; align-items: flex-start;
  animation: rise-in var(--t-base) var(--ease-out) both;
}
.st-msg.me { align-items: flex-end; }

/* balões brancos dos dois lados (Mosso) — o lado + a hora contam quem falou */
.st-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: var(--fs-14); line-height: 1.5;
  overflow-wrap: anywhere;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.me .st-bubble { border-bottom-right-radius: 6px; border-radius: 20px 20px 6px 20px; }
.her .st-bubble { border-bottom-left-radius: 6px; }

.st-time {
  font-size: var(--fs-11); color: var(--ink-faint);
  margin-top: 4px; padding-inline: 4px;
}
.st-bubble p + p { margin-top: 8px; }
.st-bubble ul { margin-top: 8px; padding-left: 18px; list-style: disc; }
.st-bubble li + li { margin-top: 4px; }
.st-bubble strong { font-weight: 600; }

/* "Working my styling magic…" — pílula quente da estilista */
.her .st-bubble.st-pillmsg {
  background: var(--rust-tint); color: var(--rust-deep);
  border-color: #EAD3C8; box-shadow: none;
  font-size: var(--fs-13); font-weight: 500;
}

/* ---- Fotos no chat: cartão branco limpo dos dois lados ---- */
.st-bubble.st-photo {
  padding: 5px; width: 58%;
  background: var(--surface); border: 1px solid var(--line);
}
.st-photo .imgbox { border-radius: 12px; aspect-ratio: 3 / 4; }

/* resultado da prova — o momento assinatura */
.st-bubble.st-result { width: 78%; padding: 6px; box-shadow: var(--shadow-2); }

/* esqueleto do resultado enquanto o try-on é gerado */
.st-gerando { aspect-ratio: 3 / 4; border-radius: 12px; }
.st-gerando-txt {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  text-align: center;
  font-size: var(--fs-12); font-weight: 500; color: var(--ink-soft);
}
.st-bubble.st-photo { position: relative; }

.st-zoom { cursor: zoom-in; }

/* ---- Digitando (3 pontinhos) ---- */
.st-bubble.st-typing {
  display: inline-flex; gap: 5px; align-items: center;
  padding: 15px 16px;
}
.st-typing i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-faint);
  animation: dot-bounce 1.1s ease-in-out infinite;
}
.st-typing i:nth-child(2) { animation-delay: .15s; }
.st-typing i:nth-child(3) { animation-delay: .3s; }

/* ---- Dock: sugestões + input, sticky acima da bottom-nav ---- */
.st-dock {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-b));
  margin-top: auto;
  background: var(--bg-warm);
  border-top: 1px solid var(--line);
  z-index: 55;
}
/* chips persistentes acima do input durante a conversa */
.st-suggest {
  padding: var(--sp-3) var(--sp-4) 0;
  animation: rise-in var(--t-base) var(--ease-out) both;
}

/* input em pílula única: câmera dentro à esquerda, enviar rust dentro à direita */
.st-inputbar {
  display: flex; align-items: center; gap: 2px;
  margin: var(--sp-3) var(--sp-4) var(--sp-3);
  padding: 5px 6px 5px 4px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-1);
  transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}
.st-inputbar:focus-within { border-color: var(--ink-soft); box-shadow: var(--shadow-2); }
.st-cam {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-faint);
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.st-cam:hover { color: var(--ink); background: var(--surface-2); }
.st-cam svg { width: 20px; height: 20px; }

.st-field {
  flex: 1; min-width: 0; min-height: 40px;
  border: 0; background: none;
  padding: 0 var(--sp-1);
  font-size: var(--fs-14); color: var(--ink);
}
.st-field::placeholder { color: #9A968E; }
.st-field:focus { outline: none; }

.st-send {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--rust); color: #fff;
  transition: background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.st-send:hover { background: var(--rust-deep); }
.st-send:active { transform: scale(.94); }
.st-send svg { width: 18px; height: 18px; }

/* ---- Lightbox (Mosso): cartão branco arredondado sobre o chat esmaecido ---- */
.st-lightbox {
  position: fixed; inset: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
  background: rgba(30, 26, 22, .45);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fade-in var(--t-base) var(--ease-out) both;
}
.st-lightbox .lb-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 6px;
  box-shadow: var(--shadow-3);
  /* largura EXPLÍCITA (e sem vw): com auto, cartão e imagem dimensionavam um
     pelo outro e colapsavam num pontinho de 11px (lightbox "não abria") */
  width: min(100%, 460px);
  flex: 0 0 auto;
  animation: pop-in var(--t-slow) var(--ease-out) both;
}
.st-lightbox img {
  display: block;
  width: 100%; height: auto;
  max-height: calc(86dvh - 12px);
  object-fit: contain;
  border-radius: calc(var(--r-xl) - 4px);
  cursor: zoom-out;
}
.st-lightbox button {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .95); color: var(--ink);
  box-shadow: var(--shadow-1);
  transition: transform var(--t-fast) var(--ease-out);
}
.st-lightbox button:active { transform: scale(.92); }
