/* Capitol Academy Loading Indicator System - Optimized */

/* Global Loading Overlay - Performance optimized */
.capitol-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(1, 26, 45, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity, visibility;
}

.capitol-loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Loading Spinner - GPU accelerated */
.capitol-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(169, 4, 24, 0.3);
    border-top: 4px solid var(--ca-accent-red);
    border-radius: 50%;
    animation: capitol-spin 1s linear infinite;
    margin-bottom: 20px;
    will-change: transform;
}

@keyframes capitol-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading Container */
.capitol-loading-container {
    text-align: center;
    color: white;
}



/* Progress Bar */
.capitol-progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 20px auto 0;
    overflow: hidden;
}

.capitol-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a90418, #dc3545);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    animation: capitol-progress-pulse 2s ease-in-out infinite;
}

@keyframes capitol-progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Inline Loading Indicators */
.capitol-inline-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.capitol-inline-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(169, 4, 24, 0.3);
    border-top: 2px solid #a90418;
    border-radius: 50%;
    animation: capitol-spin 0.8s linear infinite;
}

/* Button Loading States */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: capitol-spin 0.8s linear infinite;
}

/* Page Transition Loading */
.page-transition-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #a90418, #dc3545);
    z-index: 9998;
    transform: translateX(-100%);
    animation: capitol-page-load 2s ease-in-out infinite;
}

@keyframes capitol-page-load {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

/* Skeleton Loading for Content */
.capitol-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: capitol-skeleton-loading 1.5s infinite;
}

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

.capitol-skeleton-text {
    height: 16px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.capitol-skeleton-title {
    height: 24px;
    border-radius: 4px;
    margin-bottom: 12px;
    width: 60%;
}

.capitol-skeleton-image {
    height: 200px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .capitol-spinner {
        width: 50px;
        height: 50px;
    }

    .capitol-progress-bar {
        width: 150px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .capitol-spinner,
    .capitol-inline-spinner,
    .btn.loading::after {
        animation: none;
        border: 4px solid #a90418;
    }
    
    .capitol-progress-fill {
        animation: none;
    }
    
    .page-transition-loading {
        animation: none;
        transform: translateX(0);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .capitol-loading-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .capitol-spinner {
        border-color: #ffffff;
        border-top-color: #ff0000;
    }
}
