/* ── Shared keyframes ─────────────────────────────────────── */

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

@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Top loading bar (GitHub / YouTube style) ────────────── */

#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--loader-color, rgba(255, 255, 255, 0.45)),
                                       var(--loader-color-end, rgba(255, 255, 255, 0.25)));
    z-index: 9999;
    transition: none;
    pointer-events: none;
}

#page-loader.loading {
    width: 80%;
    transition: width 8s cubic-bezier(0.1, 0.5, 0.3, 1);
}

#page-loader.done {
    width: 100%;
    opacity: 0;
    transition: width 0.15s ease, opacity 0.3s ease 0.15s;
}

/* ── Row fade-in: frontend tables ────────────────────────── */

.table tbody tr {
    animation: rowIn 0.3s ease both;
}

.table tbody tr:nth-child(1)  { animation-delay: 0.02s; }
.table tbody tr:nth-child(2)  { animation-delay: 0.04s; }
.table tbody tr:nth-child(3)  { animation-delay: 0.06s; }
.table tbody tr:nth-child(4)  { animation-delay: 0.08s; }
.table tbody tr:nth-child(5)  { animation-delay: 0.10s; }
.table tbody tr:nth-child(6)  { animation-delay: 0.12s; }
.table tbody tr:nth-child(7)  { animation-delay: 0.14s; }
.table tbody tr:nth-child(8)  { animation-delay: 0.16s; }
.table tbody tr:nth-child(9)  { animation-delay: 0.18s; }
.table tbody tr:nth-child(10) { animation-delay: 0.20s; }
.table tbody tr:nth-child(11) { animation-delay: 0.22s; }
.table tbody tr:nth-child(12) { animation-delay: 0.24s; }
.table tbody tr:nth-child(13) { animation-delay: 0.26s; }
.table tbody tr:nth-child(14) { animation-delay: 0.28s; }
.table tbody tr:nth-child(15) { animation-delay: 0.30s; }
.table tbody tr:nth-child(n+16) { animation-delay: 0.32s; }

/* ── Row fade-in: admin changelist tables ─────────────────── */

#result_list tbody tr {
    animation: rowIn 0.3s ease both;
}

#result_list tbody tr:nth-child(1)  { animation-delay: 0.02s; }
#result_list tbody tr:nth-child(2)  { animation-delay: 0.04s; }
#result_list tbody tr:nth-child(3)  { animation-delay: 0.06s; }
#result_list tbody tr:nth-child(4)  { animation-delay: 0.08s; }
#result_list tbody tr:nth-child(5)  { animation-delay: 0.10s; }
#result_list tbody tr:nth-child(6)  { animation-delay: 0.12s; }
#result_list tbody tr:nth-child(7)  { animation-delay: 0.14s; }
#result_list tbody tr:nth-child(8)  { animation-delay: 0.16s; }
#result_list tbody tr:nth-child(9)  { animation-delay: 0.18s; }
#result_list tbody tr:nth-child(10) { animation-delay: 0.20s; }
#result_list tbody tr:nth-child(11) { animation-delay: 0.22s; }
#result_list tbody tr:nth-child(12) { animation-delay: 0.24s; }
#result_list tbody tr:nth-child(13) { animation-delay: 0.26s; }
#result_list tbody tr:nth-child(14) { animation-delay: 0.28s; }
#result_list tbody tr:nth-child(15) { animation-delay: 0.30s; }
#result_list tbody tr:nth-child(n+16) { animation-delay: 0.32s; }

/* ── Dashboard section + card stagger ─────────────────────── */

.dash-section {
    animation: cardIn 0.4s ease both;
}

.dash-section:nth-of-type(1) { animation-delay: 0.05s; }
.dash-section:nth-of-type(2) { animation-delay: 0.15s; }
.dash-section:nth-of-type(3) { animation-delay: 0.25s; }

.dash-card {
    animation: cardIn 0.4s ease both;
}

.dash-section:nth-of-type(1) .dash-card:nth-child(1) { animation-delay: 0.05s; }
.dash-section:nth-of-type(1) .dash-card:nth-child(2) { animation-delay: 0.10s; }
.dash-section:nth-of-type(2) .dash-card:nth-child(1) { animation-delay: 0.15s; }
.dash-section:nth-of-type(2) .dash-card:nth-child(2) { animation-delay: 0.20s; }
.dash-section:nth-of-type(2) .dash-card:nth-child(3) { animation-delay: 0.25s; }
.dash-section:nth-of-type(2) .dash-card:nth-child(4) { animation-delay: 0.30s; }

/* ── Admin filter sidebar (x-transition classes) ──────────── */

.filter-enter {
    transition: opacity 0.2s ease-out;
}
.filter-enter .filter-panel {
    transition: opacity 0.25s cubic-bezier(0.2, 0.6, 0.3, 1),
                transform 0.25s cubic-bezier(0.2, 0.6, 0.3, 1);
}

.filter-leave {
    transition: opacity 0.15s ease-in;
}
.filter-leave .filter-panel {
    transition: opacity 0.2s ease-in,
                transform 0.2s ease-in;
}

.filter-enter-start {
    opacity: 0;
}
.filter-enter-start .filter-panel {
    opacity: 0;
    transform: translateX(20px);
}

.filter-enter-end {
    opacity: 1;
}
.filter-enter-end .filter-panel {
    opacity: 1;
    transform: translateX(0);
}

/* ── Card fade-in (frontend, exclude modals) ─────────────── */

.card:not(.modal-content) {
    animation: cardIn 0.4s ease both;
}

.row > .col .card:not(.modal-content),
.row > [class*="col-"] .card:not(.modal-content) {
    animation: cardIn 0.4s ease both;
}

.row > .col:nth-child(1) .card,
.row > [class*="col-"]:nth-child(1) .card { animation-delay: 0.05s; }
.row > .col:nth-child(2) .card,
.row > [class*="col-"]:nth-child(2) .card { animation-delay: 0.10s; }
.row > .col:nth-child(3) .card,
.row > [class*="col-"]:nth-child(3) .card { animation-delay: 0.15s; }
.row > .col:nth-child(4) .card,
.row > [class*="col-"]:nth-child(4) .card { animation-delay: 0.20s; }
.row > .col:nth-child(5) .card,
.row > [class*="col-"]:nth-child(5) .card { animation-delay: 0.25s; }
.row > .col:nth-child(6) .card,
.row > [class*="col-"]:nth-child(6) .card { animation-delay: 0.30s; }

/* Subtle hover lift on cards (exclude modals) */
.card:not(.modal-content) {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:not(.modal-content):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] .card:not(.modal-content):hover {
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.07);
}
