/* ============================================
   EduLearn LMS - Loader System Styles
   ============================================ */

:root {
    --loader-bg: rgba(255, 255, 255, 0.95);
    --loader-blur: 10px;
}

/* ---- 1. Fullscreen Page Loader ---- */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--loader-bg);
    backdrop-filter: blur(var(--loader-blur));
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

#page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.logo-loader {
    position: relative;
    animation: logoPulse 2s infinite ease-in-out;
}

.logo-loader img {
    height: 100px;
    width: auto;
    object-fit: contain;
}

@keyframes logoPulse {
    0% { transform: scale(0.92); opacity: 0.8; filter: drop-shadow(0 0 0px var(--primary)); }
    50% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 25px rgba(21, 101, 192, 0.3)); }
    100% { transform: scale(0.92); opacity: 0.8; filter: drop-shadow(0 0 0px var(--primary)); }
}

/* ---- 2. Top Progress Bar ---- */
#top-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    box-shadow: 0 0 10px var(--primary-light);
    z-index: 100000;
    transition: width 0.3s ease;
}

/* ---- 3. Smart Button Loader ---- */
.smart-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease !important;
}

.smart-btn.loading {
    pointer-events: none !important;
    color: transparent !important;
}

.btn-loader-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin-top: -11px;
    margin-left: -11px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    animation: btnSpin 0.8s linear infinite;
    display: none;
}

/* If logo is provided, we can use it as a mask or background in JS */
.smart-btn.loading .btn-loader-spinner {
    display: block;
}

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

/* ---- 4. Skeleton Loaders ---- */
.skeleton {
    background: #f1f5f9;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 8px;
    display: block;
}

.skeleton-card { height: 200px; width: 100%; margin-bottom: 20px; }
.skeleton-text { height: 16px; width: 100%; margin-bottom: 12px; }
.skeleton-text.short { width: 60%; }
.skeleton-table-row { height: 48px; width: 100%; margin-bottom: 1px; border-radius: 0; }
.skeleton-circle { height: 50px; width: 50px; border-radius: 50%; }

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

/* Support for Dark Mode (if the app has it) */
@media (prefers-color-scheme: dark) {
    #page-loader { background: rgba(15, 23, 42, 0.95); }
    .skeleton { background: #1e293b; background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%); }
}
