<?php
// 2026/api/logo_webview_rev.php
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$jsonFile = "db/logo_rev_" . $id . ".json";
$imagePath = "";

if ($id > 0 && file_exists($jsonFile)) {
    $jsonData = json_decode(file_get_contents($jsonFile), true);
    if (!empty($jsonData[0]['ImageName'])) {
        $img = $jsonData[0]['ImageName'];
        $imagePath = (filter_var($img, FILTER_VALIDATE_URL)) ? $img : "../" . $img;
    }
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <style>
        /* RESET ABSOLUTO */
        * { 
            margin: 0; 
            padding: 0; 
            box-sizing: border-box; 
            -webkit-touch-callout: none; /* Bloqueia menu ao segurar o toque */
            -webkit-user-select: none;    /* Bloqueia seleção de texto/imagem */
            user-select: none;
        }

        html, body {
            width: 100%;
            height: 100%;
            /* FORÇA TRANSPARÊNCIA TOTAL */
            background-color: transparent !important;
            background: rgba(0,0,0,0) !important;
            
            /* TRAVA A TELA (IMPEDE O MOVIMENTO/SCROLL) */
            overflow: hidden;
            position: fixed;
            top: 0;
            left: 0;
            
            display: flex;
            justify-content: center;
            align-items: center;
        }

        img {
            /* ENCAIXE PERFEITO NOS 40SDP */
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            
            /* REMOVE FUNDOS E BORDAS */
            background-color: transparent !important;
            border: none;
            outline: none;
            
            /* IMPEDE QUE A LOGO SE MOVA AO TOCAR */
            pointer-events: none; 
        }
    </style>
</head>
<body scroll="no">

    <?php if (!empty($imagePath)): ?>
        <img src="<?php echo $imagePath; ?>?v=<?php echo time(); ?>">
    <?php endif; ?>

</body>
</html>
