/* ── Shared animation utilities layered on top of admin.css ───────────── */

@keyframes pageFadeSlideUp {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.page-content > * {
    animation: pageFadeSlideUp 0.32s ease-out both;
}

@keyframes staggerFadeIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.stagger-item {
    animation: staggerFadeIn 0.28s ease-out both;
}

/* Apply via inline style="--stagger-index: N" and this helper class picks it up */
.stagger-item {
    animation-delay: calc(var(--stagger-index, 0) * 40ms);
}

/* ── Skeleton shimmer loaders ──────────────────────────────────────────── */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: skeletonShimmer 1.4s infinite;
}

@keyframes skeletonShimmer {
    100% { transform: translateX(100%); }
}

.skeleton-row {
    height: 52px;
    margin-bottom: 8px;
    border-radius: 10px;
}

.skeleton-card {
    height: 140px;
    border-radius: 14px;
}

/* ── View-toggle transitions ────────────────────────────────────────────*/
.view-table, .entity-grid-view, .mobile-card-list {
    animation: pageFadeSlideUp 0.22s ease-out both;
}

/* ── List / Grid / Card toggle control ─────────────────────────────────── */
.view-toggle-group {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 30px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: var(--transition);
}

.view-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.view-toggle-btn.active {
    background: var(--primary);
    color: #FFFFFF;
    box-shadow: 0 2px 8px var(--primary-glow);
}

/* Desktop Grid view: a new 3rd option rendering the same per-item card
   template as mobile Card view, just laid out in a responsive CSS grid. */
.entity-grid-view {
    display: none;
}

@media (min-width: 769px) {
    .view-grid .desktop-table-view { display: none; }
    .view-grid .entity-grid-view {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }

    .view-card .desktop-table-view { display: none; }
    .view-card .mobile-card-list {
        display: flex !important;
        flex-direction: column;
        gap: 12px;
    }
}

/* On mobile the List/Grid/Card toggle has no effect (Card view is always forced),
   so hide it there rather than show a control that silently does nothing. */
@media (max-width: 768px) {
    .view-toggle-group {
        display: none;
    }
}

/* ── Toast host stack (overrides admin.css .toast-alert fixed positioning) ─ */
.toast-host-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.toast-host-stack .toast-alert {
    position: static;
    pointer-events: auto;
    max-width: 380px;
}

.toast-alert.info {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    backdrop-filter: blur(12px);
    color: #A5B4FC;
}

.toast-alert.warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    backdrop-filter: blur(12px);
    color: #FBBF24;
}

.toast-alert.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(12px);
    color: #FCA5A5;
}

.toast-dismiss-btn {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    font-size: 16px;
    cursor: pointer;
    margin-left: auto;
    padding: 0 2px;
    line-height: 1;
}

.toast-dismiss-btn:hover { opacity: 1; }

@media (max-width: 640px) {
    .toast-host-stack {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
    .toast-host-stack .toast-alert {
        max-width: none;
    }
}
