/* tourbi-interface — carregador da marca, abertura, avisos e central de notificações.
   Atenção: o app.css registra @property --p (número) para a Leitura; por isso as cores
   do aviso usam --tbav-c / --tbav-c2, e nunca --p.
   Mesmo modelo da Zynce e do Zerve Pass, aprovado pelo Lucas na prévia
   (~/Desktop/LOGO TOURBI/INTERFACE/previa/carregamento.html). Usa as variáveis do
   app.css (--marca, --marca-logo, --bg, --fg…), então acompanha o tema claro e o escuro.
   Prefixos: tc (carregador), tbab (abertura), tbav (avisos), tbs (sino). */

/* ---------- carregador: os dois pontos desenham os elos (marca/tourbi-carregador.js) ---------- */
.tc {
  --tc-tinta: var(--marca-logo);
  --tc-trilho: color-mix(in srgb, var(--marca-logo) 12%, transparent);
  display: inline-block; flex: none; width: var(--t, 64px); line-height: 0; vertical-align: middle;
}
.tc svg { display: block; width: 100%; height: auto; overflow: visible; }
.tc .tc-tinta { fill: var(--tc-tinta); }
.tc .tc-trilho { fill: var(--tc-trilho); }
.tc .tc-contorno { stroke: var(--tc-tinta); }
.tc.claro { --tc-tinta: #ffffff; --tc-trilho: rgba(255, 255, 255, .22); }
.carregando .tc { --t: 64px; }
/* só aparece se demorar mais de 0,2 s (carregamento rápido não pisca) */
.carregando.tc-espera { animation: tc-aparece .25s ease-out .2s both; }
@keyframes tc-aparece { from { opacity: 0; } to { opacity: 1; } }

/* ---------- abertura ("Abrindo a plataforma…"): só a tipografia TOURBI ---------- */
/* ocupa a altura visível da área de conteúdo (tela menos o respiro de 28 + 64 px do #vista), então o nome fica no centro óptico */
.tbab { display: grid; place-items: center; align-content: center; gap: 12px; min-height: calc(100vh - 92px); min-height: calc(100dvh - 92px); transition: opacity .25s ease; }
.tbab.sai { opacity: 0; }
@media (max-width: 900px) { .tbab { min-height: calc(100vh - 92px - 53px); min-height: calc(100dvh - 92px - 53px); } } /* desconta a barra do celular */
.tbab .tc { --t: min(300px, 70vw); }
.tbab-frase {
  height: 20px; font-size: 14px; font-weight: 500; color: var(--fg-2);
  opacity: 0; transform: translateY(8px); transition: opacity .35s cubic-bezier(.2, 0, 0, 1), transform .35s cubic-bezier(.2, 0, 0, 1);
}
.tbab-frase.on { opacity: 1; transform: none; }

/* ---------- avisos ---------- */
.tbav-pilha {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  width: min(384px, calc(100vw - 32px)); pointer-events: none;
}
.tbav {
  --tbav-c: #0b3c57; --tbav-c2: #13607c;
  position: relative; width: 100%; pointer-events: auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  min-height: 72px; padding: 15px 44px 19px 70px;
  background: var(--bg); color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--fg) 8%, transparent); border-radius: 20px;
  box-shadow: 0 1px 2px rgba(11, 34, 48, .05), 0 4px 10px -4px rgba(11, 34, 48, .06), 0 18px 36px -14px rgba(11, 34, 48, .24);
  animation: tbav-chega .45s cubic-bezier(.22, 1, .36, 1) both;
  transition: opacity .25s, transform .3s cubic-bezier(.22, 1, .36, 1);
}
:root[data-theme="dark"] .tbav { border-color: var(--linha-forte); box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px -14px rgba(0, 0, 0, .7); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tbav { border-color: var(--linha-forte); box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 18px 40px -14px rgba(0, 0, 0, .7); } }
.tbav.sai { opacity: 0; transform: translateX(24px); }
.tbav[data-tipo="sucesso"] { --tbav-c: #047857; --tbav-c2: #10a37a; }
.tbav[data-tipo="erro"] { --tbav-c: #d92d3a; --tbav-c2: #ef5a64; }
.tbav[data-tipo="atencao"] { --tbav-c: #ea6a0c; --tbav-c2: #f78f33; }
.tbav[data-tipo="info"], .tbav[data-tipo="carregando"] { --tbav-c: #136988; --tbav-c2: #2a8fb0; }

/* quadradinho do símbolo, como ícone de app */
.tbav-ic {
  position: absolute; left: 15px; top: 50%; translate: 0 -50%;
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--tbav-c2), var(--tbav-c));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -1px 0 rgba(0, 0, 0, .08), 0 2px 6px -2px rgba(11, 34, 48, .25);
}
.tbav-ic > svg { width: 22px; height: 22px; overflow: visible; animation: tbav-pop .55s cubic-bezier(.34, 1.56, .64, 1) both .1s; }
.tbav-ic .tc { --t: 30px; }
.tbav-ic > svg.tbav-elos { width: 27px; height: auto; fill: #fff; }
.tbav-ic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 2px solid var(--tbav-c); opacity: 0; pointer-events: none; animation: tbav-onda .9s cubic-bezier(.22, 1, .36, 1) .25s; }
.tbav[data-tipo="carregando"] .tbav-ic::after { animation: none; }
.tbav[data-tipo="erro"] .tbav-ic > svg { animation: tbav-pop .55s cubic-bezier(.34, 1.56, .64, 1) both .1s, tbav-nega .4s ease-in-out .6s; }
.tbav[data-tipo="atencao"] .tbav-ic > svg { transform-origin: 50% 80%; animation: tbav-pop .55s cubic-bezier(.34, 1.56, .64, 1) both .1s, tbav-balanca .7s ease-in-out .55s; }
.tbav .tbav-traco { stroke-dasharray: 1 1; animation: tbav-traco .45s cubic-bezier(.22, 1, .36, 1) both .3s; }
.tbav .tbav-ponto { transform-box: fill-box; transform-origin: center; animation: tbav-pop .4s cubic-bezier(.34, 1.56, .64, 1) both .55s; }
.tbav-faiscas circle { fill: var(--tbav-c); opacity: 0; transform-box: fill-box; transform-origin: center; }
.tbav[data-tipo="sucesso"] .tbav-faiscas circle { animation: tbav-faisca .7s cubic-bezier(.22, 1, .36, 1) .42s; }
.tbav[data-tipo="sucesso"] .tbav-faiscas circle:nth-child(2n) { animation-delay: .48s; }

/* texto, ação e fechar */
.tbav-corpo { flex: 1 1 100%; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tbav-tit { font-size: 14.5px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; animation: tbav-texto .45s cubic-bezier(.22, 1, .36, 1) both .12s; }
.tbav-txt { font-size: 13px; line-height: 1.45; color: var(--fg-2); animation: tbav-texto .45s cubic-bezier(.22, 1, .36, 1) both .19s; }
.tbav-txt:empty { display: none; }
.tbav-acao {
  height: 32px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; background: var(--marca); color: #fff;
  animation: tbav-texto .45s cubic-bezier(.22, 1, .36, 1) both .26s; transition: filter .2s, transform .15s;
}
.tbav-acao:hover { filter: brightness(.92); }
.tbav-acao:active { transform: scale(.95); }
.tbav-fechar {
  position: absolute; right: 10px; top: 10px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; background: transparent; color: var(--fg-2);
  opacity: 0; transition: opacity .15s, background .2s, rotate .25s;
}
.tbav-fechar svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tbav:hover .tbav-fechar, .tbav-fechar:focus-visible { opacity: 1; }
.tbav-fechar:hover { background: var(--bg-suave); color: var(--fg); rotate: 90deg; }
@media (hover: none) { .tbav-fechar { opacity: 1; } }

/* linha do tempo que falta (para com o mouse em cima) */
.tbav-tempo { position: absolute; left: 18px; right: 18px; bottom: 7px; height: 3px; border-radius: 3px; background: var(--tbav-c); opacity: .9; transform-origin: 0 50%; animation: tbav-tempo var(--dur, 5s) linear forwards; }
.tbav:hover .tbav-tempo { animation-play-state: paused; }
.tbav[data-tipo="carregando"] .tbav-tempo { display: none; }

@keyframes tbav-chega { from { opacity: 0; filter: blur(6px); transform: translateY(12px); } to { opacity: 1; filter: none; transform: none; } }
@keyframes tbav-pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tbav-traco { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes tbav-texto { from { opacity: 0; translate: 8px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes tbav-onda { from { opacity: .5; scale: 1; } to { opacity: 0; scale: 1.55; } }
@keyframes tbav-faisca { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: translate(var(--fx), var(--fy)) scale(.6); } }
@keyframes tbav-nega { 25% { transform: translateX(-2.5px); } 50% { transform: translateX(2.5px); } 75% { transform: translateX(-1.5px); } }
@keyframes tbav-balanca { 30% { transform: rotate(-10deg); } 60% { transform: rotate(7deg); } 100% { transform: none; } }
@keyframes tbav-tempo { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (max-width: 600px) {
  .tbav-pilha { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .tbav { padding: 14px 40px 18px 66px; border-radius: 18px; }
  .tbav-ic { left: 13px; }
}

/* ---------- central de notificações (o sino) ---------- */
.tbs-sino { position: relative; }
.tbs-sino.toca svg { animation: tbs-toca .8s ease-in-out; transform-origin: 50% 2px; }
.tbs-cont {
  position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
  background: var(--ruim); color: #fff; font: 700 10px/16px var(--f-texto); text-align: center;
  box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.tbs-sino.toca .tbs-cont { animation: tbs-pop .5s cubic-bezier(.34, 1.56, .64, 1); }

.tbs-menu {
  position: fixed; z-index: 70; width: 420px; max-width: calc(100vw - 24px);
  padding: 8px; border-radius: 24px; background: var(--bg); color: var(--fg);
  border: 1px solid var(--linha); box-shadow: 0 1px 2px rgba(11, 34, 48, .05), 0 24px 56px -18px rgba(11, 34, 48, .32);
  animation: tbs-abre .22s cubic-bezier(.22, 1, .36, 1) both;
}
.tbs-menu[hidden] { display: none; }
.tbs-cab { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px 12px; }
.tbs-cab h3 { margin: 0; font: 600 15.5px/1.2 var(--f-num); letter-spacing: -.015em; }
.tbs-pilula {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px; border: 0; cursor: pointer;
  font-size: 12px; font-weight: 600; background: var(--marca-claro); color: var(--marca); transition: background .2s, color .2s;
}
.tbs-pilula svg { width: 12px; height: 12px; display: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.tbs-pilula[aria-pressed="true"] { background: var(--marca); color: #fff; }
.tbs-pilula[aria-pressed="true"] svg { display: block; }
.tbs-lidas {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--fg-2); padding: 6px 8px; border-radius: 10px;
}
.tbs-lidas:hover { color: var(--fg); background: var(--bg-suave); }
.tbs-lidas svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tbs-lista { max-height: min(460px, 60vh); overflow-y: auto; scrollbar-width: thin; padding: 0 2px 4px; }
.tbs-grupo { padding: 12px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-3); }
.tbs-item {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 11px 12px; border-radius: 16px; cursor: pointer; transition: background .15s; color: inherit;
}
.tbs-item + .tbs-item::before { content: ""; position: absolute; left: 64px; right: 12px; top: 0; height: 1px; background: var(--linha); transition: opacity .15s; }
.tbs-item:hover { background: var(--bg-suave); }
.tbs-item:hover::before, .tbs-item:hover + .tbs-item::before { opacity: 0; }
.tbs-simb { --c: var(--marca); width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--bg-suave); color: var(--fg-3); transition: background .2s, color .2s; }
.tbs-simb svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tbs-item.novo .tbs-simb { background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--c); }
.tbs-t-alerta { --c: var(--ruim); }
.tbs-t-meta { --c: var(--ok); }
.tbs-t-dados { --c: var(--marca); }
.tbs-txt { min-width: 0; padding-top: 1px; }
.tbs-tit { font-size: 13.5px; line-height: 1.38; font-weight: 500; color: color-mix(in srgb, var(--fg) 82%, transparent);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; letter-spacing: -.005em; }
.tbs-item.novo .tbs-tit { font-weight: 600; color: var(--fg); }
.tbs-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbs-lado { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-top: 2px; }
.tbs-hora { font-size: 11.5px; font-weight: 500; color: var(--fg-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbs-novo { width: 8px; height: 8px; border-radius: 50%; background: var(--marca); opacity: 0; transform: scale(.4); transition: .25s cubic-bezier(.34, 1.56, .64, 1); }
.tbs-item.novo .tbs-novo { opacity: 1; transform: none; }
.tbs-tirar {
  position: absolute; right: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 9px; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--bg); color: var(--fg-2); box-shadow: 0 0 0 1px var(--linha); opacity: 0; transition: opacity .15s, color .15s;
}
.tbs-tirar svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tbs-item:hover .tbs-tirar, .tbs-tirar:focus-visible { opacity: 1; }
.tbs-tirar:hover { color: var(--ruim); }
@media (hover: none) { .tbs-tirar { display: none; } }
/* alerta (sinal que pede atenção): o item inteiro em destaque */
.tbs-item.alerta { background: color-mix(in srgb, var(--ruim) 6%, transparent); }
.tbs-item.alerta:hover { background: color-mix(in srgb, var(--ruim) 10%, transparent); }
.tbs-item.alerta .tbs-simb { background: color-mix(in srgb, var(--ruim) 14%, transparent); color: var(--ruim); }
.tbs-item.alerta .tbs-novo { background: var(--ruim); }
.tbs-selo { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; vertical-align: 1px; background: var(--ruim); color: #fff; }
.tbs-item.chegou { animation: tbs-chega .6s cubic-bezier(.22, 1, .36, 1) both; }
.tbs-vazio { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 24px 36px; }
.tbs-vazio .tc { --t: 54px; margin-bottom: 8px; --tc-tinta: color-mix(in srgb, var(--fg-3) 70%, transparent); }
.tbs-vazio b { font-size: 14.5px; font-weight: 600; }
.tbs-vazio span { font-size: 12.5px; color: var(--fg-2); max-width: 260px; text-wrap: balance; }
.tbs-pe { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; padding: 10px 12px; border-radius: 16px; background: var(--bg-suave); font-size: 12px; color: var(--fg-2); }
.tbs-vivo { display: inline-flex; align-items: center; gap: 6px; }
.tbs-vivo i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); position: relative; }
.tbs-vivo i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--ok); animation: tbs-vivo 2s ease-out infinite; }
@keyframes tbs-vivo { from { transform: scale(1); opacity: .8; } to { transform: scale(2.6); opacity: 0; } }
@keyframes tbs-toca { 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } 100% { transform: none; } }
@keyframes tbs-pop { from { transform: scale(.4); } to { transform: none; } }
@keyframes tbs-chega { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes tbs-abre { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .tbav, .tbav *, .tbav-ic::after, .tbs-menu, .tbs-item.chegou, .tbs-sino.toca svg, .tbs-sino.toca .tbs-cont, .tbs-vivo i::after, .carregando.tc-espera { animation: none !important; }
  .tbav .tbav-traco { stroke-dasharray: none; }
  .tbav-tempo { display: none; }
}
