<!DOCTYPE html>
<html lang="pt-BR">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Jogos do Dia</title>
    <link rel="stylesheet" type="text/css" href="https://tropa.click/css/estilo.css">
    <style>
        /* --------- Estilos Gerais --------- */
        body {
            font-family: Arial, sans-serif;
            background-color: #141414;
            color: white;
            margin: 0;
            padding: 0;
        }

        /* ---- Modal e estilos gerais ---- */
        .modal {
            display: none;
            position: fixed;
            z-index: 100;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.7);
        }

        .modal-content {
            background-color: #333;
            margin: 5% auto;
            padding: 20px;
            border-radius: 10px;
            width: 320px;
            text-align: center;
            color: white;
        }

        .close-btn {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
            margin-top: -20px;
        }

        .close-btn:hover {
            color: white;
            cursor: pointer;
        }

        .btn-salvar {
            background-color: #28a745;
            border: none;
            color: white;
            padding: 10px 20px;
            font-size: 16px;
            border-radius: 5px;
            cursor: pointer;
        }

        .btn-salvar:hover {
            background-color: #218838;
        }

        .star-button {
            font-size: 24px;
            cursor: pointer;
            color: gold;
            border: none;
            background: none;
            margin-left: 10px;
        }

        /* ---- Animação GLOW (usando glowColor) ---- */
        @keyframes glowing {
            0% {
                filter: brightness(1);
                box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
            }

            50% {
                filter: brightness(1.5);
                box-shadow: 0 0 15px rgba(<?php echo $glowR . ',' . $glowG . ',' . $glowB; ?>, 0.6);
            }

            100% {
                filter: brightness(1);
                box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
            }
        }

        /* ---- Estilos para VÁRIOS CARDS (Layout Multiple) ---- */
        .multiple-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 20px;
            padding: 20px;
        }

        .jogo-card {
            background: linear-gradient(145deg, <?php echo htmlspecialchars($color1); ?>, <?php echo htmlspecialchars($color2); ?>);
            border-radius: 30px;
            width: 250px;
            padding: 10px;
            margin-bottom: 30px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
            text-align: center;
            position: relative;
        }

        .times {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 15px;
            position: relative;
            top: -20px;
        }

        .time-box {
            background: linear-gradient(145deg, <?php echo htmlspecialchars($color1); ?>, <?php echo htmlspecialchars($color2); ?>);
            border-radius: 40px;
            padding: 10px;
            width: 120px;
            text-align: center;
            color: white;
            box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3);
            animation: glowing 5s infinite alternate;
            position: relative;
        }

        .time img {
            width: 70px;
            height: 70px;
            object-fit: contain;
            display: block;
            margin: 0 auto;
        }

        .time p {
            margin: 5px 0 0 0;
            font-size: 14px;
            font-weight: bold;
            color: white;
            /* Nome do time em branco */
            text-overflow: ellipsis;
            white-space: nowrap;
            overflow: hidden;
            max-width: 100px;
            margin: 0 auto;
        }

        .placar {
            font-size: 24px;
            font-weight: bold;
            color: yellow;
            margin-top: 5px;
        }

        .vs img {
            width: 40px;
            height: auto;
            object-fit: contain;
        }

        .hora {
            font-size: 35px;
            margin: 10px 0;
            font-weight: bold;
            color: #ffffff;
        }

        .campeonato {
            font-size: 15px;
            margin-top: -20px;
            font-weight: bold;
            color: #ffffff;
        }

        .canais {
            display: flex;
            justify-content: center;
            gap: 10px;
        }

        .canal-box {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 5px 10px;
            border: 1px solid #ccc;
            border-radius: 10px;
            background-color: white;
            color: black;
            font-weight: bold;
            min-width: 100px;
            height: 20px;
        }

        .canal-box img {
            width: 25px;
            height: 25px;
            margin-right: 5px;
            object-fit: contain;
        }

        .canal-box p {
            margin: 0;
            font-size: 14px;
            color: black;
        }

        /* ---- Estilos para o Status ---- */
        .status {
            margin-top: 10px;
            padding: 5px 10px;
            border-radius: 5px;
            color: white;
            font-weight: bold;
            animation: status-glow 1s infinite alternate;
            text-align: center;
            display: inline-block;
            font-size: 14px;
            /* Ajuste o tamanho da fonte */
        }

        @keyframes status-glow {
            0% {
                filter: brightness(1);
            }

            100% {
                filter: brightness(1.5);
            }
        }
    </style>
</head>

<body>
    <h1 style="text-align: center;">
        <button class="star-button" onclick="openModal()">&#9733;</button>
        Jogos de Hoje <?php echo $dataAtual; ?>
        <button class="star-button" onclick="openModal()">&#9733;</button>
    </h1>

    <div id="modal" class="modal">
        <div class="modal-content">
            <span class="close-btn" onclick="closeModal()">&times;</span>
            <h2>Configurações</h2>
            <form method="GET" action="">
                <label for="color1">Cor 1 (gradiente): </label><br>
                <input type="color" id="color1" name="color1" value="<?php echo htmlspecialchars($color1); ?>"><br><br>

                <label for="color2">Cor 2 (gradiente): </label><br>
                <input type="color" id="color2" name="color2" value="<?php echo htmlspecialchars($color2); ?>"><br><br>

                <label for="glowColor">Cor do Glow: </label><br>
                <input type="color" id="glowColor" name="glowColor" value="<?php echo htmlspecialchars($glowColor); ?>"><br><br>

                <button type="submit" class="btn-salvar">Salvar Configurações</button>
            </form>
        </div>
    </div>

    <div id="layoutMultiple" class="multiple-container" style="display: flex;">
        <?php if (empty($jogos)) : ?>
            <h2 style="width: 100%; text-align: center;">Nenhum jogo para hoje!</h2>
        <?php else : ?>
            <?php foreach ($jogos as $jogo) : ?>
                <div class="jogo-card">
                    <div class="times">
                        <div class="time-box">
                            <div class="time">
                                <img src="<?= $jogo['img_time1_url']; ?>" alt="<?= $jogo['time1']; ?>">
                                <p><?= $jogo['time1']; ?></p>
                            </div>
                            <div class="placar"><?= $jogo['placar_time1']; ?></div>
                        </div>
                        <div class="vs">
                            <img src="https://pic.onlinewebfonts.com/thumbnails/icons_418591.svg" alt="Versus">
                        </div>
                        <div class="time-box">
                            <div class="time">
                                <img src="<?= $jogo['img_time2_url']; ?>" alt="<?= $jogo['time2']; ?>">
                                <p><?= $jogo['time2']; ?></p>
                            </div>
                            <div class="placar"><?= $jogo['placar_time2']; ?></div>
                        </div>
                    </div>
                    <div class="campeonato"><?= $jogo['competicao']; ?></div>
                    <div class="hora"><?= $jogo['horario']; ?></div>
                    <div class="canais">
                        <?php if (!empty($jogo['img_canal_url'])) : ?>
                            <div class="canal-box">
                                <img src="<?= $jogo['img_canal_url']; ?>" alt="<?= $jogo['canal']; ?>">
                                <p><?= $jogo['canal']; ?></p>
                            </div>
                        <?php endif; ?>
                    </div>
                    <?php
                    // Ajuste para verificar se "FIM DE JOGO" está presente no status
                    $status = strtoupper(trim($jogo['status']));
                    if (strpos($status, 'FIM DE JOGO') !== false) {
                        $statusClass = 'status-fim'; // Cor do fundo vermelho
                    } else {
                        $statusClass = 'status-andamento'; // Cor do fundo verde
                    }
                    ?>
                    <style>
    .status-fim {
        background-color: red;
        color: white;
    }
    .status-andamento {
        background-color: green;
        color: white;
    }
</style>
                    <div class="status <?= $statusClass; ?>">
                        <?= $jogo['status']; ?>
                    </div>
                </div>
            <?php endforeach; ?>
        <?php endif; ?>
    </div>

    <script>
        function openModal() {
            document.getElementById('modal').style.display = 'block';
        }

        function closeModal() {
            document.getElementById('modal').style.display = 'none';
        }
        document.addEventListener('keydown', function(e) {
  if (e.key === 'F12') {
    e.preventDefault(); // Impede a ação padrão da tecla F12
    alert('Acesso às ferramentas de desenvolvedor bloqueado.'); // Exibe um alerta (opcional)
  }
});
        document.addEventListener('contextmenu', event => event.preventDefault());
        window.onclick = function(event) {
            const modal = document.getElementById('modal');
            if (event.target == modal) {
                modal.style.display = 'none';
            }
        }
    </script>
</body>

</html>
