<!DOCTYPE html>
<html lang="el">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Αυτοκαταστροφικός Κώδικας</title>
    <style>
        /* Κρύβουμε το iframe */
        #youtubePlayer {
            width: 0;
            height: 0;
            visibility: hidden;
        }
        .button-container {
            display: flex;
            justify-content: center;
            margin-top: 20px;
        }
        button {
            margin: 0 10px;
            padding: 10px 20px;
        }
        #pauseButton {
            display: none; /* Κρύβουμε το Pause αρχικά */
        }
    </style>
</head>
<body>

    <iframe id="youtubePlayer" src="https://www.youtube.com/embed/NCpL8xpzafE?enablejsapi=1" frameborder="0" allow="autoplay; encrypted-media"></iframe>

    <script>
        let destructionTimeout;
        let destructionStartTime = localStorage.getItem('destructionStartTime');

        if (!destructionStartTime) {
            destructionStartTime = Date.now();
            localStorage.setItem('destructionStartTime', destructionStartTime);
        }

        function checkDestruction() {
            const currentTime = Date.now();
            const elapsedTime = (currentTime - destructionStartTime) / (1000 * 60 * 60); // Σε ώρες

            if (elapsedTime >= 48) {
                activateSelfDestruction();
            }
        }

        function activateSelfDestruction() {
            document.body.innerHTML = '<h1>Ο κώδικας έχει αυτοκαταστραφεί</h1>';
            setTimeout(() => {
                // Διαγραφή του κώδικα
                localStorage.removeItem('destructionStartTime');
                window.close();
            }, 100);
        }

        function extendDestructionTime(hours) {
            const newStartTime = Date.now() - (48 - hours) * 60 * 60 * 1000;
            localStorage.setItem('destructionStartTime', newStartTime);
        }

        function shareToSocialMedia(platform) {
            const url = encodeURIComponent('https://www.e-repellent.com/');
            let shareUrl = '';

            if (platform === 'facebook') {
                shareUrl = `https://www.facebook.com/sharer/sharer.php?u=${url}`;
            } else if (platform === 'twitter') {
                shareUrl = `https://twitter.com/intent/tweet?url=${url}`;
            } else if (platform === 'instagram') {
                alert('Κοινοποίηση στο Instagram δεν υποστηρίζεται άμεσα μέσω συνδέσμου.');
                return;
            }

            window.open(shareUrl, '_blank');
            extendDestructionTime(90); // Παράταση 90 ωρών
        }

        function accessFromDevice() {
            extendDestructionTime(0.1); // Παράταση 0.1 ώρας (6 λεπτά)
        }

        checkDestruction();

        // Προσθήκη κουμπιών για κοινή χρήση και πρόσβαση
    </script>

    <div class="button-container">
        <button onclick="shareToSocialMedia('facebook')">Κοινοποίηση στο Facebook</button>
        <button onclick="shareToSocialMedia('twitter')">Κοινοποίηση στο Twitter</button>
        <button onclick="accessFromDevice()">Πρόσβαση από συσκευή</button>
    </div>

    <script src="https://www.youtube.com/iframe_api"></script>
</body>
</html>
