/* ==========================================================
   Channa Systems IT Asset Management System
   File    : assets/css/cs-animations.css
   Version : 1.2.0
   ----------------------------------------------------------
   Subtle motion only. No colours, sizes, fonts or layout are
   changed - only opacity and transform (which never moves
   surrounding content) and the speed of existing hover states.

   1. Page content settles in once when a page opens
   2. Messages (saved / error) ease in when they appear
   3. Buttons, menu links and table rows react smoothly
   4. Buttons show a small spinner while a form is being sent
   5. Everything is switched off for people who turn off
      animations in their device settings
   ========================================================== */

/* ---------- 1. Page content ---------- */

@keyframes cs-settle {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

.main-content,
body > .container-fluid,
.cs-page,
.cs-auth-card {
    animation: cs-settle .28s ease-out backwards;
}

/* ---------- 2. Messages ---------- */

@keyframes cs-message-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

.alert {
    animation: cs-message-in .24s ease-out .08s backwards;
}

/* ---------- 3. Responsive feedback ---------- */

/* Sidebar: existing hover/active colours fade instead of snapping */
.sidebar a {
    transition: background-color .18s ease, border-left-color .18s ease;
}

/* Buttons: brief press feedback (cs.css already animates hover) */
.btn:active:not(:disabled):not(.disabled) {
    transform: scale(.97);
}

/* Table rows: existing hover colour fades in */
.table tbody tr {
    transition: background-color .15s ease;
}

/* Form fields: focus ring fades in */
.form-control,
.form-select {
    transition: border-color .15s ease, box-shadow .15s ease;
}

/* ---------- 4. Sending a form ---------- */

@keyframes cs-spin {
    to { transform: rotate(360deg); }
}

.btn.cs-busy {
    pointer-events: none;
    opacity: .85;
}

.btn.cs-busy::after {
    content: "";
    display: inline-block;
    width: .85em;
    height: .85em;
    margin-left: .5em;
    vertical-align: -.1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: cs-spin .7s linear infinite;
}

/* ---------- 5. Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .btn:active:not(:disabled):not(.disabled) {
        transform: none;
    }
}
