/* Skeleton Loaders */

/* ===== SKELETON LOADER VISIBILITY ===== */
.skeleton-loader {
    display: none;
}

.content-loaded {
    display: block;
    animation: fadeIn 0.4s ease-in;
}

/* When loading, show skeleton and hide content */
#progress-view.loading .skeleton-loader {
    display: block;
}

#progress-view.loading .content-loaded {
    display: none;
}

/* ===== BASE SKELETON STYLES ===== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--border) 0%,
        var(--hover) 50%,
        var(--border) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

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

/* Table skeleton */
.skeleton-table {
    width: 100%;
    border-spacing: 0;
    margin-top: 20px;
}

.skeleton-row {
    height: 60px;
    margin-bottom: 8px;
}

.skeleton-cell {
    padding: 12px;
}

.skeleton-bar {
    height: 16px;
    border-radius: 4px;
}

.skeleton-bar.wide {
    width: 100%;
}

.skeleton-bar.medium {
    width: 60%;
}

.skeleton-bar.small {
    width: 40%;
}

/* Card skeleton */
.skeleton-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    height: 120px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-card-title {
    height: 14px;
    width: 50%;
    border-radius: 4px;
}

.skeleton-card-value {
    height: 40px;
    width: 80px;
    border-radius: 8px;
    margin-top: auto;
}

/* Chart skeleton */
.skeleton-chart {
    height: 400px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    padding: 24px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.skeleton-bar-chart {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

.skeleton-bar-item {
    width: 100%;
    background: var(--border);
    border-radius: 4px 4px 0 0;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-bar-item:nth-child(1) { height: 40%; animation-delay: 0s; }
.skeleton-bar-item:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.skeleton-bar-item:nth-child(3) { height: 80%; animation-delay: 0.2s; }
.skeleton-bar-item:nth-child(4) { height: 50%; animation-delay: 0.3s; }
.skeleton-bar-item:nth-child(5) { height: 70%; animation-delay: 0.4s; }

/* Team card skeleton */
.skeleton-team-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.skeleton-team-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    height: 180px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-team-header {
    height: 24px;
    width: 60%;
    border-radius: 6px;
}

.skeleton-team-stat {
    height: 16px;
    border-radius: 4px;
    margin-top: 8px;
}

.skeleton-team-stat:nth-child(2) { width: 80%; }
.skeleton-team-stat:nth-child(3) { width: 70%; }
.skeleton-team-stat:nth-child(4) { width: 90%; }

/* Progress skeleton */
.skeleton-progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Fade in content when loaded */
.content-loaded {
    animation: fadeIn 0.4s ease-out;
}

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

/* Hide skeleton when content is loaded */
.loading .content-loaded {
    display: none;
}

.loading .skeleton-loader {
    display: block;
}

.skeleton-loader {
    display: none;
}

/* Responsive skeleton */
@media (max-width: 768px) {
    .skeleton-chart {
        height: 300px;
    }
    
    .skeleton-card {
        height: 100px;
    }
    
    .skeleton-team-card {
        height: 150px;
    }
}
