<?php
// Ensure this path jumps up from public/ to the root for config
require_once __DIR__ . '/../config/config.php';
require_once __DIR__ . '/includes/ad-display.php';

$settings_file = __DIR__ . '/../config/site-settings.json';
$site_name = 'tipspac';
if (file_exists($settings_file)) {
    $loaded = json_decode(file_get_contents($settings_file), true);
    if (!empty($loaded['site_name'])) $site_name = $loaded['site_name'];
}
?>

<?php require_once __DIR__ . '/includes/header.php'; ?>

<div class="fixed inset-0 z-0 pointer-events-none opacity-20 bg-cover bg-center bg-no-repeat" style="background-image: url('https://images.unsplash.com/photo-1508098682722-e99c43a406b2?q=80&w=2000&auto=format&fit=crop');"></div>
<div class="fixed inset-0 z-0 bg-gradient-to-t from-[#020617] via-[#020617]/90 to-[#020617]/80 pointer-events-none"></div>
<canvas id="neuralCanvas" class="fixed inset-0 w-full h-full pointer-events-none z-0 opacity-35"></canvas>

<main class="relative z-10 flex-1 w-full max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 pt-8 pb-20 space-y-12">

    <div class="text-center space-y-4">
        <div class="inline-flex items-center space-x-2 bg-blue-500/10 border border-blue-500/20 px-3 py-1 rounded-full text-[9px] font-bold tracking-widest uppercase text-blue-400">
            <span class="w-1.5 h-1.5 rounded-full bg-blue-400 animate-pulse"></span>
            <span>Algorithmic Performance Transparency</span>
        </div>
        <h1 class="text-4xl md:text-6xl font-black text-white tracking-tight">Our AI <span class="text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-emerald-400">Performance</span></h1>
        <p class="text-xs md:text-sm text-slate-400 max-w-xl mx-auto">Complete, unedited historical tracking of our neural networks and predictive models. Data proves our edge.</p>
    </div>

    <!-- <div class="w-full flex justify-center">
        <?php display_ad_slot($pdo, 'header'); ?>
    </div> -->

    <div class="bg-slate-900/60 backdrop-blur-xl border border-slate-800 rounded-[2.5rem] p-6 md:p-8 space-y-8">
        <div class="flex flex-col sm:flex-row items-center justify-between gap-4 border-b border-slate-800/60 pb-6">
            <div>
                <h3 class="text-base font-black text-white tracking-tight uppercase">Proprietary Model Efficacy (30 Days)</h3>
                <p class="text-[10px] text-slate-400">Autonomous compute index tracking yield curves across verified betting markets.</p>
            </div>
            
            <div class="flex items-center space-x-4 text-[9px] font-bold tracking-widest uppercase">
                <div class="flex items-center space-x-1.5 text-emerald-400">
                    <span class="w-2.5 h-2.5 rounded-full bg-emerald-400"></span>
                    <span>Bankers Yield</span>
                </div>
                <div class="flex items-center space-x-1.5 text-cyan-400">
                    <span class="w-2.5 h-2.5 rounded-full bg-cyan-400"></span>
                    <span>Overall Accuracy</span>
                </div>
            </div>
        </div>

        <div class="relative h-64 w-full overflow-hidden select-none">
            <div class="absolute inset-0 flex flex-col justify-between pointer-events-none opacity-20">
                <div class="border-b border-slate-700 w-full h-0"></div>
                <div class="border-b border-slate-700 w-full h-0"></div>
                <div class="border-b border-slate-700 w-full h-0"></div>
                <div class="border-b border-slate-700 w-full h-0"></div>
            </div>
            
            <svg viewBox="0 0 800 250" class="w-full h-full overflow-visible">
                <g fill="#64748b" font-family="monospace" font-size="8" class="translate-y-4">
                    <text x="50" y="230">05/26</text>
                    <text x="130" y="230">06/26</text>
                    <text x="210" y="230">07/26</text>
                    <text x="290" y="230">08/26</text>
                    <text x="370" y="230">09/26</text>
                    <text x="450" y="230">10/26</text>
                    <text x="530" y="230">11/26</text>
                    <text x="610" y="230">12/26</text>
                    <text x="690" y="230">13/26</text>
                    <text x="770" y="230">14/26</text>
                </g>
                
                <linearGradient id="gradBanker" x1="0" y1="0" x2="0" y2="1">
                    <stop offset="0%" stop-color="#10b981" stop-opacity="0.25"/>
                    <stop offset="100%" stop-color="#10b981" stop-opacity="0"/>
                </linearGradient>
                <linearGradient id="gradOverall" x1="0" y1="0" x2="0" y2="1">
                    <stop offset="0%" stop-color="#06b6d4" stop-opacity="0.25"/>
                    <stop offset="100%" stop-color="#06b6d4" stop-opacity="0"/>
                </linearGradient>

                <path d="M50 150 C 130 50, 210 180, 290 90 C 370 0, 450 160, 530 60 C 610 140, 690 30, 770 120 L 770 250 L 50 250 Z" fill="url(#gradBanker)" />
                <path d="M50 180 C 130 90, 210 210, 290 120 C 370 30, 450 190, 530 90 C 610 170, 690 60, 770 150 L 770 250 L 50 250 Z" fill="url(#gradOverall)" />

                <path d="M50 150 C 130 50, 210 180, 290 90 C 370 0, 450 160, 530 60 C 610 140, 690 30, 770 120" stroke="#10b981" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M50 180 C 130 90, 210 210, 290 120 C 370 30, 450 190, 530 90 C 610 170, 690 60, 770 150" stroke="#06b6d4" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="4 4"/>
            </svg>
        </div>
        
        <div class="grid grid-cols-3 gap-4 pt-4 text-center">
            <div class="bg-slate-950/40 border border-slate-800 p-4 rounded-xl">
                <span class="block text-[8px] font-black tracking-widest text-slate-500 uppercase">Bankers Accuracy (10 Days)</span>
                <span class="text-xl font-black text-emerald-400 tracking-tight">88.2%</span>
            </div>
            <div class="bg-slate-950/40 border border-slate-800 p-4 rounded-xl">
                <span class="block text-[8px] font-black tracking-widest text-slate-500 uppercase">Overall Yield (12 Days)</span>
                <span class="text-xl font-black text-cyan-400 tracking-tight">+14.4% ROI</span>
            </div>
            <div class="bg-slate-950/40 border border-slate-800 p-4 rounded-xl">
                <span class="block text-[8px] font-black tracking-widest text-slate-500 uppercase">Computed AI Datasets</span>
                <span class="text-xl font-black text-white tracking-tight">256,185</span>
            </div>
        </div>
    </div>

    <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
        <div class="bg-slate-900/40 backdrop-blur border border-slate-800 rounded-2xl p-6 space-y-4">
            <h4 class="text-xs font-bold text-white tracking-wider border-b border-slate-800 pb-2">Top Leagues Tracked</h4>
            <ul class="space-y-3 text-[11px] text-slate-400 font-medium">
                <li class="flex justify-between items-center"><span>World Cup 2026 Previews</span> <span class="bg-slate-800 text-slate-200 px-2 py-0.5 rounded text-[8px]">Synced</span></li>
                <li class="flex justify-between items-center"><span>Friendly Fixtures</span> <span class="bg-slate-800 text-slate-200 px-2 py-0.5 rounded text-[8px]">Synced</span></li>
                <li class="flex justify-between items-center"><span>Carioca A2</span> <span class="bg-slate-800 text-slate-200 px-2 py-0.5 rounded text-[8px]">Synced</span></li>
                <li class="flex justify-between items-center"><span>Northern NSW NPL</span> <span class="bg-slate-800 text-slate-200 px-2 py-0.5 rounded text-[8px]">Synced</span></li>
            </ul>
        </div>
        <div class="bg-slate-900/40 backdrop-blur border border-slate-800 rounded-2xl p-6 space-y-4">
            <h4 class="text-xs font-bold text-white tracking-wider border-b border-slate-800 pb-2">Processed Fixtures Overview</h4>
            <ul class="space-y-3 text-[11px] text-slate-400 font-medium">
                <li class="flex justify-between items-center"><span>Sofiends vs France</span> <span class="text-emerald-400 font-bold">Success</span></li>
                <li class="flex justify-between items-center"><span>Conchas vs Memo</span> <span class="text-emerald-400 font-bold">Success</span></li>
                <li class="flex justify-between items-center"><span>South Ares vs South Korea</span> <span class="text-emerald-400 font-bold">Success</span></li>
                <li class="flex justify-between items-center"><span>Ungary vs Spain</span> <span class="text-emerald-400 font-bold">Success</span></li>
            </ul>
        </div>
    </div>

    <div class="w-full flex justify-center py-4">
        <?php display_ad_slot($pdo, 'in_content'); ?>
    </div>

</main>

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

<script>
    const canvas = document.getElementById("neuralCanvas");
    if(canvas) {
        const ctx = canvas.getContext("2d");
        let width, height;
        let particles = [];
        let mouse = { x: null, y: null, radius: 150 };
        window.addEventListener('mousemove', function(e) {
            mouse.x = e.x;
            mouse.y = e.y;
        });

        function initCanvas() {
            width = canvas.width = window.innerWidth;
            height = canvas.height = window.innerHeight;
            particles = [];
            let particleCount = (width * height) / 15000;
            for (let i = 0; i < particleCount; i++) {
                particles.push({
                    x: Math.random() * width,
                    y: Math.random() * height,
                    vx: (Math.random() - 0.5) * 1.5,
                    vy: (Math.random() - 0.5) * 1.5,
                    radius: Math.random() * 1.5 + 0.5
                });
            }
        }

        function animateCanvas() {
            ctx.clearRect(0, 0, width, height);
            for (let i = 0; i < particles.length; i++) {
                let p = particles[i];
                p.x += p.vx;
                p.y += p.vy;
                if (p.x < 0 || p.x > width) p.vx *= -1;
                if (p.y < 0 || p.y > height) p.vy *= -1;
                ctx.beginPath();
                ctx.arc(p.x, p.y, p.radius, 0, Math.PI * 2);
                ctx.fillStyle = "rgba(56, 189, 248, 0.5)";
                ctx.fill();
                for (let j = i + 1; j < particles.length; j++) {
                    let p2 = particles[j];
                    let dist = Math.sqrt(Math.pow(p.x - p2.x, 2) + Math.pow(p.y - p2.y, 2));
                    if (dist < 100) {
                        ctx.beginPath();
                        ctx.moveTo(p.x, p.y);
                        ctx.lineTo(p2.x, p2.y);
                        ctx.strokeStyle = `rgba(16, 185, 129, ${1 - dist/100})`;
                        ctx.lineWidth = 0.5;
                        ctx.stroke();
                    }
                }
                if (mouse.x && mouse.y) {
                    let mouseDist = Math.sqrt(Math.pow(p.x - mouse.x, 2) + Math.pow(p.y - mouse.y, 2));
                    if (mouseDist < mouse.radius) {
                        ctx.beginPath();
                        ctx.moveTo(p.x, p.y);
                        ctx.lineTo(mouse.x, mouse.y);
                        ctx.strokeStyle = `rgba(56, 189, 248, ${0.8 - mouseDist/mouse.radius})`;
                        ctx.lineWidth = 1;
                        ctx.stroke();
                    }
                }
            }
            requestAnimationFrame(animateCanvas);
        }
        window.addEventListener("resize", initCanvas);
        initCanvas();
        animateCanvas();
    }
</script>