/* ==========================================================================
   OrçaFácil — movimento e texturas (prefixo ofx- para não colidir com of-rise)
   Cole no FINAL do seu index.css (ou importe este arquivo no main.tsx).
   Cor da marca usada aqui: brand-500 = #E11D48
   ========================================================================== */

/* --- 1. Orçamento "saindo da impressora": revelação única do card de faturamento --- */
@keyframes ofx-print-in {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
.ofx-print-in {
  animation: ofx-print-in 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* --- 2. Recibo picotado: furos semicirculares nas laterais da linha tracejada --- */
.ofx-ticket-top {
  -webkit-mask-image: radial-gradient(circle 11px at 0 100%, #0000 98%, #000),
    radial-gradient(circle 11px at 100% 100%, #0000 98%, #000);
  mask-image: radial-gradient(circle 11px at 0 100%, #0000 98%, #000),
    radial-gradient(circle 11px at 100% 100%, #0000 98%, #000);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.ofx-ticket-bottom {
  -webkit-mask-image: radial-gradient(circle 11px at 0 0, #0000 98%, #000),
    radial-gradient(circle 11px at 100% 0, #0000 98%, #000);
  mask-image: radial-gradient(circle 11px at 0 0, #0000 98%, #000),
    radial-gradient(circle 11px at 100% 0, #0000 98%, #000);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

/* --- 3. Paralaxe do círculo decorativo (só mouse; variáveis vêm do onPointerMove) --- */
.ofx-parallax {
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

/* --- 4. Odômetro: cada dígito rola até o valor final --- */
.ofx-roll {
  transition: transform 1.05s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

/* --- 5. Régua de graduação sob a barra de progresso (marca a cada 10%) --- */
.ofx-ruler {
  background-image: repeating-linear-gradient(
    to right,
    rgba(255, 255, 255, 0.6) 0,
    rgba(255, 255, 255, 0.6) 1px,
    transparent 1px,
    transparent 10%
  );
  border-right: 1px solid rgba(255, 255, 255, 0.6);
}

/* --- 6. Carimbo "Tudo recebido": aparece só quando 100% foi pago --- */
@keyframes ofx-stamp {
  0% {
    opacity: 0;
    transform: scale(1.9) rotate(-16deg);
  }
  55% {
    opacity: 1;
    transform: scale(0.93) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-6deg);
  }
}
.ofx-stamp {
  animation: ofx-stamp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) 1.1s both;
}

/* --- 7. Convite de instalação: entrada com mola + logo que balança uma vez --- */
@keyframes ofx-sheet-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.ofx-sheet-in {
  animation: ofx-sheet-in 0.5s cubic-bezier(0.34, 1.4, 0.5, 1) both;
}
@keyframes ofx-wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  20% {
    transform: rotate(-10deg);
  }
  40% {
    transform: rotate(8deg);
  }
  60% {
    transform: rotate(-5deg);
  }
  80% {
    transform: rotate(3deg);
  }
}
.ofx-wiggle {
  animation: ofx-wiggle 0.9s ease-in-out 0.9s 1 both;
}

/* --- 8. Resposta a uma ação (abrir modal) --- */
@keyframes ofx-pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.ofx-pop {
  animation: ofx-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* --- 9. Aviso offline: cai do topo --- */
@keyframes ofx-drop {
  from {
    opacity: 0;
    transform: translate(-50%, -18px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
.ofx-drop {
  animation: ofx-drop 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* --- 10. Verificação de pagamento: recibo sendo impresso --- */
.ofx-printer {
  position: relative;
  width: 96px;
  height: 124px;
  margin: 0 auto 28px;
  overflow: hidden;
}
.ofx-printer-slot {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 12px;
  border-radius: 9999px;
  background: #e11d48;
  z-index: 2;
}
.ofx-printer-paper {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 6px;
  height: 108px;
  padding: 18px 10px 0;
  border: 1px solid #e2e8f0;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fff;
  animation: ofx-print 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.ofx-printer-paper::before {
  content: "";
  display: block;
  width: 55%;
  height: 6px;
  margin-bottom: 10px;
  border-radius: 9999px;
  background: #e11d48;
}
.ofx-printer-paper::after {
  content: "";
  display: block;
  height: 56px;
  background-image: repeating-linear-gradient(
    to bottom,
    #e2e8f0 0,
    #e2e8f0 4px,
    transparent 4px,
    transparent 12px
  );
}
@keyframes ofx-print {
  0% {
    transform: translateY(-100%);
  }
  55%,
  80% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(112%);
  }
}

/* --- Acessibilidade: quem prefere menos movimento recebe tudo estático --- */
@media (prefers-reduced-motion: reduce) {
  .ofx-print-in,
  .ofx-stamp,
  .ofx-sheet-in,
  .ofx-wiggle,
  .ofx-pop,
  .ofx-drop,
  .ofx-printer-paper {
    animation: none !important;
  }
  .ofx-roll,
  .ofx-parallax {
    transition: none !important;
  }
  .ofx-printer-paper {
    transform: translateY(0);
  }
}

/* Drawer: as seções entram em sequência quando o menu é ABERTO (resposta à ação).
   O índice vem da variável --i definida em cada seção. */
@keyframes ofx-item-in {
  from {
    opacity: 0;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.ofx-drawer-open .ofx-stagger {
  animation: ofx-item-in 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms + 120ms);
}

/* Título da página no header: troca com uma pequena subida ao navegar */
@keyframes ofx-title-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.ofx-title-in {
  animation: ofx-title-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Aba ativa da navegação inferior: a "bolha" pulsa ao ser selecionada */
@keyframes ofx-nav-bounce {
  0% {
    transform: scale(0.7);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}
.ofx-nav-bounce {
  animation: ofx-nav-bounce 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .ofx-drawer-open .ofx-stagger,
  .ofx-title-in,
  .ofx-nav-bounce {
    animation: none !important;
  }
}


/* Carimbo rápido: o selo de status "bate" no card quando o status muda */
@keyframes ofx-stamp-quick {
  0% {
    opacity: 0;
    transform: scale(1.7) rotate(-9deg);
  }
  60% {
    opacity: 1;
    transform: scale(0.94) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}
.ofx-stamp-quick {
  animation: ofx-stamp-quick 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .ofx-stamp-quick {
    animation: none !important;
  }
}

/* Cole no FINAL do ofx-motion.css (junto com os outros dois arquivos). */

/* Lançamento recém-salvo: a linha acende em rosa claro e some (mostra o que mudou) */
@keyframes ofx-flash {
  0% {
    background-color: rgb(255 228 230);
  }
  100% {
    background-color: transparent;
  }
}
.ofx-flash {
  animation: ofx-flash 1.4s ease-out both;
}

/* Barras de categoria: crescem da esquerda ao carregar o gráfico */
@keyframes ofx-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
.ofx-grow {
  transform-origin: left center;
  animation: ofx-grow 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .ofx-flash,
  .ofx-grow {
    animation: none !important;
  }
}

/* Cole no FINAL do ofx-motion.css (junto com os outros arquivos ofx-motion-*.css). */

/* Gráfico semestral: as barras sobem da base, uma após a outra */
@keyframes ofx-bar {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}
.ofx-bar {
  transform-origin: bottom;
  animation: ofx-bar 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .ofx-bar {
    animation: none !important;
  }
}

/* Cole no FINAL do ofx-motion.css (junto com os outros arquivos ofx-motion-*.css). */

/* Barra indeterminada: um trecho brand-500 percorre a régua da esquerda para a direita */
@keyframes ofx-scan {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(320%);
  }
}
.ofx-scan {
  animation: ofx-scan 1.3s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

/* Régua de graduação em slate (versão para fundo claro) */
.ofx-ruler-slate {
  background-image: repeating-linear-gradient(
    to right,
    rgba(100, 116, 139, 0.45) 0,
    rgba(100, 116, 139, 0.45) 1px,
    transparent 1px,
    transparent 10%
  );
  border-right: 1px solid rgba(100, 116, 139, 0.45);
}

/* Entrada tardia: a tela só aparece se o carregamento passar de ~200ms,
   evitando um "pisca" quando o app abre rápido. */
@keyframes ofx-late {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.ofx-late {
  opacity: 0;
  animation: ofx-late 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;
}

@media (prefers-reduced-motion: reduce) {
  .ofx-scan {
    animation: none !important;
    transform: translateX(0);
  }
  .ofx-late {
    animation: none !important;
    opacity: 1;
  }
}