<?php
require_once __DIR__ . '/includes/session_check.php';
checkSession();

$pageTitle = 'Visor de Video';

$videoUrl = $_GET['url'] ?? '';

require_once __DIR__ . '/templates/header.php';
?>

<div class="d-flex justify-content-between align-items-center mb-4">
    <h2><i class="bi bi-play-circle"></i> Visor de Video</h2>
    <a href="gallery.php" class="btn btn-outline-secondary">
        <i class="bi bi-arrow-left"></i> Volver a Galería
    </a>
</div>

<?php if ($videoUrl): ?>
    <div class="card border-0 shadow-sm">
        <div class="card-body">
            <video controls class="w-100" style="max-height: 500px;">
                <source src="<?= htmlspecialchars($videoUrl) ?>" type="video/mp4">
                Tu navegador no soporta el elemento de video.
            </video>
            
            <div class="mt-3">
                <label class="form-label">URL del video</label>
                <input type="text" class="form-control" value="<?= htmlspecialchars($videoUrl) ?>" readonly>
            </div>
        </div>
    </div>
<?php else: ?>
    <div class="alert alert-info">
        <i class="bi bi-info-circle"></i> Proporciona una URL de video usando el parámetro <code>?url=</code>
    </div>
    
    <div class="card border-0 shadow-sm">
        <div class="card-body">
            <p class="text-muted">Ejemplo: video_viewer.php?url=galeria/video.mp4</p>
        </div>
    </div>
<?php endif; ?>

<?php require_once __DIR__ . '/templates/footer.php'; ?>
