/* ATTENDX PRO — Global page animations */

@media (prefers-reduced-motion: reduce) {
    .ax-animate,
    .ax-animate *,
    #spa-content-root.ax-page-enter,
    #spa-content-root.ax-page-enter *,
    .app-content-header.ax-header-enter h3 {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ── Page shell enter (SPA + full load) ── */
#spa-content-root.ax-page-enter,
.app-content .container-fluid.ax-page-enter {
    animation: axPageEnter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#spa-content-root.ax-page-enter.ax-page-soft,
.app-content .container-fluid.ax-page-enter.ax-page-soft {
    animation-duration: 0.28s;
}

@keyframes axPageEnter {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ── Content header title ── */
.app-content-header.ax-header-enter h3 {
    animation: axHeaderIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes axHeaderIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Staggered blocks ── */
.ax-animate {
    opacity: 0;
    animation: axBlockIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--ax-i, 0) * 0.07s);
}

@keyframes axBlockIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Table rows ── */
.ax-row-animate {
    opacity: 0;
    animation: axRowIn 0.38s ease forwards;
    animation-delay: calc(var(--ax-i, 0) * 0.035s);
}

@keyframes axRowIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Sidebar nav links ── */
.sidebar-menu .nav-link {
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.sidebar-menu .nav-link:hover {
    padding-left: calc(0.5rem + 2px);
}

.sidebar-menu .nav-link.active {
    animation: axNavActive 0.35s ease;
}

@keyframes axNavActive {
    from { box-shadow: inset 0 0 0 0 rgba(37, 99, 235, 0); }
    to { box-shadow: inset 3px 0 0 0 rgba(37, 99, 235, 0.9); }
}

/* ── Cards & shells hover lift (not header/navbar) ── */
.premium-shell,
.staff-card,
.staff-performance-card,
.cms-stat-card,
.cms-panel.card,
.small-box,
.app-content .card:not(.modal-content) {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.25s ease;
}

.premium-shell:hover,
.staff-card:hover,
.staff-performance-card:hover,
.cms-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

/* ── Buttons ── */
.btn,
.premium-btn,
.staff-btn-primary,
.staff-btn-dark,
.staff-btn-success {
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:active:not(:disabled),
.premium-btn:active:not(:disabled),
.staff-btn-primary:active,
.staff-btn-dark:active,
.staff-btn-success:active {
    transform: scale(0.97);
}

/* ── Modals (must sit on body — avoid transform on .modal ancestors) ── */
.modal {
    transform: none !important;
}

.modal .modal-dialog {
    margin-top: auto;
    margin-bottom: auto;
}

.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal.staff-modal .modal-dialog {
    transition: opacity 0.2s ease;
}

.modal.staff-modal.show .modal-dialog {
    animation: none;
    opacity: 1;
    transform: none;
}

@keyframes axModalIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Form fields focus ── */
.form-control,
.form-select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ── Badges pop ── */
.badge.ax-animate,
.premium-badge.ax-animate {
    animation-name: axBadgePop;
    animation-duration: 0.4s;
    animation-timing-function: cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes axBadgePop {
    from {
        opacity: 0;
        transform: scale(0.6);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── SPA loading crossfade (opacity only — transform breaks modals) ── */
#spa-content-root.spa-loading {
    opacity: 0.45;
    transition: opacity 0.22s ease;
}

/* ── SweetAlert entrance ── */
.swal2-show {
    animation: axModalIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ── Dashboard stat boxes ── */
.cms-dashboard-page .small-box.ax-animate,
.cms-dashboard-page .cms-stat-card.ax-animate {
    animation-duration: 0.55s;
}

/* ── Settings hub panels ── */
.settings-panel.ax-animate {
    animation-duration: 0.4s;
}

/* ── Auth pages ── */
.auth-layout .auth-glass-card {
    animation: axPageEnter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
