<?php
// templates/landing4.php
$site_settings = get_site_settings($pdo);
$landing_title = $site_settings['landing_title'] ?? 'UTAMU';
$favicon = $site_settings['site_favicon'] ?? 'assets/images/favicon.png';

if (!$featured && !empty($videos)) {
    $featured = $videos[0];
}
?>
<!DOCTYPE html>
<html lang="en">


<!-- Mirrored from michiriziutamu.tanzaniahub.click/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 18 Mar 2026 16:23:19 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= htmlspecialchars($landing_title) ?> | Premium</title>
    <link
        href="https://fonts.googleapis.com/css2?family=Syncopate:wght@400;700&amp;family=Space+Grotesk:wght@300;500;700&amp;display=swap"
        rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"><!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-WFSQPTZZLJ"></script>

    <style>
        :root {
            --neon: #00f2ff;
            --neon-pink: #ff00c8;
            --bg-deep: #050508;
            --card-glass: rgba(255, 255, 255, 0.05);
            --border-glass: rgba(255, 255, 255, 0.1);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Space Grotesk', sans-serif;
            background: var(--bg-deep);
            color: #fff;
            overflow-x: hidden;
            background-image:
                radial-gradient(circle at 10% 20%, rgba(0, 242, 255, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(255, 0, 200, 0.05) 0%, transparent 40%);
        }

        /* --- Liquid Vertical Sidebar --- */
        .sidebar {
            position: fixed;
            left: 20px;
            top: 50%;
            transform: translateY(-50%);
            width: 60px;
            background: var(--card-glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-glass);
            border-radius: 100px;
            display: flex;
            flex-direction: column;
            gap: 30px;
            padding: 30px 0;
            align-items: center;
            z-index: 1000;
        }

        .sidebar i {
            font-size: 1.2rem;
            color: #555;
            cursor: pointer;
            transition: 0.3s;
        }

        .sidebar i:hover,
        .sidebar i.active {
            color: var(--neon);
            text-shadow: 0 0 10px var(--neon);
        }

        /* --- Main Content Area --- */
        main {
            margin-left: 100px;
            padding: 40px;
        }

        .top-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 50px;
        }

        .logo {
            font-family: 'Syncopate', sans-serif;
            font-weight: 700;
            font-size: 1.5rem;
            letter-spacing: -2px;
        }

        .logo span {
            color: var(--neon);
        }

        /* --- Spotlight Section --- */
        .spotlight {
            position: relative;
            height: 450px;
            background: linear-gradient(45deg, #111, #1a1a1a);
            border-radius: 40px;
            overflow: hidden;
            margin-bottom: 60px;
            display: flex;
            align-items: center;
            border: 1px solid var(--border-glass);
        }

        .spotlight-content {
            padding: 60px;
            z-index: 2;
            width: 50%;
        }

        .spotlight-visual {
            position: absolute;
            right: 0;
            top: 0;
            width: 60%;
            height: 100%;
            background: url('assets/landing3.jpg') center/cover;
            mask-image: linear-gradient(to left, black 70%, transparent 100%);
            -webkit-mask-image: linear-gradient(to left, black 70%, transparent 100%);
        }

        .btn-neon {
            background: var(--neon);
            color: #000;
            padding: 15px 35px;
            border-radius: 12px;
            font-weight: 700;
            text-transform: uppercase;
            border: none;
            cursor: pointer;
            box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
            transition: 0.3s;
        }

        /* --- 3D Floating Grid --- */
        .grid-header {
            margin-bottom: 30px;
            font-family: 'Syncopate';
            font-size: 0.8rem;
            color: var(--neon);
        }

        .neon-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 30px;
        }

        .neon-card {
            background: #111116;
            border-radius: 30px;
            padding: 10px;
            border: 1px solid #222;
            transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            position: relative;
        }

        .neon-card:hover {
            transform: translateY(-10px) rotateX(5deg);
            border-color: var(--neon);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
        }

        .card-inner {
            border-radius: 25px;
            overflow: hidden;
            aspect-ratio: 16/10;
            position: relative;
        }

        .card-inner img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .card-meta {
            padding: 20px 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .lock-shield {
            width: 40px;
            height: 40px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 50%;
            display: grid;
            place-items: center;
            color: var(--neon-pink);
            border: 1px solid rgba(255, 0, 200, 0.3);
        }

        /* --- Payment Interface (Cyber Glass) --- */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.9);
            backdrop-filter: blur(10px);
            z-index: 2000;
            display: none;
            place-items: center;
        }

        .cyber-panel {
            background: rgba(20, 20, 25, 0.8);
            border: 1px solid var(--border-glass);
            padding: 40px;
            border-radius: 40px;
            width: 90%;
            max-width: 450px;
            position: relative;
            box-shadow: 0 0 100px rgba(0, 0, 0, 1);
        }

        .cyber-panel::before {
            content: '';
            position: absolute;
            top: -2px;
            left: 10%;
            width: 80%;
            height: 2px;
            background: linear-gradient(to right, transparent, var(--neon), transparent);
        }

        .cyber-input {
            width: 100%;
            background: #000;
            border: 1px solid #333;
            padding: 20px;
            border-radius: 15px;
            color: var(--neon);
            font-family: 'Syncopate';
            font-size: 1.2rem;
            text-align: center;
            margin: 20px 0;
        }

        @media (max-width: 768px) {
            .sidebar {
                bottom: 20px;
                top: auto;
                left: 50%;
                transform: translateX(-50%);
                width: 80%;
                height: 60px;
                flex-direction: row;
                justify-content: space-around;
                padding: 0;
            }

            main {
                margin-left: 0;
                padding: 20px;
                padding-bottom: 100px;
            }

            .spotlight {
                flex-direction: column;
                height: auto;
            }

            .spotlight-content {
                width: 100%;
                padding: 30px;
            }

            .spotlight-visual {
                position: relative;
                width: 100%;
                height: 200px;
                mask-image: none;
            }
        }
    </style>
</head>

<body>

    <aside class="sidebar">
        <i class="fas fa-home active"></i>
        <i class="fas fa-bolt"></i>
        <i class="fas fa-heart"></i>
        <i class="fas fa-plus-circle"></i>
        <i class="fas fa-cog"></i>
    </aside>

    <main>
        <nav class="top-nav">
            <div class="logo">UTAMU<span>X</span></div>
            <div
                style="background: var(--card-glass); padding: 10px 20px; border-radius: 15px; border: 1px solid var(--border-glass);">
                <i class="fas fa-search" style="margin-right: 10px; color: #666;"></i>
                <span style="font-size: 0.8rem; color: #888;">Search Archive...</span>
            </div>
        </nav>

                <?php if ($featured): ?>
        <section class="spotlight">
            <div class="spotlight-content">
                <span style="color: var(--neon-pink); font-weight: 700; font-size: 0.8rem; letter-spacing: 2px;">EXCLUSIVE PREMIERE</span>
                <h1 style="font-size: 3rem; font-family: 'Syncopate'; margin: 10px 0 20px;"><?= htmlspecialchars($featured['title']) ?></h1>
                <button class="btn-neon" onclick="openCyberModal('<?= (int)$featured['price'] ?>', '<?= htmlspecialchars($featured['id']) ?>'); return false;">UNLOCK ACCESS - <?= number_format($featured['price']) ?> TSH</button>
            </div>
            <div class="spotlight-visual" style="background: url('<?= htmlspecialchars($featured['thumbnail_url'] ?: SITE_URL.'/assets/landing3.jpg') ?>') center/cover;"></div>
        </section>
        <?php else: ?>
        <section class="spotlight">
            <div class="spotlight-content">
                <span style="color: var(--neon-pink); font-weight: 700; font-size: 0.8rem; letter-spacing: 2px;">EXCLUSIVE PREMIERE</span>
                <h1 style="font-size: 3rem; font-family: 'Syncopate'; margin: 10px 0 20px;">BONGO LEAKS</h1>
                <button class="btn-neon">UNLOCK ACCESS NOW</button>
            </div>
            <div class="spotlight-visual"></div>
        </section>
        <?php endif; ?>

        <h2 class="grid-header">// Video Mpya</h2>

        <div class="neon-grid">
            <?php foreach ($videos as $vid): ?>
            <div class="neon-card" onclick="openCyberModal('<?= (int)$vid['price'] ?>', '<?= htmlspecialchars($vid['id']) ?>')">
                <div class="card-inner">
                    <img src="<?= htmlspecialchars($vid['thumbnail_url'] ?: SITE_URL.'/assets/placeholder.jpg') ?>" alt="">
                    <div style="position: absolute; top: 15px; left: 15px; background: rgba(0,0,0,0.8); padding: 5px 12px; border-radius: 8px; font-size: 0.7rem;">
                        4K HDR
                    </div>
                </div>
                <div class="card-meta">
                    <div>
                        <h3 style="font-size: 1rem; margin-bottom: 5px;"><?= htmlspecialchars($vid['title']) ?></h3>
                    </div>
                    <div class="lock-shield">
                        <i class="fas fa-fingerprint"></i>
                    </div>
                </div>
                <div style="position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); background: var(--neon-pink); font-size: 0.6rem; padding: 4px 15px; border-radius: 4px; font-weight: 800;">
                    <?= number_format($vid['price']) ?> TSH
                </div>
            </div>
            <?php endforeach; ?>
        </div>
    </main>
<div class="modal-overlay" id="paymentModal">
        <div class="cyber-panel">
            <div style="text-align: center;">
                <div
                    style="width: 60px; height: 60px; background: rgba(255,0,200,0.1); border-radius: 50%; display: grid; place-items: center; margin: 0 auto 20px;">
                    <i class="fas fa-shield-halved" style="color: var(--neon-pink); font-size: 1.5rem;"></i>
                </div>
                <h2 style="font-family: 'Syncopate'; font-size: 1rem; letter-spacing: 2px;">GATEWAY AUTHORIZATION</h2>
                <p style="color: #666; font-size: 0.8rem; margin-top: 10px;">Transaction secured by encrypted protocol.
                </p>
            </div>

            <input type="tel" id="phoneNumber" class="cyber-input" placeholder="0XXXXXXXXX">

            <input type="hidden" id="videoID">
            <button class="btn-neon" style="width: 100%;" onclick="processPayment()">
                INITIALIZE PAYMENT
            </button>

            <p onclick="closeCyberModal()"
                style="text-align: center; margin-top: 20px; font-size: 0.7rem; color: #444; cursor: pointer; letter-spacing: 2px;">
                [ CANCEL_SIGNAL ]</p>
        </div>
    </div>

    

</body>


<!-- Mirrored from michiriziutamu.tanzaniahub.click/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 18 Mar 2026 16:23:24 GMT -->
</html>


<script>
const SITE = '<?= SITE_URL ?>';
let paymentCheckInterval = null;
let customModalId = ''; 
window.currentCheckoutId = null;
window.currentCheckoutTitle = 'Customer';
window.currentCheckoutPrice = 0;
window.originalBtnHtml = '';

function openPaymentModal(event, price, id) {
    if (event && event.preventDefault) event.preventDefault();
    customModalId = 'paymentModal';
    document.getElementById(customModalId).style.display = 'flex';
    setupModalData(price, id, '');
}
function openPaymentSheet(price, id) {
    customModalId = 'paymentModal';
    document.getElementById(customModalId).classList.add('open');
    setupModalData(price, id, '');
}
function openCyberModal(price, id) {
    customModalId = 'paymentModal';
    document.getElementById(customModalId).style.display = 'grid';
    setupModalData(price, id, '');
}
function openSheet(price, id) {
    customModalId = 'sheet';
    document.getElementById(customModalId).classList.add('show');
    document.getElementById('overlay').style.display = 'block';
    setupModalData(price, id, '');
}
function handleVideoClick(el, isPaid, url) { 
    if(isPaid) { window.location.href = url; return; }
    customModalId = 'paymentModal';
    document.getElementById(customModalId).classList.add('active');
    setupModalData(el.getAttribute('data-price'), el.getAttribute('data-id'), el.getAttribute('data-title'));
}

function closeCyberModal() { closeModalUniversal(); }
function closeSheet() { closeModalUniversal(); }
function closePaymentModal() { closeModalUniversal(); }
function closeModal() { closeModalUniversal(); }

function closeModalUniversal() {
    if(!customModalId) customModalId = 'paymentModal';
    const m = document.getElementById(customModalId);
    if(m) {
        m.style.display = 'none';
        m.classList.remove('open', 'active', 'show');
    }
    const sheet = document.getElementById('sheet');
    if(sheet) Object.assign(sheet.style, {bottom: '-100%'}) || sheet.classList.remove('show');
    
    const overlay = document.getElementById('overlay');
    if(overlay) overlay.style.display = 'none';
    if(paymentCheckInterval) clearInterval(paymentCheckInterval);
    resetPayButtonUniversal();
}

function setupModalData(price, id, title) {
    const vidInput = document.getElementById('videoID');
    if(vidInput) vidInput.value = id;
    
    window.currentCheckoutId = id;
    window.currentCheckoutTitle = title || 'Customer';
    window.currentCheckoutPrice = price;

    const priceEl = document.getElementById('modalPrice') || document.querySelector('.price-amount');
    if(priceEl) {
        if (priceEl.innerText.includes('TSH')) {
            priceEl.innerText = 'TSH ' + parseInt(price).toLocaleString();
        } else {
            priceEl.innerText = parseInt(price).toLocaleString();
        }
    }
}

async function processPayment() { 
    const phoneInput = document.querySelector('input[type="tel"]') || document.getElementById('phoneInput') || document.getElementById('phoneNumber');
    let phone = phoneInput ? phoneInput.value.replace(/[\s-]/g, '') : '';
    
    if (phone.length === 9 && !phone.startsWith('0')) phone = '0' + phone; 

    if (!phone || phone.length < 10) {
        alert("Weka namba sahihi ya simu, ianzie na 0");
        return;
    }

    const amount = window.currentCheckoutPrice;
    const videoID = window.currentCheckoutId || (document.getElementById('videoID') ? document.getElementById('videoID').value : null);
    
    const payBtn = document.querySelector('.btn-full') || document.querySelector('.btn-neon') || document.querySelector('.pay-btn-final') || document.getElementById('payBtn') || document.querySelector('.pay-btn');
    
    if(!window.originalBtnHtml) window.originalBtnHtml = payBtn.innerHTML;
    payBtn.innerHTML = 'INACHAKATA...';
    payBtn.disabled = true;

    try {
        const response = await fetch(SITE.replace(/\/+$/, '') + '/api/pay.php', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
            body: JSON.stringify({
                phone: phone,
                amount: parseInt(amount),
                videoID: videoID,
                name: window.currentCheckoutTitle,
                token: <?= json_encode($store_api_key) ?> || ''
            })
        });

        const data = await response.json();
        if (data.success) {
            payBtn.innerHTML = 'ANGALIA SIMU YAKO...';
            pollStatus(data.transaction_id);
        } else {
            alert(data.message || 'Hitilafu imetokea.');
            resetPayButtonUniversal();
        }
    } catch (e) {
        alert('Kuna tatizo la mtandao.');
        resetPayButtonUniversal();
    }
}

function submitPayment() { processPayment(); } 

function pollStatus(transactionId) {
    if (paymentCheckInterval) clearInterval(paymentCheckInterval);
    const payBtn = document.querySelector('.btn-full') || document.querySelector('.btn-neon') || document.querySelector('.pay-btn-final') || document.getElementById('payBtn') || document.querySelector('.pay-btn');
    
    paymentCheckInterval = setInterval(async () => {
        try {
            const token = <?= json_encode($store_api_key) ?> || '';
            const query = new URLSearchParams({ tran_id: transactionId, token: token, _: new Date().getTime() }).toString();
            const res = await fetch(SITE.replace(/\/+$/, '') + '/api/check_status.php?' + query);
            const data = await res.json();
            
            const s = (data.status || '').toLowerCase();
            const rs = (data.raw_status || '').toLowerCase();

            if (s === 'success' || s === 'completed' || rs === 'success' || rs === 'completed') {
                clearInterval(paymentCheckInterval);
                payBtn.innerHTML = 'IMEKUBALIWA! INAFUNGUA...';
                setTimeout(() => {
                    window.location.href = <?= json_encode($store_redirect_url) ?>; 
                }, 1500);
            } else if (s === 'failed' || s === 'cancelled') {
                clearInterval(paymentCheckInterval);
                alert('Malipo yameshindwa (' + (data.raw_status || s) + ')');
                resetPayButtonUniversal();
            }
        } catch(e) {}
    }, 5000);
}

function resetPayButtonUniversal() {
    const payBtn = document.querySelector('.btn-full') || document.querySelector('.btn-neon') || document.querySelector('.pay-btn-final') || document.getElementById('payBtn') || document.querySelector('.pay-btn');
    if(payBtn && window.originalBtnHtml) {
        payBtn.innerHTML = window.originalBtnHtml;
        payBtn.disabled = false;
    }
}

document.querySelectorAll('.modal-close, .fa-times').forEach(el => {
    el.addEventListener('click', closeModalUniversal);
});
</script>
</body>
</html>