<?php
/**
 * Welcome / Landing Page untuk Iklan TikTok (Cloaking Strategy)
 * 
 * Tampilan depan: Maintenance / Coming Soon page sederhana
 * Strategi: Terlihat seperti blog biasa saat direview TikTok
 *           Ketika user klik → langsung redirect ke main site
 */

// Include koneksi database (fallback kalau tidak ada)
$siteLogo = 'koi_ico_notext.png';
$brandName = 'GamingTips';

if (file_exists('../function/connect.php')) {
    include '../function/connect.php';
    if (isset($koneksi) && $koneksi) {
        $q = @mysqli_query($koneksi, "SELECT title, logo FROM tb_web LIMIT 1");
        if ($q && $row = mysqli_fetch_assoc($q)) {
            $brandName = explode('|', $row['title'])[0] ?? 'GamingTips';
            $siteLogo  = $row['logo'] ?: 'koi_ico_notext.png';
        }
    }
}

$brandName = trim($brandName);
?>
<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= htmlspecialchars($brandName); ?> — Tips & Strategi Gaming</title>
    <meta name="description" content="Blog tips dan strategi gaming terbaru. Panduan lengkap dunia game online.">
    <meta name="robots" content="index, follow">
    <meta property="og:title" content="<?= htmlspecialchars($brandName); ?> — Blog Gaming">
    <meta property="og:description" content="Tips dan strategi gaming paling lengkap.">
    <meta property="og:type" content="website">
    <link rel="icon" href="../assets/img/<?= htmlspecialchars($siteLogo); ?>">
    
    <style>
        * { margin:0; padding:0; box-sizing:border-box; }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: #0d0d14;
            color: #fff;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }
        
        /* Background gradient effects */
        .bg {
            position: fixed;
            inset: 0;
            z-index: 0;
            pointer-events: none;
        }
        .bg::before {
            content: '';
            position: absolute;
            top: -30%;
            left: -20%;
            width: 140%;
            height: 140%;
            background: 
                radial-gradient(ellipse at 30% 20%, rgba(108,92,231,0.12) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 60%, rgba(0,180,216,0.08) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 50%, rgba(108,92,231,0.05) 0%, transparent 70%);
            animation: float 20s ease-in-out infinite;
        }
        @keyframes float {
            0%,100% { transform: translate(0,0) rotate(0deg); }
            33% { transform: translate(1%,-1%) rotate(0.5deg); }
            66% { transform: translate(-1%,1%) rotate(-0.5deg); }
        }
        
        /* Container */
        .container {
            position: relative;
            z-index: 1;
            text-align: center;
            padding: 20px;
            max-width: 420px;
            width: 100%;
        }
        
        /* Logo */
        .logo-wrap {
            margin-bottom: 32px;
        }
        .logo-wrap img {
            width: 64px;
            height: 64px;
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(108,92,231,0.3);
        }
        .logo-placeholder {
            width: 64px;
            height: 64px;
            border-radius: 16px;
            background: linear-gradient(135deg, #6c5ce7, #00b4d8);
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 30px;
            box-shadow: 0 8px 32px rgba(108,92,231,0.3);
        }
        
        /* Badge */
        .badge {
            display: inline-block;
            padding: 5px 14px;
            background: rgba(255,255,255,0.06);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 50px;
            font-size: 12px;
            color: #a0a0c0;
            letter-spacing: 1px;
            text-transform: uppercase;
            margin-bottom: 20px;
        }
        
        /* Heading */
        h1 {
            font-size: 26px;
            font-weight: 700;
            line-height: 1.35;
            margin-bottom: 12px;
            letter-spacing: -0.3px;
        }
        .highlight {
            background: linear-gradient(135deg, #a78bfa, #60a5fa);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* Subtitle */
        .sub {
            font-size: 14px;
            color: #9494b8;
            line-height: 1.6;
            margin-bottom: 36px;
        }
        
        /* Button */
        .btn-enter {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 16px 48px;
            background: linear-gradient(135deg, #6c5ce7, #8b5cf6);
            color: #fff;
            text-decoration: none;
            border-radius: 50px;
            font-weight: 600;
            font-size: 16px;
            letter-spacing: 0.3px;
            transition: all 0.3s;
            box-shadow: 0 8px 32px rgba(108,92,231,0.35);
            border: none;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }
        .btn-enter:hover {
            transform: translateY(-2px);
            box-shadow: 0 14px 40px rgba(108,92,231,0.5);
        }
        .btn-enter:active {
            transform: scale(0.97);
        }
        
        /* Button shimmer */
        .btn-enter::after {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            animation: shimmer 2.5s infinite;
        }
        @keyframes shimmer {
            0% { left: -100%; }
            100% { left: 100%; }
        }
        
        /* Loading dots */
        .dots {
            display: flex;
            gap: 4px;
            justify-content: center;
            margin-top: 32px;
        }
        .dots span {
            width: 5px;
            height: 5px;
            background: #6c5ce7;
            border-radius: 50%;
            animation: bounce 1.4s ease-in-out infinite;
        }
        .dots span:nth-child(2) { animation-delay: 0.2s; }
        .dots span:nth-child(3) { animation-delay: 0.4s; }
        @keyframes bounce {
            0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
            40% { transform: scale(1); opacity: 1; }
        }
        
        /* Footer */
        .footer-note {
            margin-top: 40px;
            font-size: 11px;
            color: #555570;
        }
        
        /* Responsive */
        @media (max-width: 380px) {
            h1 { font-size: 22px; }
            .btn-enter { padding: 14px 36px; font-size: 15px; }
        }
    </style>
</head>
<body>
    <div class="bg"></div>
    
    <div class="container">
        
        <!-- Logo -->
        <div class="logo-wrap">
            <img src="../assets/img/<?= htmlspecialchars($siteLogo); ?>" alt="logo" 
                 onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';">
            <div class="logo-placeholder" style="display:none;">🎮</div>
        </div>
        
        <!-- Badge -->
        <div class="badge">Blog Gaming</div>
        
        <!-- Heading -->
        <h1>
            Upgrade Skill Gaming<br>
            <span class="highlight">Mulai Hari Ini</span>
        </h1>
        
        <!-- Sub -->
        <p class="sub">
            Dapatkan tips, strategi & trik gaming terbaru.<br>
            Gratis — tanpa biaya apapun.
        </p>
        
        <!-- CTA Button -->
        <a href="/main/index.php?page=home" class="btn-enter" id="enterBtn">
            🚀 Masuk Sekarang
        </a>
        
        <!-- Dots animation -->
        <div class="dots">
            <span></span><span></span><span></span>
        </div>
        
        <!-- Footer -->
        <p class="footer-note">
            © <?= date('Y'); ?> <?= htmlspecialchars($brandName); ?> — Tips & Strategi Gaming
        </p>
        
    </div>
    
    <script>
        // Track button click
        document.getElementById('enterBtn').addEventListener('click', function(e) {
            // Optional: quick fade transition
            e.preventDefault();
            document.body.style.opacity = '0';
            document.body.style.transition = 'opacity 0.3s';
            setTimeout(() => {
                window.location.href = this.getAttribute('href');
            }, 300);
        });
    </script>
</body>
</html>