<!DOCTYPE html>

<html lang="es">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Mando de Acceso - Afrouxeira Camper Park</title>

    <style>

        body {

            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

            background-color: #f4f7f6;

            display: flex;

            flex-direction: column;

            align-items: center;

            justify-content: center;

            height: 100vh;

            margin: 0;

        }

        .container {

            text-align: center;

            background: white;

            padding: 30px;

            border-radius: 15px;

            box-shadow: 0 4px 15px rgba(0,0,0,0.1);

            max-width: 90%;

            width: 350px;

        }

        h1 { color: #2c3e50; font-size: 24px; margin-bottom: 5px; }

        p { color: #7f8c8d; font-size: 14px; margin-bottom: 25px; }

        .btn-mando {

            background: linear-gradient(135deg, #2ecc71, #27ae60);

            color: white;

            border: none;

            border-radius: 50%;

            width: 150px;

            height: 150px;

            font-size: 18px;

            font-weight: bold;

            cursor: pointer;

            box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);

            transition: transform 0.1s, box-shadow 0.1s;

            outline: none;

            -webkit-tap-highlight-color: transparent;

        }

        .btn-mando:active {

            transform: scale(0.96);

            box-shadow: 0 3px 10px rgba(46, 204, 113, 0.4);

        }

        .info-reserva {

            margin-top: 25px;

            background: #f8f9fa;

            padding: 10px;

            border-radius: 8px;

            font-size: 13px;

            color: #34495e;

            text-align: left;

        }

    </style>

</head>

<body>


<div class="container">

    <h1>Afrouxeira Camper Park</h1>

    <p>Pulse el botón para abrir la barrera de acceso</p>

    

    <button class="btn-mando" onclick="abrirBarrera()">ABRIR<br>BARRERA</button>

    

    <div class="info-reserva">

        <strong>Tu Reserva:</strong><br>

        Plaza: <span id="lblPlaza">-</span><br>

        Validez: <span id="lblFechas">Comprobando...</span>

    </div>

</div>


<script>

    // 1. LEER LOS DATOS DE LA URL (?plaza=12&entrada=22-05-2026&salida=25-05-2026)

    const urlParams = new URLSearchParams(window.location.search);

    const plaza = urlParams.get('plaza') || 'No asignada';

    const entrada = urlParams.get('entrada') || '';

    const salida = urlParams.get('salida') || '';


    // Mostrar los datos visualmente en la pantalla del móvil

    document.getElementById('lblPlaza').innerText = plaza;

    if(entrada && salida) {

        document.getElementById('lblFechas').innerText = `Del ${entrada} al ${salida}`;

    } else {

        document.getElementById('lblFechas').innerText = 'Acceso activo';

    }


    // 2. ACCIÓN AL PULSAR EL BOTÓN VERDE

    function abrirBarrera() {

        // Aquí va la llamada al sistema que abre físicamente tu barrera

        alert('Enviando señal de apertura para la Plaza ' + plaza + '...');

        

        // Ejemplo de llamada real:

        // fetch('https://api.tu-sistema-barrera.com/open?id=' + plaza)

        // .then(res => console.log('Abierto'));

    }

</script>


</body>

</html>