/**
 * Skeleton Loading CSS
 * Professional skeleton loading with shimmer animation
 * Compatible with AdminLTE and Bootstrap 4
 * Version: 1.0.0
 */

/* ========================================
   1. BASE SKELETON STYLES
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #f8f8f8 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer-wave 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes shimmer-wave {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Dark theme skeleton */
.skeleton-dark {
    background: linear-gradient(
        90deg,
        #2a2a2a 0%,
        #3a3a3a 20%,
        #2a2a2a 40%,
        #2a2a2a 100%
    );
}

/* ========================================
   2. SKELETON SHAPES
   ======================================== */

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    width: 100%;
}

.skeleton-text-sm {
    height: 12px;
}

.skeleton-text-lg {
    height: 20px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-avatar-sm {
    width: 32px;
    height: 32px;
}

.skeleton-avatar-lg {
    width: 60px;
    height: 60px;
}

.skeleton-button {
    height: 36px;
    width: 80px;
    border-radius: 4px;
}

.skeleton-button-sm {
    height: 28px;
    width: 60px;
}

.skeleton-badge {
    height: 20px;
    width: 60px;
    border-radius: 10px;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

/* ========================================
   3. TABLE SKELETON
   ======================================== */

.skeleton-table {
    width: 100%;
}

.skeleton-table-row {
    display: table-row;
}

.skeleton-table-cell {
    display: table-cell;
    padding: 12px;
    vertical-align: middle;
}

.skeleton-table-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.skeleton-table-body .skeleton-table-row {
    border-bottom: 1px solid #dee2e6;
}

.skeleton-table-body .skeleton-table-row:last-child {
    border-bottom: none;
}

/* AdminLTE Table Skeleton */
.table-skeleton {
    width: 100%;
}

.table-skeleton thead th {
    background-color: #f8f9fa;
    padding: 12px;
}

.table-skeleton tbody td {
    padding: 12px;
}

.table-skeleton .skeleton {
    display: block;
}

/* ========================================
   4. CARD SKELETON
   ======================================== */

.skeleton-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.skeleton-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.skeleton-card-avatar {
    margin-right: 12px;
}

.skeleton-card-title {
    flex: 1;
}

.skeleton-card-body {
    margin-bottom: 16px;
}

.skeleton-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========================================
   5. LIST SKELETON
   ======================================== */

.skeleton-list-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #dee2e6;
}

.skeleton-list-item:last-child {
    border-bottom: none;
}

.skeleton-list-avatar {
    margin-right: 12px;
}

.skeleton-list-content {
    flex: 1;
}

.skeleton-list-actions {
    margin-left: 12px;
}

/* ========================================
   6. GRID SKELETON
   ======================================== */

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.skeleton-grid-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
}

/* ========================================
   7. STATS BOX SKELETON (AdminLTE)
   ======================================== */

.skeleton-stats-box {
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
}

.skeleton-stats-icon {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    float: left;
    margin-right: 15px;
}

.skeleton-stats-content {
    overflow: hidden;
}

/* ========================================
   8. PAGINATION SKELETON
   ======================================== */

.skeleton-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.skeleton-pagination-item {
    width: 36px;
    height: 36px;
    border-radius: 4px;
}

/* ========================================
   9. TAB SKELETON
   ======================================== */

.skeleton-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 12px;
}

.skeleton-tab {
    height: 36px;
    width: 100px;
    border-radius: 4px 4px 0 0;
}

/* ========================================
   10. UTILITY CLASSES
   ======================================== */

.skeleton-container {
    padding: 20px;
}

.skeleton-hidden {
    display: none !important;
}

.skeleton-visible {
    display: block !important;
}

/* Fade in animation for loaded content */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade out animation */
.fade-out {
    animation: fadeOut 0.3s ease-out;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay-dark {
    background: rgba(0, 0, 0, 0.5);
}

/* Spinner */
.skeleton-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

