<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <title>JTech TV - Intro</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Importamos una fuente moderna -->
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary-color: #00d4ff; /* Azul neón */
            --glass-bg: rgba(255, 255, 255, 0.1);
            --glass-border: rgba(255, 255, 255, 0.2);
        }

        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            background: #000;
            overflow: hidden;
            font-family: 'Poppins', sans-serif;
        }

        /* Contenedor del Título Superior */
        .brand-overlay {
            position: absolute;
            top: 40px;
            width: 100%;
            text-align: center;
            z-index: 10;
            pointer-events: none;
        }

        .brand-overlay h1 {
            color: white;
            font-size: 2.5rem;
            font-weight: 700;
            letter-spacing: 5px;
            margin: 0;
            text-transform: uppercase;
            text-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
            background: linear-gradient(to right, #fff, var(--primary-color), #fff);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-size: 200% auto;
            animation: shine 3s linear infinite;
        }

        @keyframes shine {
            to { background-position: 200% center; }
        }

        video {
            position: absolute;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            object-fit: cover;
        }

        /* Estilo de Botones Glassmorphism */
        .controls-container {
            position: absolute;
            bottom: 40px;
            width: 100%;
            display: flex;
            justify-content: space-between;
            padding: 0 50px;
            box-sizing: border-box;
            z-index: 100;
        }

        .btn {
            background: var(--glass-bg);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            color: white;
            border: 1px solid var(--glass-border);
            padding: 12px 25px;
            border-radius: 50px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 300;
            text-transform: uppercase;
            letter-spacing: 1px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .btn:hover {
            background: white;
            color: black;
            transform: translateY(-3px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.3);
        }

        /* Estilo específico para el botón central de Play si falla el autoplay */
        .play-overlay-btn {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 101;
            padding: 20px 40px;
            font-size: 1.2rem;
            background: var(--primary-color);
            color: black;
            border: none;
            border-radius: 8px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 0 30px rgba(0, 212, 255, 0.5);
        }

        @media (max-width: 600px) {
            .brand-overlay h1 { font-size: 1.5rem; }
            .controls-container { padding: 0 20px; bottom: 20px; }
            .btn { padding: 10px 15px; font-size: 12px; }
        }
    </style>
</head>
<body>

    <div class="brand-overlay">
        <h1>JTech TV</h1>
    </div>

    <video id="introVideo" autoplay playsinline>
        <source src="splash_rgvip/intro.mp4?v=<?php echo filemtime('splash_rgvip/intro.mp4'); ?>" type="video/mp4">
        Tu navegador no soporta el video HTML5.
    </video>

    <div class="controls-container">
        <button class="btn" onclick="toggleMute()" id="muteBtn">
            <span>🔇</span> <span id="muteText">Activar Sonido</span>
        </button>
        
        <button class="btn" onclick="skipIntro()">
            Saltar Intro ➔
        </button>
    </div>

    <script>
        const video = document.getElementById('introVideo');
        const muteBtn = document.getElementById('muteBtn');
        const muteText = document.getElementById('muteText');

        video.muted = true;

        video.onended = () => window.location.href = "index.php";

        function skipIntro() {
            video.pause();
            window.location.href = "index.php";
        }

        function toggleMute() {
            video.muted = !video.muted;
            updateMuteUI();
        }

        function updateMuteUI() {
            muteText.textContent = video.muted ? 'Activar Sonido' : 'Silenciar';
            muteBtn.querySelector('span').textContent = video.muted ? '🔇' : '🔊';
        }

        // Intento de reproducción automática
        document.addEventListener('DOMContentLoaded', function () {
            video.play().catch(e => {
                const playBtn = document.createElement('button');
                playBtn.className = 'play-overlay-btn';
                playBtn.textContent = 'REPRODUCIR JTECH TV';
                playBtn.onclick = function () {
                    video.play();
                    video.muted = false;
                    updateMuteUI();
                    this.remove();
                };
                document.body.appendChild(playBtn);
            });
        });

        // Un solo click en cualquier lado activa el audio la primera vez
        document.addEventListener('click', function () {
            if (video.muted) {
                video.muted = false;
                updateMuteUI();
            }
        }, { once: true });
    </script>
</body>
</html>