/*
 * Skeleton Loaders for Hero Vired Portal
 * Beautiful loading states with glassmorphism effect
 */

/* Base skeleton styling */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
    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.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: skeleton-shimmer 2s infinite;
}

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

@keyframes skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Dark mode skeleton */
[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
}

/* Skeleton variants */
.skeleton-text {
    height: 16px;
    margin: 8px 0;
    width: 100%;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-title {
    height: 32px;
    width: 40%;
    margin-bottom: 16px;
}

.skeleton-card {
    height: 200px;
    width: 100%;
    margin-bottom: 24px;
    border-radius: 16px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-chart {
    height: 300px;
    width: 100%;
    border-radius: 16px;
    margin: 16px 0;
}

.skeleton-table-row {
    height: 48px;
    width: 100%;
    margin: 8px 0;
}

.skeleton-button {
    height: 40px;
    width: 120px;
    border-radius: 8px;
}

/* Dashboard specific skeletons */
.skeleton-dashboard-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.skeleton-stat-card {
    height: 140px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px;
}

.skeleton-stat-card .skeleton-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.skeleton-stat-card .skeleton-value {
    height: 36px;
    width: 60%;
    margin-bottom: 8px;
}

.skeleton-stat-card .skeleton-label {
    height: 20px;
    width: 80%;
}

/* Progressive loading states */
.loading-container {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spinner-rotate 1s linear infinite;
}

@keyframes spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
}

.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    animation: progress-bar 2s ease-in-out infinite;
}

@keyframes progress-bar {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* Fade in animation for loaded content */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide in animation */
.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Staggered animation for multiple items */
.stagger-item {
    opacity: 0;
    animation: staggerFadeIn 0.5s ease-out forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.1s; }
.stagger-item:nth-child(2) { animation-delay: 0.2s; }
.stagger-item:nth-child(3) { animation-delay: 0.3s; }
.stagger-item:nth-child(4) { animation-delay: 0.4s; }
.stagger-item:nth-child(5) { animation-delay: 0.5s; }
.stagger-item:nth-child(6) { animation-delay: 0.6s; }

@keyframes staggerFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .skeleton-dashboard-header {
        grid-template-columns: 1fr;
    }

    .skeleton-stat-card {
        height: 120px;
    }

    .skeleton-chart {
        height: 250px;
    }

    .loading-spinner {
        width: 48px;
        height: 48px;
    }
}

/* Pulsing effect for important skeletons */
.skeleton-pulse {
    animation: skeleton-pulse 2s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Content placeholder */
.content-placeholder {
    display: none;
}

.content-placeholder.loading {
    display: block;
}

.content-real {
    display: none;
}

.content-real.loaded {
    display: block;
}
