/* =====================================================================
   Vidalle · Pulido de interacción (v1)
   Basado en la guía de Emil Kowalski (design engineering) y Taste Skill:
   - Un sistema que se usa todo el día debe sentirse RÁPIDO: lo que se ve
     cientos de veces al día no se anima (Ctrl+K, entrada de páginas,
     números del panel). Nada parpadea sin motivo.
   - Lo que sí se anima tiene propósito: confirmar un clic, abrir un menú
     desde donde se tocó, mostrar un modal o el menú del celular.
   - Solo transform/opacity, curvas propias (ease-out fuerte), < 300 ms.
   - El "hover" solo en equipos con mouse (en celular no queda pegado).
   Se carga AL FINAL, después de vidalle-pro.css.
   ===================================================================== */

:root {
    --ease-out: cubic-bezier(.23, 1, .32, 1);
    --ease-in-out: cubic-bezier(.77, 0, .175, 1);
    --ease-drawer: cubic-bezier(.32, .72, 0, 1);
    --ui-ease: var(--ease-out);
}

/* ---------- 1. Lo frecuente no se anima ---------- */
.ui-entra { animation: none !important; }                       /* entrada de cada pantalla */
.ui-paleta-fondo.abierta, .ui-paleta { animation: none !important; } /* Ctrl+K: aparece al instante */
.ui-caja.abierta::before { animation: none !important; }       /* el punto verde ya no parpadea */
.spa-sidebar .nav-link,
.spa-sidebar .nav-link:hover:not(.active) { transition: background-color 120ms ease, color 120ms ease !important; }
.spa-sidebar .nav-link:hover { padding-left: .6rem !important; } /* sin "salto" del texto */

/* ---------- 2. Presionar se siente (todo lo que se toca) ---------- */
.btn, .ui-accion, .spa-quick-action, .tpv-prod, .page-link, .nav-pills .nav-link, .ui-usuario button {
    transition-property: background-color, border-color, color, box-shadow, transform !important;
    transition-duration: 150ms !important;
    transition-timing-function: var(--ease-out) !important;
}
.btn:active:not(:disabled), .ui-accion:active, .spa-quick-action:active, .tpv-prod:active,
.page-link:active, .ui-usuario button:active { transform: scale(.97) !important; }

/* ---------- 3. Hover solo con mouse (en celular no se "pega") ---------- */
.spa-stat:hover, .spa-quick-action:hover, .tpv-prod:hover, .cita-row:hover, .cal-cita:hover { transform: none; }
@media (hover: hover) and (pointer: fine) {
    a .spa-stat:hover, a.spa-stat:hover, .spa-stat.clicable:hover,
    .spa-quick-action:hover, .tpv-prod:hover { transform: translateY(-1px); }
    .cita-row:hover, .cal-cita:hover { transform: translateX(2px); }
}
.spa-stat:not(.clicable) { transition: none; }
a .spa-stat, a.spa-stat { transition: transform 160ms var(--ease-out), box-shadow 160ms ease; }

/* ---------- 4. Menús desplegables: nacen desde donde se tocaron ---------- */
.dropdown-menu.show {
    transform-origin: top left;
    animation: v-pop 150ms var(--ease-out);
}
.dropdown-menu-end.show, .dropdown-menu[data-bs-popper].dropdown-menu-end { transform-origin: top right; }
@keyframes v-pop { from { opacity: 0; transform: scale(.97) translateY(-2px); } }

/* ---------- 5. Ventanas (modales): centradas, rápidas, sin rebote ---------- */
.modal.fade .modal-dialog { transform: scale(.97) translateY(6px); transition: transform 220ms var(--ease-out), opacity 220ms var(--ease-out); opacity: 0; }
.modal.show .modal-dialog { transform: none; opacity: 1; }
.modal-backdrop.fade { transition: opacity 200ms ease; }

/* ---------- 6. Menú del celular: curva tipo iOS ---------- */
.spa-sidebar { transition: transform 300ms var(--ease-drawer) !important; }

/* ---------- 7. Avisos: entran suaves, salen rápido ---------- */
.spa-content > .alert { animation: v-aviso 220ms var(--ease-out); }
@keyframes v-aviso { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- 8. Detalles que no se notan pero suman ---------- */
.spa-stat .value, .kpi-franja .valor, .spa-table td, .table td, .text-end, .grande, .tk-total,
[class*="monto"], [class*="total"] { font-variant-numeric: tabular-nums; }
h1, h2, .pg-head h1, .page-title { letter-spacing: -.02em; }
p, .text-muted { text-wrap: pretty; }
.av, .avatar, .ui-usuario .av, img.rounded-circle { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--p-brand, #6d2a55); outline-offset: 2px; }
.btn:focus:not(:focus-visible), .ui-accion:focus:not(:focus-visible) { box-shadow: none; }
.btn.is-loading::before { animation-duration: .55s; }           /* un spinner rápido se siente más rápido */

/* ---------- 9. Reducir movimiento: sin desplazamientos, solo opacidad ---------- */
@media (prefers-reduced-motion: reduce) {
    .dropdown-menu.show, .spa-content > .alert { animation: v-fade 150ms ease; }
    .modal.fade .modal-dialog { transform: none !important; }
    @keyframes v-fade { from { opacity: 0; } }
}

/* ---------- 10. La "×" de los avisos no se monta sobre sus botones ---------- */
.alert:has(> .ui-cerrar) { padding-right: 2.75rem !important; }
