/**
 * Skeleton Loading States
 *
 * Provides shimmer loading placeholders for data-heavy components.
 * Use these when loading tables, cards, or other content.
 */

/* ==========================================================================
   Base Skeleton Styles
   ========================================================================== */

.skeleton-container {
    display: none;
}

.skeleton-container.loading {
    display: block;
}

.skeleton-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    border-radius: 4px;
    background: var(--card-bg, #fff);
}

.skeleton-cell {
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
    border-radius: 4px;
}

/* Cell sizes */
.skeleton-cell.cell-xs { width: 40px; flex: none; }
.skeleton-cell.cell-sm { flex: 1; min-width: 60px; }
.skeleton-cell.cell-md { flex: 2; min-width: 100px; }
.skeleton-cell.cell-lg { flex: 3; min-width: 150px; }
.skeleton-cell.cell-xl { flex: 4; min-width: 200px; }

/* Specific column types */
.skeleton-cell.cell-checkbox { width: 24px; flex: none; border-radius: 4px; }
.skeleton-cell.cell-date { width: 90px; flex: none; }
.skeleton-cell.cell-amount { width: 80px; flex: none; }
.skeleton-cell.cell-status { width: 100px; flex: none; border-radius: 12px; height: 24px; }
.skeleton-cell.cell-avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; }
.skeleton-cell.cell-actions { width: 120px; flex: none; }

/* Shimmer animation */
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

[data-theme="dark"] .skeleton-cell,
.dark-mode .skeleton-cell {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
}

/* ==========================================================================
   Table Skeleton
   ========================================================================== */

.skeleton-table {
    width: 100%;
}

.skeleton-table-header {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 4px 4px 0 0;
    margin-bottom: 2px;
}

.skeleton-table-header .skeleton-cell {
    height: 16px;
    opacity: 0.7;
}

.skeleton-table-body .skeleton-row:nth-child(even) {
    background: var(--bg-secondary, #f8f9fa);
}

/* ==========================================================================
   Card Skeleton
   ========================================================================== */

.skeleton-card {
    background: var(--card-bg, #fff);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.skeleton-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.skeleton-card-title {
    height: 24px;
    width: 60%;
}

.skeleton-card-body .skeleton-line {
    height: 16px;
    margin-bottom: 0.75rem;
}

.skeleton-card-body .skeleton-line:last-child {
    width: 40%;
}

/* ==========================================================================
   Dashboard Widgets Skeleton
   ========================================================================== */

.skeleton-widget {
    background: var(--card-bg, #fff);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.skeleton-widget-value {
    height: 36px;
    width: 50%;
    margin-bottom: 0.5rem;
}

.skeleton-widget-label {
    height: 14px;
    width: 70%;
}

.skeleton-widget-chart {
    height: 120px;
    margin-top: 1rem;
    border-radius: 4px;
}

/* ==========================================================================
   List Skeleton
   ========================================================================== */

.skeleton-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.skeleton-list-item:last-child {
    border-bottom: none;
}

.skeleton-list-content {
    flex: 1;
}

.skeleton-list-title {
    height: 18px;
    width: 60%;
    margin-bottom: 0.5rem;
}

.skeleton-list-subtitle {
    height: 14px;
    width: 40%;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Delay animations for staggered effect */
.skeleton-delay-1 { animation-delay: 0.1s; }
.skeleton-delay-2 { animation-delay: 0.2s; }
.skeleton-delay-3 { animation-delay: 0.3s; }
.skeleton-delay-4 { animation-delay: 0.4s; }
.skeleton-delay-5 { animation-delay: 0.5s; }

/* Hide skeleton when content is loaded */
.skeleton-container.loaded {
    display: none;
}

/* Show actual content when loaded */
.skeleton-content {
    display: none;
}

.skeleton-content.loaded {
    display: block;
}

/* Fade in transition */
.skeleton-fade-in {
    animation: skeleton-fade-in 0.3s ease-out;
}

@keyframes skeleton-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .skeleton-row {
        flex-wrap: wrap;
    }

    .skeleton-cell.cell-lg,
    .skeleton-cell.cell-xl {
        flex: 100%;
    }

    .skeleton-table-header {
        display: none;
    }

    .skeleton-row {
        flex-direction: column;
        gap: 0.5rem;
        border: 1px solid var(--border-color, #e0e0e0);
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    .skeleton-cell {
        width: 100% !important;
        flex: none !important;
    }

    .skeleton-cell.cell-checkbox,
    .skeleton-cell.cell-actions {
        display: none;
    }
}
