<?php


//<----------------------------------------------------------->
//<-------------------COPIA AI BRUXÃO------------------------->
//<-------------CONTATO: https://t.me/eonbry------------------>
//<-------------DEVELOPER: EMANUEL NASCIMENTO----------------->
//<----------------------------------------------------------->



session_start();
include 'includes/conexao.php';
include 'includes/header.php';

// Busca todos os apps
$apps = $conexao->query("SELECT * FROM apps ORDER BY id DESC")->fetchAll(PDO::FETCH_ASSOC);
?>

<div class="glass-container">
    <h1 class="neon-title">📲 MEUS APPS CADASTRADOS</h1>

    <div class="apps-grid">
        <?php foreach ($apps as $app): ?>
            <div class="app-card">
                <div class="app-image">
                    <img src="assets/imagens/<?= htmlspecialchars($app['imagens']) ?>" alt="<?= htmlspecialchars($app['nome']) ?>">
                </div>
                <h3><?= htmlspecialchars($app['nome']) ?></h3>
                <p><?= htmlspecialchars($app['info']) ?></p>

                <div class="app-actions">
                    <a href="assets/apks/<?= htmlspecialchars($app['apk']) ?>" class="download-btn">⬇️ Download</a>
                    <a href="editar_app.php?id=<?= (int)$app['id'] ?>" class="edit-btn">✏️ Editar</a>
                    <a href="excluir_app.php?id=<?= (int)$app['id'] ?>" class="delete-btn" onclick="return confirm('Tem certeza?')">🗑️ Excluir</a>
                </div>
            </div>
        <?php endforeach; ?>
    </div>
</div>

<style>
    .glass-container {
        background: rgba(15, 15, 26, 0.7);
        backdrop-filter: blur(12px);
        border: 1px solid #00f0ff;
        border-radius: 15px;
        padding: 30px;
        width: 95%;
        max-width: 1200px;
        margin: 0 auto;
        box-shadow: 0 0 25px rgba(0, 240, 255, 0.2);
    }

    .neon-title {
        color: #00f0ff;
        text-align: center;
        font-size: 1.8rem;
        margin-bottom: 30px;
        text-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
    }

    .apps-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }

    .app-card {
        background: rgba(20, 20, 40, 0.7);
        border: 1px solid #00f0ff;
        border-radius: 10px;
        padding: 15px;
        transition: transform 0.3s;
    }

    .app-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 5px 15px rgba(0, 240, 255, 0.3);
    }

    .app-image img {
        width: 100%;
        border-radius: 5px;
        aspect-ratio: 16/9;
        object-fit: cover;
    }

    .app-actions {
        display: flex;
        gap: 10px;
        margin-top: 15px;
        flex-wrap: wrap;
    }

    .download-btn, .edit-btn, .delete-btn {
        padding: 8px 12px;
        border-radius: 5px;
        font-size: 0.8rem;
        text-decoration: none;
        transition: all 0.3s;
        border: 1px solid transparent;
    }

    .download-btn {
        background: rgba(0, 240, 255, 0.2);
        color: #00f0ff;
        border-color: #00f0ff;
    }

    .download-btn:hover {
        background: rgba(0, 240, 255, 0.4);
    }

    .edit-btn {
        background: rgba(255, 255, 0, 0.2);
        color: yellow;
        border-color: yellow;
    }

    .edit-btn:hover {
        background: rgba(255, 255, 0, 0.4);
    }

    .delete-btn {
        background: rgba(255, 0, 0, 0.2);
        color: #ff5555;
        border-color: #ff5555;
    }

    .delete-btn:hover {
        background: rgba(255, 0, 0, 0.4);
    }

    /* Responsividade */
    @media (max-width: 980px) {
        .apps-grid {
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        }
    }

    @media (max-width: 600px) {
        .apps-grid {
            grid-template-columns: 1fr;
        }
    }
</style>

<?php
include 'includes/footer.php';
?>
