<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Preloader - Cursos Gratuitos</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
</head>
<body>
    <!-- Preloader Container -->
    <div id="preloader" class="preloader">
        <div class="preloader-content">
            <div class="logo">
                <i class="fas fa-graduation-cap"></i>
                <h2>Cursos Gratuitos</h2>
            </div>
            
            <div class="spinner"></div>
            
            <div class="progress-bar">
                <div class="progress" id="progress"></div>
            </div>
            
            <p class="loading-text">Carregando...</p>
        </div>
    </div>

    <!-- Conteúdo Principal -->
    <div id="mainContent" class="main-content" style="display: none;">
        <div class="container">
            <h1>Bem-vindo!</h1>
            <p>Seu conteúdo aparece aqui após o carregamento.</p>
        </div>
    </div>

    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Poppins', sans-serif;
            overflow: hidden;
        }

        /* Preloader */
        .preloader {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #4F46E5, #7C3AED);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: opacity 0.5s ease;
        }

        .preloader.fade-out {
            opacity: 0;
            pointer-events: none;
        }

        .preloader-content {
            text-align: center;
            color: white;
        }

        /* Logo */
        .logo {
            margin-bottom: 2rem;
        }

        .logo i {
            font-size: 3rem;
            margin-bottom: 1rem;
            display: block;
        }

        .logo h2 {
            font-size: 1.5rem;
            font-weight: 600;
        }

        /* Spinner */
        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid rgba(255, 255, 255, 0.3);
            border-top: 4px solid white;
            border-radius: 50%;
            margin: 2rem auto;
            animation: spin 1s linear infinite;
        }

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

        .progress {
            height: 100%;
            background: white;
            border-radius: 2px;
            width: 0%;
            transition: width 0.1s ease;
        }

        .loading-text {
            font-size: 0.9rem;
            opacity: 0.8;
            margin-top: 1rem;
        }

        /* Main Content */
        .main-content {
            min-height: 100vh;
            background: #f5f7fa;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.5s ease;
        }

        .main-content.show {
            opacity: 1;
        }

        .container {
            text-align: center;
            padding: 2rem;
        }

        .container h1 {
            color: #1F2937;
            font-size: 2rem;
            margin-bottom: 1rem;
        }

        .container p {
            color: #666;
            font-size: 1rem;
        }

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

        /* Responsive */
        @media (max-width: 768px) {
            .logo i {
                font-size: 2.5rem;
            }
            
            .logo h2 {
                font-size: 1.2rem;
            }
            
            .progress-bar {
                width: 150px;
            }
        }
    </style>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const preloader = document.getElementById('preloader');
            const mainContent = document.getElementById('mainContent');
            const progress = document.getElementById('progress');
            
            let progressValue = 0;
            const duration = 2000; // 2 segundos
            const interval = 50; // Atualiza a cada 50ms
            const increment = (100 * interval) / duration;
            
            // Animação da barra de progresso
            const progressInterval = setInterval(() => {
                progressValue += increment;
                
                if (progressValue >= 100) {
                    progressValue = 100;
                    clearInterval(progressInterval);
                    
                    // Remove o preloader após completar
                    setTimeout(() => {
                        preloader.classList.add('fade-out');
                        mainContent.style.display = 'flex';
                        
                        setTimeout(() => {
                            mainContent.classList.add('show');
                            document.body.style.overflow = 'auto';
                        }, 100);
                    }, 200);
                }
                
                progress.style.width = progressValue + '%';
            }, interval);
        });
    </script>
</body>
</html>