/* Global Skeleton Loading & Shimmer Effect */
:root {
    --skeleton-bg: #e2e5e7;
    --skeleton-shimmer: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
}

/* Shimmer Animation */
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.skeleton {
    position: relative;
    overflow: hidden;
    background-color: var(--skeleton-bg);
    border-radius: 4px;
    display: inline-block;
}

.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--skeleton-shimmer);
    animation: shimmer 1.5s infinite;
}

/* Utility classes */
.skeleton-text { height: 1em; margin-bottom: 0.5em; width: 100%; }
.skeleton-title { height: 2em; margin-bottom: 1em; width: 80%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-rect { width: 100%; height: 200px; }

/* Global Loading Transitions */
#global-skeleton {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 99999;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.skeleton-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Base layout skeleton */
.skeleton-header { height: 72px; width: 100%; margin-bottom: 40px; }
.skeleton-container { display: flex; gap: 20px; flex: 1; }
.skeleton-sidebar { width: 280px; height: 100%; }
.skeleton-main { flex: 1; height: 100%; }

@media (max-width: 900px) {
    .skeleton-sidebar { display: none; }
}

/* =========================================
   DARK THEME OVERRIDES
   ========================================= */
[data-theme="dark"] {
    --skeleton-bg: #2a3147;
    --skeleton-shimmer: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0) 100%
    );
}

[data-theme="dark"] #global-skeleton {
    background: #0f111a !important;
}
