<!DOCTYPE html>
<html lang="pl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>irylek.pages.dev</title>
    <script disable-devtool-auto src='https://cdn.jsdelivr.net/npm/disable-devtool'></script>
    <style>
        body {
            font-family: 'Roboto', Arial, sans-serif;
            background-color: #181818;
            color: #e0e0e0;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            align-items: center; /* Wyśrodkowanie w poziomie */
            justify-content: flex-start; /* Góra strony */
            min-height: 100vh;
        }

        .navbar {
            display: flex;
            justify-content: space-between;
            padding: 10px 20px;
            background-color: #141414;
            position: fixed;
            width: calc(100% - 40px);
            top: 0;
            z-index: 1000;
        }

        .search-bar {
            width: 80%;
            max-width: 600px;
            margin: 20px 0; /* Odstęp od góry */
            padding: 12px 15px;
            background-color: #252525;
            border: none;
            border-radius: 30px;
            color: #e0e0e0;
            font-size: 1rem;
            outline: none;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
            text-align: center; /* Wyśrodkowanie tekstu */
        }

        .search-bar::placeholder {
            text-align: center; /* Wyśrodkowanie placeholdera */
            color: #888;
        }

        .channel-list {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 20px;
            padding: 20px;
        }

        .channel-item {
            background-color: #252525;
            border-radius: 12px;
            padding: 15px;
            text-align: center;
            width: 220px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            align-items: center;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .channel-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
        }

        .channel-item img {
            width: 100%;
            height: 120px; /* Adjust height as needed */
            object-fit: contain; /* Ensures the image fits inside the box without distortion */
            border-radius: 10px;
            background: transparent; /* Remove any background color */
        }

        .channel-item span {
            display: block;
            margin: 15px 0;
            font-size: 1.1rem;
            color: #ffffff;
            font-weight: 500;
        }

        .channel-item a {
            color: #bb86fc;
            text-decoration: none;
            font-size: 1rem;
            font-weight: bold;
            border: 1px solid #bb86fc;
            padding: 8px 16px;
            border-radius: 20px;
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        .channel-item a:hover {
            background-color: #bb86fc;
            color: #181818;
        }

        .channel-item.hidden {
            display: none;
        }

        footer {
            margin-top: 20px;
            text-align: center;
            padding: 10px 0;
            font-size: 0.9rem;
            color: #888;
            border-top: 1px solid #333;
        }
    </style>
</head>
<body>
    <div class="navbar">
        <iframe src="https://irylek.pages.dev/navbar" width="100%" height="80" frameborder="0"></iframe>
    </div>
    <input type="text" class="search-bar" id="searchInput" placeholder="Szukaj kanałów....">
    <div class="channel-list" id="channelList"></div>

    <footer>
        © 2024 | Made with ❤️ by Irylek
    </footer>

    <script>
        fetch('https://irylek.pages.dev/assets/channels.json')
            .then(response => response.json())
            .then(channels => {
                const channelList = document.getElementById('channelList');
                
                channels.forEach(channel => {
                    const channelItem = document.createElement('div');
                    channelItem.classList.add('channel-item');
                    
                    const img = document.createElement('img');
                    img.src = channel.image;
                    img.alt = channel.channel;

                    const name = document.createElement('span');
                    name.textContent = channel.channel;

                    const link = document.createElement('a');
                    link.href = channel.embed;
                    link.textContent = 'Oglądaj';

                    channelItem.appendChild(img);
                    channelItem.appendChild(name);
                    channelItem.appendChild(link);

                    channelList.appendChild(channelItem);
                });

                const searchInput = document.getElementById('searchInput');
                searchInput.addEventListener('input', function() {
                    const filter = searchInput.value.toLowerCase();
                    const channelItems = document.querySelectorAll('.channel-item');
                    
                    channelItems.forEach(item => {
                        const channelName = item.querySelector('span').textContent.toLowerCase();
                        if (channelName.includes(filter)) {
                            item.classList.remove('hidden');
                        } else {
                            item.classList.add('hidden');
                        }
                    });
                });
            })
            .catch(error => console.error('Error loading channels:', error));
    </script>
</body>
</html>