/* ACF PERFORMANCE — transições entre páginas, abas e botões */

/* ===== Barra de progresso da navegação ===== */
#spa-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, #e11d48, #ff4d6d, #ffd1d9);
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.8);
}
#spa-progress.run { opacity: 1; width: 78%; transition: width 6s cubic-bezier(0.1, 0.8, 0.2, 1); }
#spa-progress.done { opacity: 0; width: 100%; transition: width 0.25s ease, opacity 0.4s ease 0.2s; }

/* ===== Transição entre páginas (View Transitions) ===== */
@keyframes spaOut {
  to { opacity: 0; transform: translateY(-14px) scale(0.996); filter: blur(3px); }
}
@keyframes spaIn {
  from { opacity: 0; transform: translateY(22px) scale(0.996); filter: blur(3px); }
}
@keyframes spaOutBack {
  to { opacity: 0; transform: translateY(14px) scale(0.996); filter: blur(3px); }
}
@keyframes spaInBack {
  from { opacity: 0; transform: translateY(-22px) scale(0.996); filter: blur(3px); }
}

::view-transition-old(root) { animation: 0.3s ease both spaOut; }
::view-transition-new(root) { animation: 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) 0.05s both spaIn; }
html[data-spa-dir="back"]::view-transition-old(root) { animation-name: spaOutBack; }
html[data-spa-dir="back"]::view-transition-new(root) { animation-name: spaInBack; }

/* Alternativa para navegadores sem View Transitions */
html.spa-leaving body { opacity: 0; transform: translateY(-10px); transition: opacity 0.2s ease, transform 0.2s ease; }
html.spa-entering body { animation: spaIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

/* ===== Botões, campos e chips: transições suaves ===== */
button,
.btn,
a.btn,
.badge,
.pill,
input,
select,
textarea,
summary,
[role="button"] {
  transition:
    background-color 0.22s ease,
    background 0.22s ease,
    border-color 0.22s ease,
    color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 0.22s ease,
    filter 0.22s ease;
}

button:not(:disabled):hover,
.btn:not(:disabled):not([aria-disabled="true"]):hover,
a.btn:not([aria-disabled="true"]):hover {
  transform: translateY(-1px);
}

button:not(:disabled):active,
.btn:not(:disabled):not([aria-disabled="true"]):active,
a.btn:not([aria-disabled="true"]):active {
  transform: translateY(1px) scale(0.985);
}

button:disabled,
.btn:disabled,
.btn[aria-disabled="true"] {
  transition: opacity 0.22s ease, filter 0.22s ease;
}

:focus-visible {
  outline: 2px solid rgba(225, 29, 72, 0.75);
  outline-offset: 2px;
}

/* ===== Abas, listas e modais ===== */
@keyframes fxIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fxModal {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fxFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fx-in { animation: fxIn 0.38s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.fx-in > * { animation: fxIn 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.fx-in > *:nth-child(2) { animation-delay: 0.04s; }
.fx-in > *:nth-child(3) { animation-delay: 0.08s; }
.fx-in > *:nth-child(4) { animation-delay: 0.12s; }
.fx-in > *:nth-child(5) { animation-delay: 0.16s; }
.fx-in > *:nth-child(n+6) { animation-delay: 0.2s; }

.modal-overlay.fx-modal:not(.hidden) { animation: fxFade 0.25s ease both; }
.modal-overlay.fx-modal:not(.hidden) .modal-card { animation: fxModal 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

.notice:not(.hidden),
.empty { animation: fxIn 0.35s ease both; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root),
  .fx-in,
  .fx-in > *,
  .modal-overlay.fx-modal:not(.hidden),
  .modal-overlay.fx-modal:not(.hidden) .modal-card { animation: none !important; }

  button, .btn, a.btn, .badge, .pill, input, select, textarea { transition: none !important; }
}

/* ===== Ícones SVG (traço fino) ===== */
.ico {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.2em;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Toque: alvos de pelo menos 44px em celular e tablet ===== */
@media (pointer: coarse), (max-width: 900px) {
  .btn, .btn-add, .btn-remove, .btn-cancel, .btn-confirm, .logout-button, .reset-button, .more-btn,
  a.btn, button.badge, .nav-button, .modal-close-button, .settings-back-button { min-height: 44px; }
  .btn, a.btn, button.badge { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
  input:not([type]), input[type="text"], input[type="search"], input[type="date"], input[type="number"], input[type="email"], input[type="password"], select, textarea { min-height: 44px !important; box-sizing: border-box; }
  .user-profile .logout-button, .btn-item-action, .question-icon, .wallpaper-delete-button { min-height: 44px !important; min-width: 44px !important; }
  .viz-table summary { display: inline-flex; align-items: center; min-height: 44px; }
  a:has(> img) { display: inline-flex; align-items: center; min-height: 44px; }
}
