/**
 * ═══════════════════════════════════════════════════════════════════════
 * [AXION SKELETON] — INSTITUTIONAL SHIMMER LOADING SYSTEM
 * ═══════════════════════════════════════════════════════════════════════
 *
 * Vectors: 40 (Skeleton Shimmer Transitions), 56 (Progressive Loading)
 *
 * Zero blank states. Every panel shows a sophisticated loading skeleton
 * before data arrives. Matches the dark institutional aesthetic.
 */

/* ─── BASE SHIMMER ─── */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.02) 0%,
        rgba(255, 255, 255, 0.06) 40%,
        rgba(255, 255, 255, 0.02) 80%
    );
    background-size: 200% 100%;
    animation: axion-shimmer 1.8s ease-in-out infinite;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(198, 227, 16, 0.03) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: axion-shimmer-accent 2.4s ease-in-out infinite;
}

@keyframes axion-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes axion-shimmer-accent {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── SKELETON PRIMITIVES ─── */
.skeleton-text {
    height: 10px;
    margin: 8px 0;
    width: 80%;
}

.skeleton-text-short {
    height: 10px;
    margin: 8px 0;
    width: 45%;
}

.skeleton-text-xs {
    height: 8px;
    margin: 6px 0;
    width: 60%;
}

.skeleton-heading {
    height: 16px;
    margin: 12px 0 8px;
    width: 35%;
}

.skeleton-kpi {
    height: 40px;
    width: 100%;
    margin: 4px 0;
}

.skeleton-chart {
    height: 200px;
    width: 100%;
    margin: 8px 0;
}

.skeleton-chart-tall {
    height: 320px;
    width: 100%;
    margin: 8px 0;
}

.skeleton-cell {
    height: 12px;
    margin: 4px 0;
}

.skeleton-avatar {
    height: 32px;
    width: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-badge {
    height: 18px;
    width: 56px;
    border-radius: 2px;
}

.skeleton-bar {
    height: 6px;
    border-radius: 1px;
}

/* ─── SKELETON LAYOUTS ─── */

/* Panel skeleton — mimics ov-panel structure */
.skeleton-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 16px;
    margin-bottom: 8px;
}

.skeleton-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Table skeleton */
.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.skeleton-table-row .skeleton-cell {
    flex: 1;
}

.skeleton-table-row .skeleton-cell:first-child {
    flex: 2;
}

/* Grid skeleton — mimics bento grid */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.skeleton-grid-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Heatmap skeleton */
.skeleton-heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 4px;
}

.skeleton-heatmap-cell {
    height: 52px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.02);
}

/* ─── COMPOSITE SKELETONS (Ready-made layouts) ─── */

/* Overview skeleton */
.skeleton-overview {
    display: grid;
    grid-template-columns: 1fr 200px 1fr;
    gap: 8px;
    padding: 8px;
}

@container panel (max-width: 600px) {
    .skeleton-overview {
        grid-template-columns: 1fr;
    }
}

/* News card skeleton */
.skeleton-news-card {
    padding: 12px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    margin-bottom: 6px;
}

.skeleton-news-card .skeleton-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

/* Chart with controls skeleton */
.skeleton-chart-module {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 12px;
}

.skeleton-chart-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.skeleton-chart-controls .skeleton-badge {
    width: 48px;
}

/* ─── TRANSITION: Skeleton → Real Content ─── */
.skeleton-container {
    position: relative;
}

.skeleton-container[data-loaded="true"] .skeleton,
.skeleton-container[data-loaded="true"] .skeleton-panel,
.skeleton-container[data-loaded="true"] .skeleton-news-card,
.skeleton-container[data-loaded="true"] .skeleton-chart-module {
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    position: absolute;
    inset: 0;
}

.skeleton-container .real-content {
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.skeleton-container[data-loaded="true"] .real-content {
    opacity: 1;
    transform: translateY(0);
}

/* ─── STAGGER ANIMATION ─── */
.skeleton-stagger > *:nth-child(1) { animation-delay: 0ms; }
.skeleton-stagger > *:nth-child(2) { animation-delay: 80ms; }
.skeleton-stagger > *:nth-child(3) { animation-delay: 160ms; }
.skeleton-stagger > *:nth-child(4) { animation-delay: 240ms; }
.skeleton-stagger > *:nth-child(5) { animation-delay: 320ms; }
.skeleton-stagger > *:nth-child(6) { animation-delay: 400ms; }
.skeleton-stagger > *:nth-child(7) { animation-delay: 480ms; }
.skeleton-stagger > *:nth-child(8) { animation-delay: 560ms; }

/* ─── DATA HYDRATION PULSE ─── */
/* Brief green glow when data arrives — used by AxionDOM */
@keyframes axion-hydrate {
    0%   { box-shadow: inset 0 0 0 1px rgba(198, 227, 16, 0.3); }
    50%  { box-shadow: inset 0 0 20px rgba(198, 227, 16, 0.08); }
    100% { box-shadow: none; }
}

.data-hydrated {
    animation: axion-hydrate 0.6s ease forwards;
}

/* ─── REDUCED MOTION ─── (Vector 50) */
@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .skeleton::after {
        animation: none;
        background: rgba(255, 255, 255, 0.04);
    }
    .data-hydrated {
        animation: none;
    }
    .skeleton-container .real-content,
    .skeleton-container[data-loaded="true"] .skeleton {
        transition: none;
    }
}

/* ─── AXION GOD-MODE OVERRIDE ─── */
[data-reduced-motion="true"] .skeleton,
[data-reduced-motion="true"] .skeleton::after {
    animation: none;
    background: rgba(255, 255, 255, 0.04);
}
