<?php

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


session_start();
require_once __DIR__ . '/../db.php';  
$erro = false;

if ($_SERVER['REQUEST_METHOD'] === 'POST') {

    $user = trim($_POST['usuario'] ?? '');
    $pass = trim($_POST['senha'] ?? '');

    $stmt = $db->prepare("SELECT * FROM users WHERE username = ?");
    $stmt->execute([$user]);
    $dados = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($dados && password_verify($pass, $dados['pass'])) {
        $_SESSION['user'] = $dados['username'];
        header("Location: ../gerenciar.php");
        exit;
    }

    $erro = true;
}
?>

<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - Loja de Apps</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<style>
*{margin:0;padding:0;box-sizing:border-box;font-family:"Poppins",sans-serif;}
body{
    background:linear-gradient(135deg,#0a0f1f,#101b3a,#0d1226);
    height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
}
.card{
    width:100%;
    max-width:600px;
    background:#111827cc;
    backdrop-filter:blur(12px);
    border:1px solid #1f2937;
    border-radius:16px;
    padding:28px;
    color:white;
    box-shadow:0 0 25px rgba(0,0,0,0.4);
}
.card h2{
    text-align:center;
    margin-bottom:25px;
    font-weight:600;
    letter-spacing:1px;
}
.input-group{
    margin-bottom:18px;
}
.input-group label{
    font-size:14px;
    color:#9ca3af;
}
.input-group input{
    width:100%;
    padding:12px;
    margin-top:6px;
    border:none;
    border-radius:8px;
    background:#1f2937;
    color:white;
    font-size:15px;
}
.button{
    width:100%;
    padding:12px;
    margin-top:5px;
    background:#2563eb;
    color:white;
    border:none;
    border-radius:8px;
    cursor:pointer;
    font-size:16px;
    transition:0.2s;
}
.button:hover{
    background:#1e40af;
}
.msg{
    text-align:center;
    color:#ef4444;
    margin-bottom:12px;
}
.logo-top{
    width:250px;
    display:block;
    margin:0 auto 25px auto;
}

.pulse-icon{
    width:28px;
    height:28px;
    animation:pulse 1.4s infinite ease-in-out;
}

@keyframes pulse{
    0%{ transform:scale(1); filter:drop-shadow(0 0 0px #3b82f6); }
    50%{ transform:scale(1.15); filter:drop-shadow(0 0 6px #3b82f6); }
    100%{ transform:scale(1); filter:drop-shadow(0 0 0px #3b82f6); }
}

.pulse-logo{
    animation:logoPulse 2s infinite ease-in-out;
}

@keyframes logoPulse{
    0%{ transform:scale(1); }
    50%{ transform:scale(1.07); }
    100%{ transform:scale(1); }
}


</style>
</head>
<body>

<div class="card">

    <!-- LOGO DINÂMICA (agora correta dentro do /adm/) -->
    <img src="../logo/logo.png?<?= time() ?>" class="logo-top pulse-logo" alt="Logo">



    <h2>Seja Bem-vindo</h2>
    <h2>Painel ADM de Apps</h2>

    <?php if ($erro): ?>
        <p class="msg">Usuário ou senha incorretos</p>
    <?php endif; ?>

    <form method="POST">
        <div class="input-group">
            <label>Usuário</label>
            <input type="text" name="usuario" required>
        </div>

        <div class="input-group">
            <label>Senha</label>
            <input type="password" name="senha" required>
        </div>

        <button class="button" type="submit">Entrar</button>
    </form>
    
     <!-- RODAPÉ DO CARTÃO -->
<div style="margin-top:35px; width:100%; display:flex; justify-content:center;">
    <a href="https://t.me/xxx" target="_blank"
       style="color:white; text-decoration:none; display:flex; align-items:center; gap:10px;">

        <img src="../logo/telegram.png?<?= time() ?>"
     alt="TG"
     class="pulse-icon">


        <span style="font-size:15px;">Developer: xxx_ @ 2025</span>

    </a>
</div>


</div>
</body>
</html>
