/* Nellia — vídeo interativo "Veja a Nellia funcionando" (templates/_tour.html +
   static/js/tour.js). Usa os tokens de landing.css (precisa vir carregado
   antes). Tudo com prefixo .tour- pra não colidir com .step etc. das páginas
   que incluem o componente. */

.tour {
  --tour-me: #d9f0bd;
  --tour-me-ink: #22331a;
  --tour-chat-bg: #eef3e6;
  --tour-phone-frame: #1f2b19;
  background: var(--surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: clamp(14px, 2.4vw, 26px);
  max-width: 64rem;
  margin-inline: auto;
}
@media (prefers-color-scheme: dark) {
  .tour {
    --tour-me: #35511f;
    --tour-me-ink: #eef2ea;
    --tour-chat-bg: #141c10;
    --tour-phone-frame: #05080a;
  }
}

/* ---------- Palco ---------- */

.tour-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
  background: var(--surface-tint);
  border-radius: 20px;
  padding: clamp(16px, 3vw, 36px);
  overflow: hidden;
  min-height: 600px;
}
.tour-stage::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% 30%;
  height: 90%;
  background: radial-gradient(50% 50% at 50% 50%, color-mix(in srgb, var(--brand-400) 26%, transparent), transparent 70%);
  pointer-events: none;
}
@media (min-width: 52rem) {
  .tour-stage { grid-template-columns: 1.1fr 0.9fr; gap: 36px; min-height: 620px; }
}

/* ---------- Texto da cena ---------- */

.tour-copy { position: relative; z-index: 1; order: 2; }
@media (min-width: 52rem) { .tour-copy { order: 0; } }

.tour-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-text);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  margin-bottom: 14px;
}
.tour-title {
  font-size: clamp(1.6rem, 1.1rem + 2vw, 2.4rem);
  margin-bottom: 14px;
}
.tour-caption {
  font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink);
  max-width: 34ch;
  min-height: 5.2em;
}
.tour.tour-cc-off .tour-caption { visibility: hidden; }

.tour-hint {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #1a2914;
  background: var(--brand-gradient);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  box-shadow: var(--shadow-card);
  animation: tour-bob 1.4s ease-in-out infinite;
}
.tour-hint[hidden] { display: none; }
.tour-hint { flex-wrap: wrap; row-gap: 2px; max-width: 30rem; }
.tour-hint small { flex-basis: 100%; font-weight: 500; font-size: 0.82rem; opacity: 0.8; }

.tour-end-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.tour-end-cta[hidden] { display: none; }

/* ---------- Celular ---------- */

.tour-device { position: relative; z-index: 1; display: flex; justify-content: center; order: 1; }

.tour-phone {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 9 / 18.5;
  max-height: 560px;
  background: var(--tour-chat-bg);
  border: 10px solid var(--tour-phone-frame);
  border-radius: 38px;
  box-shadow: 0 24px 50px rgba(31, 43, 25, 0.28);
  overflow: hidden;
  transition: transform 500ms var(--ease-out-expo);
}
@media (max-width: 52rem) {
  .tour-phone { width: min(270px, 74vw); max-height: 500px; }
}
.tour-notch {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 34%;
  height: 18px;
  border-radius: 12px;
  background: var(--tour-phone-frame);
  z-index: 6;
}

.tour-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.98);
  transition: opacity 400ms ease, transform 400ms var(--ease-out-expo), visibility 0s linear 400ms;
}
.tour-screen.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 400ms ease, transform 400ms var(--ease-out-expo), visibility 0s;
}

/* Tela dos aplicativos */
.tour-apps {
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: linear-gradient(160deg, var(--ink) 0%, #1f2b19 100%);
  color: #fff;
  text-align: center;
  padding: 20px;
}
.tour-apps-label { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1rem; opacity: 0.8; }
.tour-apps-grid { display: flex; gap: 26px; }
.tour-app { display: grid; justify-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; transition: transform 300ms var(--ease-out-expo); }
.tour-app-icon {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.tour-app-icon svg { width: 34px; height: 34px; }
.tour-app-wa { background: #2fa84f; }
.tour-app-tg { background: #3390d6; }
.tour-app.is-lit { transform: scale(1.12); }
.tour-app.is-lit .tour-app-icon { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.85); }
.tour-apps-note {
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
}

/* Tela da conversa */
.tour-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 30px 14px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-hairline);
}
.tour-chat-head img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  background: var(--surface-tint);
}
.tour-chat-head strong { display: block; font-size: 0.95rem; line-height: 1.2; }
.tour-chat-head span { font-size: 0.75rem; color: var(--brand-text); }

.tour-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 10px;
  overflow: hidden;
}

.tour-msg {
  max-width: 86%;
  padding: 8px 11px 6px;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.42;
  white-space: pre-line;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  animation: tour-pop 380ms var(--ease-out-expo);
}
.tour-msg time { display: block; text-align: right; font-size: 0.65rem; opacity: 0.6; margin-top: 2px; }
.tour-msg-me { align-self: flex-end; background: var(--tour-me); color: var(--tour-me-ink); border-bottom-right-radius: 4px; }
.tour-msg-nellia { align-self: flex-start; background: var(--surface); color: var(--ink); border-bottom-left-radius: 4px; }
.tour-msg.no-anim { animation: none; }

.tour-voice { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.tour-voice-play {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-text);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tour-voice-play svg { width: 12px; height: 12px; }
.tour-wave { display: flex; align-items: center; gap: 2px; height: 22px; flex: 1; }
.tour-wave i { display: block; width: 3px; border-radius: 2px; background: currentColor; opacity: 0.55; }
.tour-voice-said { display: block; font-style: italic; font-size: 0.74rem; opacity: 0.8; margin-top: 4px; }

.tour-photo {
  width: 170px;
  border-radius: 10px;
  background: #fffdf6;
  color: #3a3a30;
  padding: 10px 12px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.62rem;
  line-height: 1.5;
  transform: rotate(-2deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  margin-bottom: 4px;
  white-space: normal;
}
.tour-photo b { display: block; font-size: 0.68rem; text-align: center; margin-bottom: 4px; }
.tour-photo .tot { border-top: 1px dashed #999; margin-top: 4px; padding-top: 3px; font-weight: 700; display: flex; justify-content: space-between; }
.tour-photo .row { display: flex; justify-content: space-between; }

.tour-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.tour-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: tour-dot 1s infinite ease-in-out; }
.tour-typing i:nth-child(2) { animation-delay: 0.15s; }
.tour-typing i:nth-child(3) { animation-delay: 0.3s; }

.tour-inputbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border-hairline);
}
.tour-input {
  flex: 1;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
}
.tour-input-placeholder { color: var(--ink-soft); opacity: 0.7; }
.tour-rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #d64535; animation: tour-blink 1s infinite; flex-shrink: 0; }
.tour-input .tour-wave { color: #d64535; height: 18px; }
.tour-input .tour-wave i { animation: tour-wave 0.7s infinite ease-in-out alternate; }

.tour-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink-soft);
}
.tour-icon-btn svg { width: 20px; height: 20px; }
.tour-mic { background: var(--brand-gradient); color: #1a2914; }
.tour-mic.is-recording { background: #d64535; color: #fff; transform: scale(1.2); }
.tour-icon-btn.is-hint { cursor: pointer; z-index: 3; }
.tour-icon-btn.is-hint::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid var(--brand-600);
  animation: tour-ring 1.2s ease-out infinite;
}
.tour-camera.is-hint { background: var(--surface-tint); color: var(--brand-text); }

/* Painel */
.tour-panel { background: var(--bg); padding: 30px 12px 12px; gap: 10px; overflow: hidden; }
.tour-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.75rem; font-weight: 700; color: var(--ink-soft); }
.tour-panel-head img { height: 22px; width: auto; }
.tour-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tour-kpi { background: var(--surface); border-radius: 14px; padding: 9px 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.tour-kpi span { display: block; font-size: 0.66rem; color: var(--ink-soft); font-weight: 600; }
.tour-kpi strong { font-family: "Space Grotesk", sans-serif; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.tour-kpi-wide { grid-column: 1 / -1; background: linear-gradient(160deg, var(--ink) 0%, #1f2b19 100%); color: #fff; }
.tour-kpi-wide span { color: rgba(255, 255, 255, 0.75); }
.tour-panel-sub { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-top: 4px; }
.tour-panel-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.tour-panel-list li {
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  gap: 1px;
  font-size: 0.76rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 400ms ease, transform 400ms var(--ease-out-expo);
}
.tour-panel-list li.is-on { opacity: 1; transform: none; }
.tour-panel-list small { color: var(--ink-soft); }
.tour-tag { justify-self: start; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; border-radius: var(--radius-pill); padding: 1px 8px; margin-bottom: 2px; }
.tour-tag-task { background: color-mix(in srgb, var(--brand-400) 30%, transparent); color: var(--brand-text); }
.tour-tag-money { background: color-mix(in srgb, #e0a526 25%, transparent); color: #8a5a00; }
@media (prefers-color-scheme: dark) { .tour-tag-money { color: #f0c060; } }

/* Aviso (notificação no celular de outra pessoa) e chip de horário */
.tour-toast {
  position: absolute;
  top: 30px;
  left: 8px;
  right: 8px;
  z-index: 5;
  background: var(--ink);
  color: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 0.75rem;
  line-height: 1.4;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  transform: translateY(calc(-100% - 40px));
  visibility: hidden;
  transition: transform 500ms var(--ease-out-expo), visibility 0s linear 500ms;
}
@media (prefers-color-scheme: dark) { .tour-toast { background: #2c3a24; } }
.tour-toast.is-on { transform: none; visibility: visible; transition: transform 500ms var(--ease-out-expo), visibility 0s; }
.tour-toast strong { display: block; font-size: 0.7rem; opacity: 0.8; margin-bottom: 2px; }

.tour-timechip {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 72%, transparent);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  white-space: pre-line;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 350ms ease, visibility 0s linear 350ms;
}
.tour-timechip.is-on { opacity: 1; visibility: visible; transition: opacity 350ms ease, visibility 0s; }

/* ---------- Capa ---------- */

.tour-poster {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--surface-tint) 55%, transparent);
  backdrop-filter: blur(3px);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  padding: 20px;
}
.tour-poster[hidden] { display: none; }
.tour-poster-play {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #1a2914;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 40px rgba(84, 103, 42, 0.35);
  transition: transform 200ms var(--ease-out-expo);
}
.tour-poster:hover .tour-poster-play { transform: scale(1.06); }
.tour-poster-play svg { width: 42px; height: 42px; margin-left: 6px; }
.tour-poster-text {
  display: grid;
  gap: 4px;
  text-align: center;
  background: var(--surface);
  border-radius: 18px;
  padding: 12px 22px;
  box-shadow: var(--shadow-card);
}
.tour-poster-text strong { font-family: "Space Grotesk", sans-serif; font-size: 1.3rem; }
.tour-poster-text span { color: var(--ink-soft); font-size: 0.95rem; }

/* ---------- Barra de progresso e controles ---------- */

.tour-progress { display: flex; gap: 4px; margin: 16px 2px 10px; }
.tour-progress span {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border-hairline);
  overflow: hidden;
}
.tour-progress span i { display: block; height: 100%; width: 0; background: var(--brand-gradient); }

.tour-controls { display: flex; align-items: center; gap: 8px; }
.tour-ctrl-spacer { flex: 1; }
.tour-ctrl {
  min-width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0 12px;
}
.tour-ctrl:hover { background: var(--surface-tint); }
.tour-ctrl svg { width: 22px; height: 22px; }
.tour-ctrl-main { min-width: 64px; height: 56px; background: var(--brand-gradient); color: #1a2914; border: 0; }
.tour-ctrl-main:hover { background: var(--brand-gradient); filter: brightness(1.04); }
.tour-ctrl-text[aria-pressed="false"] { color: var(--ink-soft); text-decoration: line-through; }
.tour-i-pause, .tour-i-muted { display: none; }
.tour.is-playing .tour-i-play { display: none; }
.tour.is-playing .tour-i-pause { display: block; }
.tour.is-muted .tour-i-sound { display: none; }
.tour.is-muted .tour-i-muted { display: block; }

.tour-chapters { margin-top: 14px; }
.tour-chapters ol {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 2px 2px 6px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tour-chapters button {
  white-space: nowrap;
  border: 1px solid var(--border-hairline);
  background: var(--bg);
  color: var(--ink-soft);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  min-height: 40px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.tour-chapters button[aria-current="step"] { background: var(--brand-gradient); color: #1a2914; border-color: transparent; }
.tour-chapters button b { font-family: "Space Grotesk", sans-serif; margin-right: 4px; }

/* ---------- Animações ---------- */

@keyframes tour-pop { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes tour-dot { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes tour-ring { from { transform: scale(0.9); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes tour-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes tour-blink { 50% { opacity: 0.2; } }
@keyframes tour-wave { from { transform: scaleY(0.4); } to { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
  .tour-hint, .tour-icon-btn.is-hint::after { animation: none; }
}
