/* ── TOUR DE BOAS-VINDAS (assets/js/tour.js) ──────────────────────────────────
   Anel que escurece a tela em volta do alvo + caixa fixa embaixo. Cores só por variável do
   Bootstrap: o tema escuro troca as variáveis e a caixa acompanha (sem cor fixa clara, sem função de cor moderna).
   Camadas: véu/anel 1990 e caixa 2001, acima do botão de relatar problema (2000), que fica
   escondido durante o tour, exceto no passo que o destaca. */

.tour-veu {
  position: fixed; inset: 0; z-index: 1990; display: none;
  background: rgba(3, 8, 18, .55);
}
.tour-veu.on { display: block; }

.tour-foco {
  position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 1990;
  pointer-events: none; border-radius: 10px; opacity: 0;
  transition: opacity .3s ease;
  will-change: left, top, width, height;
  box-shadow: 0 0 0 2px var(--bs-primary), 0 0 0 200vmax rgba(3, 8, 18, .55);
}
.tour-foco.on { opacity: 1; }
.tour-foco::after {
  content: ""; position: absolute; inset: -5px; border-radius: 14px;
  border: 2px solid var(--bs-primary); opacity: 0;
  animation: tour-pulso 1.6s ease-in-out infinite;
}
@keyframes tour-pulso { 0%, 100% { opacity: .15; } 50% { opacity: .85; } }

.tour-caixa {
  position: fixed; z-index: 2001; display: none;
  left: 50%; bottom: 12px; transform: translateX(-50%);
  width: min(700px, calc(100vw - 32px));
  padding: 8px 10px 14px 16px; border-radius: 14px;
  background: var(--bs-body-bg); color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
  transition: opacity .3s ease;
  outline: none;
}
.tour-caixa.on { display: block; }
.tour-caixa.esmaece { opacity: .55; transition: opacity 1.6s ease; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tour-aviso { margin: 6px 0 4px; font-size: .85rem; color: var(--bs-warning-text-emphasis); }

.tour-topo { display: flex; align-items: center; gap: 8px; }
.tour-passo {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: .75rem; letter-spacing: .04em; color: var(--bs-primary); font-weight: 600;
}
.tour-faca {
  display: inline-block; margin-left: .5rem; padding: .05rem .5rem; border-radius: 999px;
  font-size: .68rem; letter-spacing: 0; text-transform: uppercase;
  background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis);
  border: 1px solid var(--bs-warning-border-subtle);
}
.tour-ctl { display: flex; align-items: center; gap: 4px; flex: none; }
.tour-txt { margin: 4px 0 0; font-size: .92rem; line-height: 1.45; }
.tour-txt strong { font-weight: 600; }
.tour-prog {
  position: absolute; left: 16px; right: 16px; bottom: 5px; height: 3px;
  border-radius: 3px; background: var(--bs-secondary-bg); overflow: hidden;
}
.tour-prog > div { height: 100%; width: 0; background: var(--bs-primary); transition: width .3s ease; }

/* Tela inicial e tela final: a mesma caixa, no centro, sobre o véu */
.tour-caixa.tour-cheia {
  top: 50%; bottom: auto; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 22px 24px 20px;
}
.tour-caixa.tour-cheia.esmaece { opacity: 1; }
.tour-cheia h3 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 600; }
.tour-cheia p { margin: 0 0 8px; color: var(--bs-secondary-color); font-size: .92rem; line-height: 1.5; }
.tour-etapas { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; padding: 0; list-style: none; }
.tour-etapas li {
  font-size: .76rem; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--bs-border-color); color: var(--bs-body-color);
}
.tour-etapas li b { color: var(--bs-primary); font-weight: 600; margin-right: 4px; }
.tour-bts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Botão de relatar problema: some durante o tour, menos no passo que o destaca */
body.tour-on #btnIssueFab { visibility: hidden; }
body.tour-on.tour-fab #btnIssueFab { visibility: visible; }

@media (max-width: 576px) {
  .tour-caixa { left: 8px; right: 8px; bottom: 8px; width: auto; transform: none; padding: 7px 8px 13px 12px; }
  .tour-caixa.tour-cheia { left: 50%; right: auto; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: calc(100vw - 16px); }
}

@media (prefers-reduced-motion: reduce) {
  .tour-foco { transition: opacity .2s; }
  .tour-foco::after { animation: none; opacity: .6; }
  .tour-caixa, .tour-caixa.esmaece, .tour-prog > div { transition: none; }
}
@media print { .tour-veu, .tour-foco, .tour-caixa { display: none !important; } }

/* Modal Bootstrap aberto (passo "Faça": novo cliente, novo caso): o tour sai da frente
   para não cobrir Salvar/Cancelar nem disputar o foco com o modal. Volta ao fechar. */
body.modal-open .tour-caixa:not(.tour-cheia):not(.tour-sobre-modal),
body.modal-open .tour-foco:not(.tour-sobre-modal),
body.modal-open .tour-veu:not(.tour-cheia) { display: none !important; }

/* Exceção: passo do tour que vive DENTRO do modal que ele mesmo abriu (a ficha do caso: abas, Lançar recebimento,
   rateio). Caixa e anel ficam por cima (z-index acima do modal, que o app.js sobe até ~1120). Com o alvo na metade
   de baixo da tela, a caixa vai para o alto, para não cobrir o que o passo mostra. */
.tour-caixa.tour-no-topo { bottom: auto; top: 12px; }
@media (max-width: 576px) { .tour-caixa.tour-no-topo { bottom: auto; top: 8px; } }
