/* Admin perf + motion polish (Mars shell) */

.loader-screen {
    background: rgba(5, 12, 28, 0.72);
    width: 100%;
    height: 100%;
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.loader-screen.is-visible,
.loader-screen:not([hidden]) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.loader-screen[hidden] {
    display: none !important;
}

.mars-loader {
    width: min(220px, 46vw);
    height: min(220px, 46vw);
    filter: drop-shadow(0 0 28px rgba(255, 140, 40, 0.35));
}

.mars-loader lottie-player {
    width: 100%;
    height: 100%;
}

.mars-loader-panel {
    width: min(420px, 92vw);
    padding: 28px 24px 20px;
    border-radius: 16px;
    background: rgba(8, 16, 36, 0.92);
    border: 1px solid rgba(255, 155, 40, 0.28);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    text-align: center;
    color: #f4f7fb;
}

.mars-loader-mark {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffb347;
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: hidden;
    animation: mars-pulse 1.2s ease-in-out infinite;
}

.mars-loader-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

@keyframes mars-pulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(11, 61, 145, 0.28)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 20px rgba(11, 61, 145, 0.45)); }
}

.mars-loader-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.mars-loader-elapsed {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 14px;
    font-variant-numeric: tabular-nums;
}

.mars-loader-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    margin-bottom: 14px;
}

.mars-loader-bar-fill {
    height: 100%;
    width: 8%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff9b16, #ffc56b);
    transition: width 0.25s ease;
}

.mars-loader-log {
    max-height: 120px;
    overflow-y: auto;
    text-align: left;
    font-size: 11px;
    line-height: 1.45;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: rgba(230, 236, 245, 0.88);
    background: rgba(0, 0, 0, 0.28);
    border-radius: 8px;
    padding: 8px 10px;
}

.mars-loader-log div {
    margin: 0 0 4px;
    word-break: break-word;
}

.mars-loader-log div:last-child {
    margin-bottom: 0;
}

.admin-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(30, 79, 138, 0.18);
    border-top-color: #1e4f8a;
    animation: admin-spin 0.7s linear infinite;
}

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

/* Dashboard cards */
.dash-card-grid > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.dash-stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 110px;
    animation: dash-fade-up 0.35s ease both;
    animation-delay: calc(var(--dash-i, 0) * 30ms);
}

.dash-stat-card figure {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    overflow: hidden;
    background: #eef3f8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin: 0;
}

.dash-stat-card figure img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.dash-stat-card span {
    line-height: 1.25;
    max-width: 100%;
}

.dash-card-extra.is-hidden {
    display: none !important;
}

.dash-show-more {
    margin: 12px 0 4px;
}

.dash-chart canvas {
    max-width: 100%;
}

/* Sidebar forms open transition */
.sidebar-nav .nav-forms-menu {
    overflow: visible;
    transition: opacity 0.2s ease;
}

.sidebar-nav .nav-forms-parent > a + .nav-forms-menu {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .admin-spinner,
    .mars-loader,
    .mars-loader-mark,
    .dash-stat-card,
    .loader-screen,
    .sidebar-nav .nav-forms-menu {
        animation: none !important;
        transition: none !important;
    }
}

@keyframes dash-fade-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
