<!DOCTYPE html>

<html lang="pt-BR">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>MPS Equip</title>

    <style>

        * {

            margin: 0;

            padding: 0;

            box-sizing: border-box;

        }

        

        body {

            font-family: Arial, sans-serif;

            background-color: #ffffff;

            overflow: hidden;

        }

        

        .pdf-container {

            width: 100vw;

            height: 100vh;

            position: relative;

        }

        

        .pdf-viewer {

            width: 100%;

            height: 100%;

            border: none;

            display: block;

        }

        

        .loading {

            position: absolute;

            top: 50%;

            left: 50%;

            transform: translate(-50%, -50%);

            text-align: center;

            z-index: 10;

            background-color: white;

            padding: 30px;

            border-radius: 10px;

            box-shadow: 0 4px 20px rgba(0,0,0,0.1);

        }

        

        .spinner {

            border: 4px solid #f3f3f3;

            border-top: 4px solid #007bff;

            border-radius: 50%;

            width: 50px;

            height: 50px;

            animation: spin 1s linear infinite;

            margin: 0 auto 20px;

        }

        

        @keyframes spin {

            0% { transform: rotate(0deg); }

            100% { transform: rotate(360deg); }

        }

        

        .loading-text {

            color: #333;

            font-size: 16px;

            font-weight: 500;

        }

        

        .error-message {

            display: none;

            position: absolute;

            top: 50%;

            left: 50%;

            transform: translate(-50%, -50%);

            text-align: center;

            background-color: white;

            padding: 40px;

            border-radius: 10px;

            box-shadow: 0 4px 20px rgba(0,0,0,0.1);

            max-width: 600px;

            border-left: 5px solid #dc3545;

        }

        

        .error-message h2 {

            color: #dc3545;

            margin-bottom: 20px;

            font-size: 24px;

        }

        

        .error-message p {

            color: #666;

            line-height: 1.6;

            margin-bottom: 15px;

            text-align: left;

        }

        

        .error-message ul {

            text-align: left;

            color: #666;

            margin: 15px 0;

            padding-left: 20px;

        }

        

        .error-message li {

            margin-bottom: 8px;

        }

        

        .retry-button {

            background-color: #007bff;

            color: white;

            border: none;

            padding: 12px 24px;

            border-radius: 5px;

            cursor: pointer;

            font-size: 16px;

            margin-top: 20px;

            transition: background-color 0.3s;

        }

        

        .retry-button:hover {

            background-color: #0056b3;

        }

        

        /* Estilo para dispositivos móveis */

        @media (max-width: 768px) {

            .pdf-container {

                height: 100vh;

            }

            

            .loading {

                padding: 20px;

                margin: 20px;

            }

            

            .error-message {

                margin: 20px;

                padding: 30px;

                max-width: calc(100vw - 40px);

            }

        }

    </style>

</head>

<body>

    <div class="pdf-container">

        <div class="loading" id="loading">

            <div class="spinner"></div>

            <div class="loading-text">Carregando documento...</div>

        </div>

        

        <!-- Método principal: object com fallback para embed -->

        <object id="pdfObject" 

                data="mps.pdf#toolbar=0&navpanes=0&scrollbar=0" 

                type="application/pdf" 

                class="pdf-viewer"

                style="display: none;">

            

            <embed id="pdfEmbed" 

                   src="mps.pdf#toolbar=0&navpanes=0&scrollbar=0" 

                   type="application/pdf" 

                   class="pdf-viewer">

        </object>

        

        <div class="error-message" id="errorMessage">

            <h2>⚠️ Arquivo não encontrado</h2>

            <p><strong>O arquivo "mps.pdf" não foi localizado no servidor.</strong></p>

            

            <p>Para resolver este problema, verifique se:</p>

            <ul>

                <li>O arquivo PDF foi enviado para o servidor</li>

                <li>O arquivo está na mesma pasta que o arquivo index.html</li>

                <li>O nome do arquivo é exatamente <strong>"mps.pdf"</strong> (com letras minúsculas)</li>

                <li>O arquivo não está corrompido</li>

            </ul>

            

            <p><strong>Passos para corrigir:</strong></p>

            <ul>

                <li>1. Acesse o painel de controle da sua hospedagem</li>

                <li>2. Vá para o gerenciador de arquivos</li>

                <li>3. Navegue até a pasta raiz do site (public_html ou www)</li>

                <li>4. Faça upload do arquivo "mps.pdf" na mesma pasta do index.html</li>

            </ul>

            

            <button class="retry-button" onclick="location.reload()">🔄 Tentar Novamente</button>

        </div>

    </div>


    <script>

        let pdfLoaded = false;

        let loadTimeout;

        

        function hideLoading() {

            const loading = document.getElementById('loading');

            if (loading) {

                loading.style.display = 'none';

            }

        }

        

        function showError() {

            hideLoading();

            const errorMessage = document.getElementById('errorMessage');

            if (errorMessage) {

                errorMessage.style.display = 'block';

            }

        }

        

        function showPDF(element) {

            if (!pdfLoaded) {

                pdfLoaded = true;

                hideLoading();

                element.style.display = 'block';

                clearTimeout(loadTimeout);

                console.log('PDF carregado com sucesso');

            }

        }

        

        function checkPDFFile() {

            // Verificar se o arquivo PDF existe

            fetch('mps.pdf', { method: 'HEAD' })

                .then(response => {

                    console.log('Status da verificação do PDF:', response.status);

                    if (response.status === 404) {

                        console.error('Arquivo mps.pdf não encontrado (404)');

                        showError();

                    } else if (response.ok) {

                        console.log('Arquivo mps.pdf encontrado, tentando carregar...');

                        initializePDFViewer();

                    } else {

                        console.warn('Resposta inesperada:', response.status);

                        initializePDFViewer(); // Tentar carregar mesmo assim

                    }

                })

                .catch(error => {

                    console.error('Erro ao verificar arquivo PDF:', error);

                    showError();

                });

        }

        

        function initializePDFViewer() {

            const pdfObject = document.getElementById('pdfObject');

            const pdfEmbed = document.getElementById('pdfEmbed');

            

            // Configurar timeout de 10 segundos

            loadTimeout = setTimeout(() => {

                if (!pdfLoaded) {

                    console.error('Timeout: PDF não carregou em 10 segundos');

                    showError();

                }

            }, 10000);

            

            // Tentar detectar quando o PDF carrega

            if (pdfObject) {

                pdfObject.onload = function() {

                    console.log('PDF carregado via object');

                    showPDF(pdfObject);

                };

                

                pdfObject.onerror = function() {

                    console.warn('Falha ao carregar via object, tentando embed');

                    if (!pdfLoaded && pdfEmbed) {

                        pdfEmbed.onload = function() {

                            console.log('PDF carregado via embed');

                            showPDF(pdfEmbed);

                        };

                        pdfEmbed.onerror = function() {

                            console.error('Falha ao carregar via embed');

                            if (!pdfLoaded) {

                                showError();

                            }

                        };

                    }

                };

            }

            

            // Fallback: assumir que carregou após 5 segundos se não houve erro

            setTimeout(() => {

                if (!pdfLoaded) {

                    console.log('Assumindo que PDF carregou (fallback)');

                    showPDF(pdfObject);

                }

            }, 5000);

        }

        

        // Inicializar quando a página carregar

        document.addEventListener('DOMContentLoaded', function() {

            console.log('Página carregada, verificando arquivo PDF...');

            checkPDFFile();

        });

        

        // Prevenir menu de contexto no PDF (botão direito)

        document.addEventListener('contextmenu', function(e) {

            e.preventDefault();

        });

        

        // Prevenir algumas teclas de atalho

        document.addEventListener('keydown', function(e) {

            // Prevenir Ctrl+S (salvar)

            if (e.ctrlKey && e.key === 's') {

                e.preventDefault();

            }

            // Prevenir Ctrl+P (imprimir)

            if (e.ctrlKey && e.key === 'p') {

                e.preventDefault();

            }

        });

    </script>

</body>

</html>