<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Upload Manager - Simple Buttons</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background: #f5f5f5;
            padding: 50px;
            text-align: center;
        }
        .buttons {
            max-width: 600px;
            margin: 0 auto;
            gap: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .btn {
            padding: 15px 30px;
            font-size: 18px;
            font-weight: 600;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            gap: 12px;
            width: 100%;
            max-width: 400px;
            justify-content: center;
        }
        .btn-upload {
            background: #4a90d9;
            color: white;
        }
        .btn-upload:hover {
            background: #357abd;
            transform: translateY(-2px);
        }
        .btn-manager {
            background: #6c5ce7;
            color: white;
        }
        .btn-manager:hover {
            background: #5a4bd1;
            transform: translateY(-2px);
        }
        .um-widget-modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            z-index: 99999;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: inherit;
        }
        .um-widget-backdrop {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.6);
        }
        .um-widget-content {
            position: relative;
            width: 90%;
            max-width: 700px;
            max-height: 90vh;
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        }
        .um-widget-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            border-bottom: 1px solid #eee;
            background: #fafbfc;
        }
        .um-widget-title {
            margin: 0;
            font-size: 1.2rem;
            font-weight: 600;
            color: #333;
        }
        .um-widget-close {
            width: 36px;
            height: 36px;
            border: none;
            background: none;
            cursor: pointer;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #666;
            transition: all 0.2s;
        }
        .um-widget-close:hover {
            background: #eee;
            color: #333;
        }
        .um-widget-iframe {
            width: 100%;
            height: 500px;
            border: none;
        }
        @media (max-width: 768px) {
            body { padding: 20px; }
            .um-widget-iframe { height: 70vh; }
        }
    </style>
</head>
<body>
    <div class="buttons">
        <h1>📁 Upload Manager</h1>
        
        <button class="btn btn-upload" onclick="openUploadModal()">
            📤 Dateien hochladen
        </button>
        
        <button class="btn btn-manager" onclick="openManagerModal()">
            📋 Dateien verwalten
        </button>
    </div>

    <script>
        const UPLOAD_SERVER = 'https://uplman.assecutor.net';  // Dein Server!

        function openUploadModal() {
            openModal('index.php?type=job');
        }

        function openManagerModal() {
            openModal('manager.php?type=job&allowDelete=true&allowDownload=true');
        }

        function openModal(pageUrl) {
            // Altes Modal schließen
            const existing = document.querySelector('.um-widget-modal');
            if (existing) existing.remove();

            // Neues Modal erstellen
            const modal = document.createElement('div');
            modal.className = 'um-widget-modal';
            modal.innerHTML = `
                <div class="um-widget-backdrop"></div>
                <div class="um-widget-content">
                    <div class="um-widget-header">
                        <h3 class="um-widget-title">${pageUrl.includes('index.php') ? 'Dateien hochladen' : 'Dateien verwalten'}</h3>
                        <button class="um-widget-close" onclick="this.closest('.um-widget-modal').remove()">
                            <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                                <line x1="18" y1="6" x2="6" y2="18"></line>
                                <line x1="6" y1="6" x2="18" y2="18"></line>
                            </svg>
                        </button>
                    </div>
                    <iframe class="um-widget-iframe" src="${UPLOAD_SERVER}/${pageUrl}"></iframe>
                </div>
            `;
            
            document.body.appendChild(modal);

            // ESC zum Schließen
            const escHandler = (e) => {
                if (e.key === 'Escape') modal.remove();
            };
            document.addEventListener('keydown', escHandler);

            // Cleanup bei Schließen
            modal.addEventListener('click', (e) => {
                if (e.target.classList.contains('um-widget-backdrop')) modal.remove();
            });
            modal.addEventListener('remove', () => {
                document.removeEventListener('keydown', escHandler);
            });
        }
    </script>
</body>
</html>
