/* Animações do visual cristal. Só valem pra quem não pediu "reduzir movimento" no aparelho. */

/* Poeira de luz: some com "reduzir movimento". */
.particulas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .particulas { display: none; } }

@media (prefers-reduced-motion: no-preference) {

  /* ---------- Login ---------- */
  .login-caixa { animation: aparece .9s cubic-bezier(.2, .8, .2, 1) backwards; }
  .login-caixa > * { animation: sobe .7s cubic-bezier(.2, .8, .2, 1) backwards; }
  .login-caixa > :nth-child(1) { animation-delay: .15s; }
  .login-caixa > :nth-child(2) { animation-delay: .22s; }
  .login-caixa > :nth-child(3) { animation-delay: .29s; }
  .login-caixa > :nth-child(4) { animation-delay: .36s; }
  .login-caixa > :nth-child(5) { animation-delay: .43s; }
  .login-caixa > :nth-child(n+6) { animation-delay: .5s; }
  .login-logo, .hub-logo { animation: sobe .7s .1s cubic-bezier(.2, .8, .2, 1) backwards, aura 3.6s 1s ease-in-out infinite; }
  .titulo-hub em, .hub-topo h1 em { animation: brilha 3.6s 1s ease-in-out infinite; }
  .erro:not([hidden]) { animation: tremor .45s cubic-bezier(.36, .07, .19, .97); }

  /* ---------- Topo ---------- */
  .marca img { animation: aura 3.6s ease-in-out infinite; }
  .hub-topo > * { animation: sobe .8s cubic-bezier(.2, .8, .2, 1) backwards; }
  .hub-topo > :nth-child(2) { animation-delay: .1s; }
  .hub-topo > :nth-child(3) { animation-delay: .2s; }
  .hub-topo > :nth-child(4) { animation-delay: .3s; }
  .hub-topo > :nth-child(5) { animation-delay: .4s; }
  .linha-terminal::after { content: "_"; margin-left: 2px; animation: cursor 1s steps(1) infinite; }
  .selo-vivo i { animation: vivo 2s ease-in-out infinite; }

  /* ---------- Botões ---------- */
  .btn-primario { position: relative; overflow: hidden; transition: transform .15s, filter .2s, box-shadow .25s; }
  .btn-primario::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: -45%; width: 30%; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent); transform: skewX(-20deg);
  }
  .btn-primario:hover::after { animation: varre-btn .8s ease-out; }
  .btn-primario:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 10px 30px rgba(208,24,30,.5); }
  .btn-fantasma { transition: border-color .2s, transform .15s, background-color .2s; }
  .btn-primario:active, .btn-fantasma:active, .abas button:active, .chips button:active { transform: scale(.96); }
  .btn-primario.ok { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }

  /* ---------- Abas e chips: a pílula vermelha desliza até o item ativo ---------- */
  .abas, .chips { position: relative; }
  .abas button, .chips button { position: relative; z-index: 1; transition: color .25s, border-color .25s, transform .15s; }
  .indicador {
    position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; border-radius: 99px;
    background: linear-gradient(180deg, #ff5148, var(--sangue) 60%, #9f1015);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 6px 18px rgba(208,24,30,.35);
  }
  .indicador.pronto { transition: transform .5s cubic-bezier(.3, 1.25, .45, 1), width .5s cubic-bezier(.3, 1.25, .45, 1), height .3s; }
  .tem-indicador button.ativa { background: transparent; box-shadow: none; border-color: transparent; }

  /* ---------- Cards: sobem um pouco e acendem a borda no mouse ---------- */
  .card { transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .3s, box-shadow .35s; }
  .card:hover { transform: translateY(-4px); }
  .card.entra { animation: entra-card .6s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 55ms); }
  .com-capa img { transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
  .card:hover .com-capa img { transform: scale(1.05); }
  .vazio:not([hidden]) { animation: sobe .5s cubic-bezier(.2, .8, .2, 1) backwards; }

  /* ---------- Janelas e aviso ---------- */
  dialog.modal[open] { animation: abre-modal .4s cubic-bezier(.2, .9, .25, 1.1); }
  dialog.modal[open]::backdrop { animation: surge .3s ease; }
  .det-corpo > * { animation: sobe .5s cubic-bezier(.2, .8, .2, 1) backwards; }
  .det-corpo > :nth-child(2) { animation-delay: .05s; }
  .det-corpo > :nth-child(3) { animation-delay: .1s; }
  .det-corpo > :nth-child(n+4) { animation-delay: .15s; }
  .toast:not([hidden]) { animation: toast-in .4s cubic-bezier(.2, .9, .3, 1.35); }
  #det-fav.ok { animation: pop .45s cubic-bezier(.3, 1.6, .5, 1); }

  /* ---------- Painel do admin (só o essencial) ---------- */
  .painel > section { animation: sobe .6s cubic-bezier(.2, .8, .2, 1) backwards; }
  .painel > section:nth-child(2) { animation-delay: .08s; }
  .painel > section:nth-child(3) { animation-delay: .16s; }
  .lista-item { animation: surge .35s ease backwards; transition: border-color .2s; }
  .lista-item:hover { border-color: rgba(255, 74, 58, .45); }

  /* ---------- Troca de tema (círculo que se abre a partir do botão) ---------- */
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
}

@keyframes sobe { from { opacity: 0; transform: translateY(16px); filter: blur(8px); } }
@keyframes surge { from { opacity: 0; } }
@keyframes aparece { from { opacity: 0; transform: translateY(26px) scale(.96); } }
@keyframes deriva { from { transform: scale(1.04); } to { transform: scale(1.15) translate(-2%, -1.5%); } }
@keyframes respira { to { transform: scale(1.07) translateX(-1.2%); } }
@keyframes pulsa { 50% { opacity: .4; } }
@keyframes varre { 0%, 55% { transform: translateX(0) skewX(-18deg); } 100% { transform: translateX(800%) skewX(-18deg); } }
@keyframes varre-btn { to { left: 130%; } }
@keyframes brilha {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 60, 60, .25)); }
  50% { filter: drop-shadow(0 0 18px rgba(255, 60, 60, .75)) brightness(1.08); }
}
@keyframes aura {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 60, 60, .30); }
  50% { box-shadow: 0 0 30px rgba(255, 60, 60, .70); }
}
@keyframes tremor { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes reflexo { from { opacity: 1; transform: translateX(0) rotate(18deg); } to { opacity: 1; transform: translateX(520%) rotate(18deg); } }
@keyframes entra-card { from { opacity: 0; transform: translateY(22px) scale(.96); filter: blur(6px); } }
@keyframes abre-modal { from { opacity: 0; transform: translateY(16px) scale(.95); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 18px) scale(.9); } }
@keyframes pop { 40% { transform: scale(1.06); } }

@keyframes cursor { 50% { opacity: 0; } }
@keyframes vivo { 0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .6); } 50% { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0); } }
