<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <title>VMIXTER</title>
    <meta name="description" content="Web-based video switcher and live streaming studio.">
    <meta name="keywords" content="video switcher, live streaming, broadcast, web video, vmix alternative, obs alternative, scene management, live production, Built with Flatlogic Generator">
    <meta property="og:title" content="VMIXTER">
    <meta property="og:description" content="Web-based video switcher and live streaming studio.">
    <meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>

    <header class="main-header d-flex justify-content-between align-items-center">
        <h1 class="h4 mb-0">VMIXTER</h1>
        <!-- Theme switcher placeholder -->
        <div>
            <i class="bi bi-moon-stars-fill"></i>
        </div>
    </header>

    <main class="container-fluid mt-4">
        <div class="row">
            <!-- Preview Panel -->
            <div class="col-md-6">
                <div id="preview-panel" class="video-panel">
                    <span class="panel-label">PREVIEW</span>
                    <div class="scene-content">Select a Scene</div>
                </div>
            </div>
            <!-- Program Panel -->
            <div class="col-md-6">
                <div id="program-panel" class="video-panel" style="background-color: #440000;">
                    <span class="panel-label">PROGRAM (ON AIR)</span>
                    <div class="scene-content">Initial Scene</div>
                </div>
            </div>
        </div>

        <div class="row mt-3">
            <!-- Scene List -->
            <div class="col-md-8">
                <div class="control-panel h-100">
                    <div class="d-flex justify-content-between align-items-center mb-2">
                        <h5 class="mb-0">Scenes</h5>
                        <button id="add-scene-btn" class="btn btn-sm btn-success">
                            <i class="bi bi-plus-lg"></i> Add
                        </button>
                    </div>
                    <div class="list-group scene-list">
                        <!-- Scenes will be dynamically inserted here by main.js -->
                    </div>
                </div>
            </div>
            <!-- Transition Controls -->
            <div class="col-md-4">
                <div class="control-panel h-100 d-flex flex-column justify-content-center align-items-center">
                    <h5>Transitions</h5>
                    <div class="d-flex justify-content-around w-100 mt-3 transition-controls">
                        <button id="cut-button" class="btn btn-cut">CUT</button>
                        <button id="fade-button" class="btn btn-fade" disabled>FADE</button>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- Add Scene Modal -->
    <div id="add-scene-modal" class="modal-overlay" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Add New Scene</h5>
                    <button type="button" class="btn-close btn-close-white" id="modal-close-btn"></button>
                </div>
                <div class="modal-body">
                    <form id="add-scene-form">
                        <div class="mb-3">
                            <label for="scene-name-input" class="form-label">Scene Name</label>
                            <input type="text" class="form-control" id="scene-name-input" required>
                        </div>
                        <div class="mb-3">
                            <label for="scene-type-select" class="form-label">Source Type</label>
                            <select class="form-select" id="scene-type-select">
                                <option value="color">Solid Color</option>
                                <option value="image">Image</option>
                                <option value="video">Video</option>
                                <option value="camera">Camera</option>
                            </select>
                        </div>

                        <div id="source-color-group" class="mb-3 source-settings">
                            <label for="scene-color-input" class="form-label">Background Color</label>
                            <input type="color" class="form-control form-control-color" id="scene-color-input" value="#1e90ff">
                        </div>

                        <div id="source-image-group" class="mb-3 source-settings" style="display: none;">
                            <label for="scene-image-file-input" class="form-label">Image File</label>
                            <input type="file" class="form-control" id="scene-image-file-input" accept="image/*">
                        </div>

                        <div id="source-video-group" class="mb-3 source-settings" style="display: none;">
                            <label for="scene-video-file-input" class="form-label">Video File</label>
                            <input type="file" class="form-control" id="scene-video-file-input" accept="video/*">
                        </div>

                        <div id="source-camera-group" class="mb-3 source-settings" style="display: none;">
                            <div id="camera-permission-prompt" class="text-center">
                                <p>Please grant camera permission to proceed.</p>
                                <button type="button" id="grant-camera-permission-btn" class="btn btn-primary">Grant Permission</button>
                            </div>
                            <div id="camera-device-selection" style="display: none;">
                                <label for="scene-camera-device-input" class="form-label">Camera Device</label>
                                <select class="form-select" id="scene-camera-device-input"></select>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" id="modal-cancel-btn">Cancel</button>
                    <button type="button" class="btn btn-primary" id="modal-save-btn">Save Scene</button>
                </div>
            </div>
        </div>
    </div>


    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>
