﻿/* ==========================================================================
   Shimmer Loading Skeletons (rows, card, dashboard)
   Aligns with GridStack: 12 cols desktop, collapses at md/sm
   ========================================================================== */

:root {
    --dash-cols: 12; /* desktop columns */
    --cell-h: 120px; /* GridStack cellHeight */
    --gap: 12px;
}

/* Base animation */
@keyframes shimmer-kf {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.shimmer {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}


@media (prefers-reduced-motion: reduce) {
    .shimmer-line, .shimmer-card, .shimmer-widget {
        animation: none;
    }
}

/* Rows & card */
.shimmer-line {
    height: 1.2rem;
}

.shimmer-card {
    height: 160px;
    width: 100%;
}

/* Overlay mode */
.shimmer-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.loading-overlay {
    position: relative;
    min-height: 240px;
}

/* =================== Dashboard variant =================== */
.shimmer-dashboard {
    display: grid;
    grid-template-columns: repeat(var(--dash-cols), 1fr);
    grid-auto-rows: var(--cell-h);
    gap: var(--gap);
    width: 100%;
    margin-top: 1rem;
    margin-left: 1rem;
}

/* Default (≥992px): 12 cols — mirrors your gs-w/gs-h */
.shimmer-equity {
    grid-column: span 4;
    grid-row: span 2;
}
/* gs-w=4, gs-h=2 */
.shimmer-pnl {
    grid-column: 5 / span 4;
    grid-row: span 2;
}

.shimmer-risk {
    grid-column: span 8;
    grid-row: span 3;
}

/* Make the blocks fill their grid areas */
.shimmer-widget {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* ---------- Breakpoints ---------- */

/* md (≤992px): collapse to 6 cols */
@media (max-width: 992px) {
    :root {
        --dash-cols: 6;
    }

    .shimmer-dashboard {
        grid-template-columns: repeat(var(--dash-cols), 1fr);
    }

    /* Proportional mapping from 12→6 columns:
     4/12 → span 2 ; 8/12 → span 4 */
    .shimmer-equity {
        grid-column: span 2;
        grid-row: span 2;
    }

    .shimmer-pnl {
        grid-column: 3 / span 2;
        grid-row: span 2;
    }

    .shimmer-risk {
        grid-column: span 4;
        grid-row: span 3;
    }
}

/* sm (≤576px): one-column “mobile/oneColumnMode” style */
@media (max-width: 576px) {
    :root {
        --dash-cols: 1;
    }

    .shimmer-dashboard {
        grid-template-columns: 1fr;
        grid-auto-rows: calc(var(--cell-h) * 1.1); /* a touch taller on mobile */
        gap: 10px;
    }

    /* Each widget full width; keep relative heights */
    .shimmer-equity {
        grid-column: 1;
        grid-row: span 2;
    }

    .shimmer-pnl {
        grid-column: 1;
        grid-row: span 2;
    }

    .shimmer-risk {
        grid-column: 1;
        grid-row: span 3;
    }
}

/* Optional: dark theme backdrop tweak */
[data-bs-theme="dark"] .shimmer-overlay {
    background: rgba(0,0,0,.25);
}
    
[data-bs-theme="light"] .shimmer-overlay {
    background: rgba(0,0,0,.10);
}

/* Optional: dark theme backdrop tweak */
[data-bs-theme="dark"] .shimmer-line, .shimmer-card, .shimmer-widget {
    background: linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0.08) 75%);
    background-size: 200% 100%;
    animation: shimmer-kf 2s linear infinite;
    border-radius: 6px;
}

[data-bs-theme="light"] .shimmer-line, .shimmer-card, .shimmer-widget {
    background: linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0.08) 75%);
    background-size: 200% 100%;
    animation: shimmer-kf 2s linear infinite;
    border-radius: 6px;
}
