/* Preloader Styles - Optimized for Performance */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

.preloader-logo {
    width: 120px;
    height: auto;
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
}

.preloader-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    position: relative;
}

.preloader-spinner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #29a2e8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.preloader-text {
    font-family: 'DM Sans', 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #161c2d;
    margin-top: 15px;
    animation: fadeIn 0.8s ease-out 0.3s both;
}

.preloader-progress {
    width: 200px;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    margin: 20px auto 0;
    overflow: hidden;
    animation: fadeIn 0.8s ease-out 0.5s both;
}

.preloader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #29a2e8, #1B8FD1);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease-out;
    animation: shimmer 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 fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .preloader-logo {
        width: 100px;
        margin-bottom: 25px;
    }
    
    .preloader-spinner {
        width: 40px;
        height: 40px;
    }
    
    .preloader-text {
        font-size: 14px;
    }
    
    .preloader-progress {
        width: 150px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .preloader-spinner::before {
        animation: none;
    }
    
    .preloader-logo {
        animation: none;
    }
    
    .preloader-content {
        animation: none;
    }
    
    .preloader-text,
    .preloader-progress {
        animation: none;
    }
    
    .preloader-progress-bar {
        animation: none;
    }
}
