/* MAKZR Preloader - Vanilla CSS */
/* Eliminates FOUC and provides smooth loading experience */

/* Preloader Container */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

/* MAKZR Logo Container */
.preloader-logo {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: pulse 2s ease-in-out infinite;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.preloader-logo svg {
    width: 40px;
    height: 40px;
}

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* Text Styles */
.preloader-text {
    color: white;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preloader-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
}

/* Progress Bar (Optional) */
.preloader-progress {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.preloader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0.8));
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
    }
    50% { 
        transform: scale(1.05); 
        opacity: 0.8; 
    }
}

@keyframes progress {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

/* Content Hiding/Showing */
body:not(.loaded) #app-content {
    opacity: 0;
}

body.loaded #app-content {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* Responsive Design */
@media (max-width: 768px) {
    .preloader-logo {
        width: 60px;
        height: 60px;
        margin-bottom: 20px;
    }
    
    .preloader-logo svg {
        width: 30px;
        height: 30px;
    }
    
    .preloader-text {
        font-size: 20px;
    }
    
    .preloader-subtitle {
        font-size: 12px;
    }
    
    .loading-spinner {
        width: 32px;
        height: 32px;
        border-width: 2px;
        margin-bottom: 12px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #preloader {
        background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    #preloader {
        transition: none;
    }
    
    .preloader-logo,
    .loading-spinner,
    .preloader-progress-bar {
        animation: none;
    }
    
    body.loaded #app-content {
        transition: none;
    }
}
