/* Global Loading Overlay */
#globalLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
}

#globalLoader .loader-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#globalLoader .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

#loaderText {
    margin-top: 1rem;
    font-size: 1.1rem;
    color: #333;
}

/* Inline Loader */
.inline-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.inline-loader .spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Button Loading State */
button[disabled] .spinner-border {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

/* Progress Bar Container */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: #f0f0f0;
    z-index: 9998;
    display: none;
}

#progressBar {
    height: 100%;
    background-color: #007bff;
    transition: width 0.3s ease;
}

#progressText {
    position: fixed;
    top: 10px;
    right: 10px;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Skeleton Loading for Content */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.skeleton-title {
    height: 2rem;
    width: 60%;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.skeleton-button {
    height: 2.5rem;
    width: 120px;
    border-radius: 4px;
}

/* Pulse Animation for Loading Elements */
.pulse-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* Loading Dots Animation */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* Spinner Variations */
.spinner-grow {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    background-color: currentColor;
    border-radius: 50%;
    opacity: 0;
    animation: spinner-grow 0.75s linear infinite;
}

@keyframes spinner-grow {
    0% {
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: none;
    }
}

/* Mobile Responsive Loading */
@media (max-width: 767px) {
    #globalLoader .loader-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    #globalLoader .spinner-border {
        width: 2rem;
        height: 2rem;
    }
    
    #loaderText {
        font-size: 1rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #globalLoader {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    #globalLoader .loader-content {
        background: #2d2d2d;
        color: #fff;
    }
    
    #loaderText {
        color: #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .spinner-border,
    .spinner-grow {
        animation-duration: 1.5s;
    }
    
    .skeleton {
        animation: none;
        background: #f0f0f0;
    }
}