<?php
/*
|--------------------------------------------------------------------------
| RadyoHost.BiZ / Profesyonel Radyo Hosting ve Web Tasarım Hizmetleri
|--------------------------------------------------------------------------
*/

/*
|--------------------------------------------------------------------------
| ANA SAYFA
|--------------------------------------------------------------------------
| index.php
| RadyoHost Okey Premium Ana Vitrin Sayfası
| Developed By VoLKaN75
|--------------------------------------------------------------------------
*/

declare(strict_types=1);

require_once __DIR__ . '/config/db.php';

function site_e($value): string
{
    return htmlspecialchars((string)$value, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
}

function site_short($text, int $limit = 130): string
{
    $text = trim(strip_tags((string)$text));

    if (mb_strlen($text, 'UTF-8') <= $limit) {
        return $text;
    }

    return mb_substr($text, 0, $limit, 'UTF-8') . '...';
}

function site_val(array $row, array $keys, string $default = ''): string
{
    foreach ($keys as $key) {
        if (isset($row[$key]) && trim((string)$row[$key]) !== '') {
            return (string)$row[$key];
        }
    }

    return $default;
}

function site_date(array $row): string
{
    $date = site_val($row, ['created_at', 'updated_at', 'date'], '');

    if ($date === '') {
        return date('d.m.Y');
    }

    $time = strtotime($date);

    return $time ? date('d.m.Y', $time) : date('d.m.Y');
}

function site_manager_image(array $manager): string
{
    $image = site_val($manager, ['image', 'avatar', 'photo'], '');

    if ($image === '') {
        return 'assets/images/admin-default.png';
    }

    $image = trim(str_replace('\\', '/', $image));

    if (str_starts_with($image, 'http://') || str_starts_with($image, 'https://')) {
        return $image;
    }

    $imageName = basename($image);

    $paths = [
        [
            'disk' => __DIR__ . '/uploads/managers/' . $imageName,
            'url'  => 'uploads/managers/' . $imageName,
        ],
        [
            'disk' => __DIR__ . '/uploads/manager/' . $imageName,
            'url'  => 'uploads/manager/' . $imageName,
        ],
        [
            'disk' => __DIR__ . '/uploads/' . $imageName,
            'url'  => 'uploads/' . $imageName,
        ],
    ];

    foreach ($paths as $path) {
        if (is_file($path['disk'])) {
            return $path['url'];
        }
    }

    return 'assets/images/admin-default.png';
}

$logoImage    = 'uploads/site/logo.png';
$heroImage    = 'uploads/site/hero-banner.webp';
$goldImage    = 'uploads/site/gold-badge.webp';
$premiumImage = 'uploads/site/premium-badge.webp';
$vipImage     = 'uploads/site/vip-badge.webp';

$defaultAdImage = 'uploads/site/reklam-banner.webp';
$whyUsImage     = 'uploads/site/neden-biz.webp';
$footerCtaImage = 'uploads/site/footer-cta-device.webp';

$userCount = 0;
$announcementCount = 0;
$announcements = [];
$okeyManagers = [];

$promoCards = [
    [
        'label' => '📣 Reklam Alanı',
        'class' => '',
        'title' => 'Türkiye’nin En Keyifli Okey Platformu',
        'description' => 'Gerçek oyuncular • Akıcı oyun • Premium deneyim',
        'image' => $defaultAdImage,
        'button_text' => 'Oyunu İndir',
        'button_url' => 'downloads.php',
    ],
    [
        'label' => '🤝 Sponsor Alanı',
        'class' => 'sponsor',
        'title' => 'Markanızı Burada Öne Çıkarın',
        'description' => '101 Batman Okey ana sayfasında reklam, sponsor ve özel kampanya alanlarınızı premium kart görünümüyle ziyaretçilere güçlü şekilde sunabilirsiniz.',
        'image' => $whyUsImage,
        'button_text' => 'Sponsor Ol',
        'button_url' => 'contact.php',
    ],
];

try {
    if (isset($pdo) && $pdo instanceof PDO) {
        try {
            $userCount = (int)$pdo->query("SELECT COUNT(*) FROM users")->fetchColumn();
        } catch (Throwable $e) {}

        try {
            $announcementCount = (int)$pdo->query("SELECT COUNT(*) FROM announcements")->fetchColumn();
        } catch (Throwable $e) {}

        try {
            $stmt = $pdo->query("
                SELECT *
                FROM announcements
                ORDER BY id DESC
                LIMIT 2
            ");
            $announcements = $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
        } catch (Throwable $e) {}

        try {
            $stmt = $pdo->query("
                SELECT 
                    m.*,
                    t.title_name,
                    t.icon AS title_icon
                FROM okey_managers m
                LEFT JOIN okey_manager_titles t ON t.id = m.title_id
                WHERE m.status IN ('active','aktif','1')
                ORDER BY m.sort_order ASC, m.id DESC
                LIMIT 12
            ");
            $okeyManagers = $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];
        } catch (Throwable $e) {}

        try {
            $stmt = $pdo->query("
                SELECT *
                FROM site_ads
                WHERE status = 'active'
                ORDER BY sort_order ASC, id DESC
                LIMIT 2
            ");
            $dbAds = $stmt->fetchAll(PDO::FETCH_ASSOC) ?: [];

            foreach ($dbAds as $index => $dbAd) {
                if (!isset($promoCards[$index])) {
                    continue;
                }

                $promoCards[$index]['title'] = site_val($dbAd, ['title'], $promoCards[$index]['title']);
                $promoCards[$index]['description'] = site_val($dbAd, ['description', 'summary'], $promoCards[$index]['description']);
                $promoCards[$index]['image'] = site_val($dbAd, ['image', 'image_path', 'banner'], $promoCards[$index]['image']);
                $promoCards[$index]['button_text'] = site_val($dbAd, ['button_text', 'btn_text'], $promoCards[$index]['button_text']);
                $promoCards[$index]['button_url'] = site_val($dbAd, ['button_url', 'btn_url', 'url'], $promoCards[$index]['button_url']);
            }
        } catch (Throwable $e) {}
    }
} catch (Throwable $e) {}

$packageCards = [
    [
        'title' => 'Gold Paketler',
        'image' => $goldImage,
        'url' => 'packages.php?type=gold',
        'class' => 'gold-card',
        'button' => 'Gold Paketleri İncele',
        'features' => [
            'Özel masa seçenekleri',
            'Gold rozet ve profil çerçevesi',
            'Özel sohbet rengi',
            'Daha fazla arkadaş ekleme',
            'Özel emojiler'
        ]
    ],
    [
        'title' => 'Premium Paketler',
        'image' => $premiumImage,
        'url' => 'packages.php?type=premium',
        'class' => 'premium-card',
        'button' => 'Premium Paketleri İncele',
        'features' => [
            'Premium rozet ve profil görünümü',
            'Reklamsız oyun keyfi',
            'Özel turnuva ve etkinlikler',
            'Ekstra puan avantajı',
            '7/24 öncelikli destek'
        ]
    ],
    [
        'title' => 'VIP Paketler',
        'image' => $vipImage,
        'url' => 'packages.php?type=vip',
        'class' => 'vip-card',
        'button' => 'VIP Paketleri İncele',
        'features' => [
            'VIP oyuncu rozeti',
            'Özel yönetici desteği',
            'VIP masa ayrıcalığı',
            'Maksimum üyelik avantajı',
            'Tüm premium özellikler'
        ]
    ],
];
?>
<!doctype html>
<html lang="tr">
<head>
<meta charset="utf-8">
<title>RadyoHost Okey | Premium Okey ve Sohbet Platformu</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="RadyoHost Okey premium okey ve sohbet platformu. Gold, Premium ve VIP paketlerle kaliteli oyun deneyimi.">

<style>
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;font-family:Arial,Helvetica,sans-serif;background:#070911;color:#fff}
a{text-decoration:none;color:inherit}
.site-wrap{min-height:100vh;background:radial-gradient(circle at top left,rgba(245,182,66,.24),transparent 34%),radial-gradient(circle at top right,rgba(185,0,0,.26),transparent 36%),linear-gradient(180deg,#070911,#10131f 48%,#070911)}
.container{width:min(1180px,92%);margin:auto}

.topbar{position:sticky;top:0;z-index:999;backdrop-filter:blur(22px);background:linear-gradient(135deg,rgba(7,9,17,.94),rgba(16,19,31,.88));border-bottom:1px solid rgba(255,255,255,.09);box-shadow:0 18px 60px rgba(0,0,0,.25)}
.nav{min-height:88px;display:flex;align-items:center;justify-content:space-between;gap:22px;position:relative}
.logo{display:flex;align-items:center;gap:14px;min-width:240px;font-weight:900;position:relative;z-index:1001}
.logo-img{max-width:250px;max-height:76px;object-fit:contain;display:block;filter:drop-shadow(0 10px 22px rgba(245,182,66,.18))}
.menu{flex:1;display:flex;justify-content:center;align-items:center;gap:8px;padding:8px;border-radius:24px;background:rgba(255,255,255,.045);border:1px solid rgba(255,255,255,.07)}
.menu a{height:46px;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:0 15px;border-radius:17px;color:#dce3ef;font-size:14px;font-weight:900;transition:.25s;white-space:nowrap}
.menu a:hover{color:#fff;background:rgba(245,182,66,.12);transform:translateY(-2px)}
.menu a.active{color:#111;background:linear-gradient(135deg,#f5b642,#ffcf6a);box-shadow:0 12px 28px rgba(245,182,66,.22)}
.actions{display:flex;gap:10px}
.btn{min-height:48px;padding:0 20px;border-radius:17px;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:1000;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.06);color:#fff;transition:.25s}
.btn:hover{transform:translateY(-2px)}
.btn-gold{color:#111;background:linear-gradient(135deg,#f5b642,#ffcf6a);box-shadow:0 15px 34px rgba(245,182,66,.22)}

.mobile-menu-btn{display:none;width:52px;height:52px;border:none;border-radius:16px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);cursor:pointer;padding:0;align-items:center;justify-content:center;flex-direction:column;gap:5px;position:relative;z-index:1001;transition:.25s}
.mobile-menu-btn span{width:25px;height:3px;background:#fff;border-radius:20px;transition:.3s}
.mobile-menu-btn.active{background:linear-gradient(135deg,#f5b642,#ffcf6a)}
.mobile-menu-btn.active span{background:#111}
.mobile-menu-btn.active span:nth-child(1){transform:translateY(8px) rotate(45deg)}
.mobile-menu-btn.active span:nth-child(2){opacity:0}
.mobile-menu-btn.active span:nth-child(3){transform:translateY(-8px) rotate(-45deg)}

.hero{padding:0;min-height:650px;position:relative;overflow:hidden;background:linear-gradient(90deg,rgba(0,0,0,.97) 0%,rgba(0,0,0,.82) 39%,rgba(0,0,0,.25) 100%),url('<?= site_e($heroImage) ?>') center right/cover no-repeat;border-bottom:1px solid rgba(245,182,66,.18)}
.hero:before{content:"";position:absolute;inset:0;background:radial-gradient(circle at 15% 30%,rgba(245,182,66,.18),transparent 28%),radial-gradient(circle at 85% 20%,rgba(185,0,0,.28),transparent 35%)}
.hero .container{position:relative;z-index:2;min-height:650px;display:flex;align-items:center}
.hero-content{width:min(650px,100%);padding:72px 0}
.hero-kicker{display:inline-flex;padding:10px 16px;border-radius:999px;background:rgba(245,182,66,.13);border:1px solid rgba(245,182,66,.35);color:#f5b642;font-weight:1000;margin-bottom:20px}
.hero-title{margin:0;font-size:clamp(44px,6vw,82px);line-height:1.02;font-weight:1000;letter-spacing:-2px;text-transform:uppercase}
.hero-title .white{color:#f3f3f3}
.hero-title .gold{color:#f5b642;text-shadow:0 0 35px rgba(245,182,66,.35)}
.hero-sub{margin:22px 0;color:#fff;font-size:20px;font-weight:800;display:flex;gap:9px;flex-wrap:wrap;align-items:center}
.hero-sub i{width:7px;height:7px;background:#d90000;border-radius:50%}
.hero-features{display:grid;grid-template-columns:repeat(3,1fr);gap:15px;margin:30px 0}
.hero-feature{padding:16px;border-radius:20px;background:rgba(0,0,0,.48);border:1px solid rgba(255,255,255,.10);backdrop-filter:blur(10px)}
.hero-feature b{display:block;color:#f5b642;font-size:14px;margin-bottom:6px}
.hero-feature span{color:#dce3ef;font-size:13px;line-height:1.5}
.hero-buttons{display:flex;gap:14px;flex-wrap:wrap}
.hero-btn{min-width:220px;min-height:66px;border-radius:15px;display:flex;align-items:center;justify-content:center;gap:14px;font-weight:1000;text-transform:uppercase;border:1px solid rgba(245,182,66,.38);transition:.25s}
.hero-btn:hover{transform:translateY(-4px)}
.hero-btn.red{background:linear-gradient(135deg,#a70000,#e91515);box-shadow:0 0 34px rgba(233,21,21,.36)}
.hero-btn.dark{background:rgba(0,0,0,.62)}
.hero-btn small{display:block;font-size:13px;font-weight:700;text-transform:none;margin-top:3px}
.hero-btn em{font-style:normal;color:#f5b642;font-size:29px}

.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-top:-42px;position:relative;z-index:5}
.stat{padding:25px 22px;border-radius:22px;background:rgba(10,10,10,.92);border:1px solid rgba(255,255,255,.13);box-shadow:0 24px 70px rgba(0,0,0,.35)}
.stat strong{display:block;color:#f5b642;font-size:31px;margin-bottom:6px}
.stat span{color:#cfd6e3;font-size:13px;font-weight:900}

.section{padding:58px 0}
.section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:25px}
.section-head h2{margin:0;font-size:36px}
.section-head p{margin:8px 0 0;color:#9aa3b2;font-weight:800;line-height:1.6}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}

.card{position:relative;overflow:hidden;padding:25px;min-height:210px;border-radius:30px;background:rgba(255,255,255,.055);border:1px solid rgba(255,255,255,.08);transition:.25s}
.card:hover{transform:translateY(-5px);border-color:rgba(245,182,66,.35);box-shadow:0 24px 70px rgba(0,0,0,.25)}
.card:before{content:"";position:absolute;width:170px;height:170px;border-radius:999px;left:-70px;top:-80px;background:rgba(245,182,66,.12)}
.icon{position:relative;width:58px;height:58px;display:grid;place-items:center;border-radius:20px;background:linear-gradient(135deg,rgba(245,182,66,.24),rgba(185,0,0,.20));color:#f5b642;font-size:26px;margin-bottom:18px}
.card h3{position:relative;margin:0 0 10px;font-size:22px}
.card p{position:relative;margin:0;color:#aeb7c7;line-height:1.7;font-weight:700}
.meta{position:relative;display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}
.meta span{padding:7px 10px;border-radius:999px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.10);color:#dce3ef;font-size:12px;font-weight:900}

.feature-card-pro{min-height:320px;background:radial-gradient(circle at top right,rgba(245,182,66,.16),transparent 35%),linear-gradient(145deg,rgba(255,255,255,.08),rgba(255,255,255,.04));border:1px solid rgba(245,182,66,.15)}
.feature-card-pro:hover{border-color:rgba(245,182,66,.45)}
.feature-top{position:relative;display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}
.feature-badge{padding:8px 12px;border-radius:999px;background:rgba(245,182,66,.12);border:1px solid rgba(245,182,66,.25);color:#f5b642;font-size:11px;font-weight:1000;text-transform:uppercase}
.feature-card-pro h3{font-size:25px;margin-bottom:15px}
.feature-card-pro p{font-size:15px;line-height:1.8;min-height:115px}
.feature-card-pro .meta{margin-top:20px}

.package-showcase{position:relative;padding-top:60px}
.package-showcase:before{content:"";position:absolute;inset:20px 0 auto 0;height:240px;background:radial-gradient(circle at center,rgba(245,182,66,.16),transparent 62%);pointer-events:none}
.package-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:22px}
.package-card{position:relative;min-height:500px;padding:28px;border-radius:26px;overflow:hidden;background:radial-gradient(circle at top,rgba(245,182,66,.15),transparent 45%),linear-gradient(145deg,#090909,#15100a 70%,#050505);border:1px solid rgba(245,182,66,.38);box-shadow:0 28px 90px rgba(0,0,0,.45);transition:.25s}
.package-card:hover{transform:translateY(-7px);border-color:rgba(245,182,66,.65);box-shadow:0 35px 110px rgba(0,0,0,.58)}
.package-card.premium-card{background:radial-gradient(circle at top,rgba(255,55,55,.20),transparent 45%),linear-gradient(145deg,#090909,#1b0505 70%,#050505);border-color:rgba(255,55,55,.50)}
.package-card.vip-card{background:radial-gradient(circle at top,rgba(170,74,255,.22),transparent 45%),linear-gradient(145deg,#090909,#16051f 70%,#050505);border-color:rgba(170,74,255,.55)}
.package-image-box{height:185px;display:flex;align-items:center;justify-content:center;margin-bottom:18px}
.package-image-box img{max-width:490px;max-height:485px;object-fit:contain;filter:drop-shadow(0 22px 38px rgba(0,0,0,.70))}
.package-card h3{margin:0 0 22px;text-align:center;font-size:28px;line-height:1.1;color:#f6f6f6;text-transform:uppercase}
.package-features{margin:0;padding:0;list-style:none;display:grid;gap:14px}
.package-features li{color:#f3f3f3;font-size:15px;line-height:1.35;font-weight:900}
.package-features li:before{content:"✓";color:#f5b642;margin-right:10px;font-weight:1000}
.premium-card .package-features li:before{color:#ff6868}
.vip-card .package-features li:before{color:#d889ff}
.package-btn{margin-top:28px;min-height:56px;width:100%;border-radius:13px;display:flex;align-items:center;justify-content:center;color:#1b1203;font-size:15px;font-weight:1000;text-transform:uppercase;background:linear-gradient(180deg,#ffe08a,#d6921d);box-shadow:0 14px 34px rgba(245,182,66,.25)}
.premium-card .package-btn{color:#fff;background:linear-gradient(180deg,#ff6464,#b90000)}
.vip-card .package-btn{color:#fff;background:linear-gradient(180deg,#e59cff,#8128bf)}

.announcement-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:24px}
.announcement-card{position:relative;overflow:hidden;padding:28px;border-radius:24px;background:radial-gradient(circle at top right,rgba(245,182,66,.15),transparent 40%),linear-gradient(145deg,rgba(255,255,255,.08),rgba(255,255,255,.04));border:1px solid rgba(245,182,66,.18);transition:.3s;min-height:330px}
.announcement-card:hover{transform:translateY(-6px);border-color:rgba(245,182,66,.45);box-shadow:0 25px 60px rgba(0,0,0,.35)}
.announcement-card:before{content:"";position:absolute;width:160px;height:160px;border-radius:50%;right:-70px;bottom:-80px;background:rgba(245,182,66,.10)}
.announcement-top{position:relative;display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}
.announcement-date{color:#b5bdcb;font-size:13px;font-weight:800}
.announcement-badge{padding:6px 12px;border-radius:999px;background:rgba(245,182,66,.15);border:1px solid rgba(245,182,66,.30);color:#f5b642;font-size:11px;font-weight:1000}
.announcement-card h3{position:relative;margin:0 0 15px;font-size:23px;color:#fff;line-height:1.35}
.announcement-card p{position:relative;color:#c4ccd9;line-height:1.8;margin:0 0 25px;min-height:90px;font-weight:700}
.announcement-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:46px;padding:0 18px;border-radius:12px;font-weight:1000;color:#111;background:linear-gradient(135deg,#f5b642,#ffd675)}
.announcement-btn:hover{transform:translateY(-2px)}

.manager-card{padding:24px}
.manager-card h3{margin-bottom:10px}
.manager-slider-wrap{position:relative;height:235px;overflow:hidden;margin-top:12px}
.manager-slider-wrap:before,
.manager-slider-wrap:after{content:"";position:absolute;left:0;right:0;height:35px;z-index:3;pointer-events:none}
.manager-slider-wrap:before{top:0;background:linear-gradient(180deg,rgba(18,21,32,.92),transparent)}
.manager-slider-wrap:after{bottom:0;background:linear-gradient(0deg,rgba(18,21,32,.92),transparent)}
.manager-slider{display:grid;gap:12px;animation:managerScroll 18s linear infinite}
.manager-slider-wrap:hover .manager-slider{animation-play-state:paused}
.manager-item{position:relative;display:flex;align-items:center;gap:12px;padding:12px;border-radius:18px;background:rgba(0,0,0,.25);border:1px solid rgba(255,255,255,.08)}
.manager-item img{width:58px;height:58px;border-radius:50%;object-fit:cover;padding:2px;background:linear-gradient(135deg,#f5b642,#b90000);flex:0 0 auto}
.manager-info strong{display:block;color:#fff;font-size:15px;margin-bottom:5px}
.manager-info span{display:inline-flex;color:#f5b642;font-size:12px;font-weight:1000;padding:5px 9px;border-radius:999px;background:rgba(245,182,66,.10);border:1px solid rgba(245,182,66,.22)}
.manager-empty{position:relative;color:#c4ccd9;font-weight:800;line-height:1.7;margin-top:18px}
@keyframes managerScroll{
    0%{transform:translateY(70%)}
    100%{transform:translateY(-100%)}
}

.promo-section{position:relative;padding-top:34px}
.promo-section:before{content:"";position:absolute;left:0;right:0;top:10px;height:280px;background:radial-gradient(circle at 50% 45%,rgba(245,182,66,.16),transparent 64%);pointer-events:none}
.promo-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:24px;align-items:stretch}
.promo-card{position:relative;overflow:hidden;min-height:430px;border-radius:34px;border:1px solid rgba(245,182,66,.28);background:linear-gradient(145deg,rgba(255,255,255,.075),rgba(255,255,255,.035));box-shadow:0 32px 95px rgba(0,0,0,.42);transition:.25s}
.promo-card:hover{transform:translateY(-7px);border-color:rgba(245,182,66,.55);box-shadow:0 42px 120px rgba(0,0,0,.58)}
.promo-card:before{content:"";position:absolute;inset:0;background:radial-gradient(circle at 18% 18%,rgba(245,182,66,.16),transparent 36%),radial-gradient(circle at 88% 15%,rgba(233,21,21,.16),transparent 34%);pointer-events:none;z-index:1}
.promo-card:after{content:"";position:absolute;left:24px;right:24px;bottom:0;height:2px;background:linear-gradient(90deg,transparent,#f5b642,#e91515,#f5b642,transparent);opacity:.72;box-shadow:0 0 22px rgba(245,182,66,.55);z-index:2}
.promo-image{position:relative;height:210px;overflow:hidden;border-radius:30px 30px 0 0;background:#080808}
.promo-image img{width:100%;height:100%;display:block;object-fit:cover;transition:.35s;filter:saturate(1.08) contrast(1.06)}
.promo-card:hover .promo-image img{transform:scale(1.06)}
.promo-image:after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(0,0,0,.06),rgba(0,0,0,.72));}
.promo-label{position:absolute;left:20px;top:18px;z-index:3;display:inline-flex;align-items:center;gap:8px;min-height:34px;padding:0 13px;border-radius:999px;background:rgba(0,0,0,.58);border:1px solid rgba(245,182,66,.32);color:#f5b642;font-size:12px;font-weight:1000;text-transform:uppercase;backdrop-filter:blur(8px)}
.promo-body{position:relative;z-index:3;padding:28px}
.promo-body h3{margin:0;color:#fff;font-size:28px;line-height:1.12;text-transform:uppercase;letter-spacing:-.7px}
.promo-body p{margin:14px 0 22px;color:#cbd3df;font-size:15px;font-weight:800;line-height:1.75;min-height:78px}
.promo-btn{min-height:54px;padding:0 22px;border-radius:15px;display:inline-flex;align-items:center;justify-content:center;font-weight:1000;text-transform:uppercase;color:#111;background:linear-gradient(135deg,#f5b642,#ffcf6a);box-shadow:0 16px 38px rgba(245,182,66,.24);transition:.25s}
.promo-btn:hover{transform:translateY(-4px)}
.promo-btn.red{color:#fff;background:linear-gradient(135deg,#a70000,#e91515);box-shadow:0 16px 38px rgba(233,21,21,.32)}
.promo-card.sponsor{border-color:rgba(255,255,255,.14)}
.promo-card.sponsor .promo-label{color:#fff;border-color:rgba(255,255,255,.18);background:rgba(245,182,66,.18)}
.promo-card.sponsor .promo-btn{color:#fff;background:linear-gradient(135deg,#5f1628,#e91515)}

.footer-cta-section{padding:48px 0 18px}
.footer-cta{position:relative;overflow:hidden;min-height:230px;border-radius:34px;border:1px solid rgba(245,182,66,.34);background:radial-gradient(circle at 22% 50%,rgba(233,21,21,.28),transparent 32%),radial-gradient(circle at 70% 30%,rgba(245,182,66,.18),transparent 36%),linear-gradient(135deg,#070707,#150303 62%,#050505);box-shadow:0 30px 100px rgba(0,0,0,.52)}
.footer-cta:before{content:"";position:absolute;inset:18px;border-radius:26px;border:1px solid rgba(245,182,66,.25);pointer-events:none}
.footer-cta:after{content:"";position:absolute;left:0;right:0;bottom:34px;height:2px;background:linear-gradient(90deg,transparent,#f5b642,rgba(233,21,21,.85),transparent);opacity:.65}
.footer-cta-inner{position:relative;z-index:2;min-height:230px;display:grid;grid-template-columns:1fr 1fr .95fr;align-items:center;gap:22px;padding:34px}
.footer-cta-btn{min-height:92px;border-radius:22px;border:1px solid rgba(245,182,66,.32);display:flex;align-items:center;justify-content:center;gap:18px;transition:.25s;box-shadow:0 20px 50px rgba(0,0,0,.34)}
.footer-cta-btn:hover{transform:translateY(-5px)}
.footer-cta-btn.red{background:linear-gradient(135deg,#8e0000,#e91515);box-shadow:0 18px 44px rgba(233,21,21,.30)}
.footer-cta-btn.dark{background:linear-gradient(135deg,rgba(255,255,255,.08),rgba(255,255,255,.03))}
.footer-cta-icon{width:54px;height:54px;border-radius:18px;display:grid;place-items:center;font-size:32px;color:#f5b642;background:rgba(0,0,0,.28)}
.footer-cta-text strong{display:block;font-size:27px;line-height:1;text-transform:uppercase;letter-spacing:.4px}
.footer-cta-text span{display:block;margin-top:6px;color:#f4f4f4;font-size:15px;font-weight:800}
.footer-cta-device{align-self:end;justify-self:end;width:200%;min-height:190px;background:url('<?= site_e($footerCtaImage) ?>') 170% center/contain no-repeat;filter:drop-shadow(0 26px 45px rgba(0,0,0,.70))}
.footer-cta-device:empty{display:block}

.footer{margin-top:40px;padding:22px 30px;border-top:1px solid rgba(255,255,255,.08);display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:18px;color:#9aa3b2;font-size:13px;font-weight:900}
.footer a{color:#f5b642}
.footer-center{color:#f5b642}
.footer-right{display:flex;justify-content:flex-end;align-items:center;color:#ff5db1}
.footer-right img{width:52px;height:52px;object-fit:contain;margin-left:-2px;filter:drop-shadow(0 0 10px rgba(37,211,102,.8))}

@media(max-width:1100px){
    .nav{padding:14px 0}
    .actions{gap:8px}
    .btn{padding:0 15px;font-size:13px}
    .menu a{padding:0 12px;font-size:13px}
}

@media(max-width:980px){
    .stats,.grid-3,.hero-features,.package-grid,.announcement-grid,.promo-grid{grid-template-columns:1fr}
    .footer-cta-inner{grid-template-columns:1fr;min-height:auto}
    .footer-cta-device{min-height:220px;justify-self:center;background-position:center}
}

@media(max-width:768px){
    .topbar{overflow:visible}
    .nav{min-height:82px;padding:12px 0;gap:12px;flex-wrap:nowrap}
    .logo{min-width:auto;flex:1}
    .logo-img{max-width:210px;max-height:68px}
    .mobile-menu-btn{display:flex}
    .menu{
        position:absolute;
        top:100%;
        left:0;
        right:0;
        width:100%;
        flex-direction:column;
        justify-content:flex-start;
        align-items:stretch;
        gap:8px;
        padding:16px;
        border-radius:0 0 24px 24px;
        background:linear-gradient(180deg,rgba(7,9,17,.99),rgba(16,19,31,.98));
        border:1px solid rgba(245,182,66,.20);
        border-top:none;
        box-shadow:0 28px 70px rgba(0,0,0,.55);
        display:none;
        z-index:1000;
    }
    .menu.active{display:flex}
    .menu a{width:100%;height:54px;justify-content:flex-start;padding:0 18px;font-size:15px;border-radius:16px}
    .actions{display:none}
    .section-head{display:block}
    .footer{grid-template-columns:1fr;text-align:center}
    .footer-right{justify-content:center}
    .hero{background-position:center}
    .hero-content{padding:50px 0}
    .hero-title{font-size:42px}
    .package-card{min-height:auto}
    .promo-card{min-height:auto}
    .promo-image{height:195px}
    .promo-body{padding:24px}
    .promo-body h3{font-size:24px}
    .promo-body p{min-height:auto}
    .footer-cta-inner{padding:24px}
    .footer-cta-btn{min-height:82px}
    .footer-cta-text strong{font-size:22px}
}

@media(max-width:480px){
    .container{width:min(100% - 24px,1180px)}
    .logo-img{max-width:185px;max-height:62px}
    .mobile-menu-btn{width:48px;height:48px;border-radius:14px}
    .hero-btn{width:100%;min-width:100%}
    .hero-sub{font-size:16px}
    .section-head h2{font-size:30px}
    .package-image-box img{max-width:100%}
    .promo-btn{width:100%}
}
</style>
</head>

<body>
<div class="site-wrap">

<header class="topbar">
    <div class="container nav">
        <a href="index.php" class="logo">
            <img src="<?= site_e($logoImage) ?>" alt="101 Batman Okey" class="logo-img">
        </a>

        <button class="mobile-menu-btn" id="mobileMenuBtn" type="button" aria-label="Menüyü Aç / Kapat" aria-expanded="false">
            <span></span>
            <span></span>
            <span></span>
        </button>

        <nav class="menu" id="mainMenu">
            <a href="index.php" class="active">🏠 Ana Sayfa</a>
            <a href="announcements.php">📢 Duyurular</a>
            <a href="downloads.php">⬇️ İndir</a>
            <a href="packages.php">👑 Paketler</a>
            <a href="contact.php">☎️ İletişim</a>
        </nav>

        <div class="actions">
            <a href="login.php" class="btn">Giriş Yap</a>
            <a href="register.php" class="btn btn-gold">Kayıt Ol</a>
        </div>
    </div>
</header>

<main>

<section class="hero">
    <div class="container">
        <div class="hero-content">
            <div class="hero-kicker">🀄 101 Batman Okey ve Oyun Platformu</div>

            <h1 class="hero-title">
                <span class="white">Türkiye’nin</span><br>
                <span class="gold">En Keyifli Okey</span><br>
                <span class="white">Platformu</span>
            </h1>

            <div class="hero-sub">
                <span>Gerçek oyuncular</span><i></i>
                <span>Akıcı oyun</span><i></i>
                <span>Premium deneyim</span>
            </div>

            <div class="hero-features">
                <div class="hero-feature">
                    <b>🛡️ Güvenli Oyun</b>
                    <span>Adil ve güvenli oyun ortamı.</span>
                </div>

                <div class="hero-feature">
                    <b>👥 Gerçek Oyuncular</b>
                    <span>Binlerce aktif oyuncu ile kaliteli masa deneyimi.</span>
                </div>

                <div class="hero-feature">
                    <b>⚡ Akıcı Sistem</b>
                    <span>Kesintisiz, hızlı ve premium bağlantı.</span>
                </div>
            </div>

            <div class="hero-buttons">
                <a href="downloads.php" class="hero-btn red">
                    <em>⬇</em>
                    <span>Oyunu İndir <small>Windows için .exe</small></span>
                </a>

                <a href="register.php" class="hero-btn dark">
                    <em>👥</em>
                    <span>Üye Ol <small>Hemen aramıza katıl!</small></span>
                </a>
            </div>
        </div>
    </div>
</section>

<section>
    <div class="container">
        <div class="stats">
            <div class="stat">
                <strong><?= $userCount > 0 ? site_e($userCount) : '5.728' ?></strong>
                <span>Aktif Oyuncu</span>
            </div>
            <div class="stat">
                <strong>1.243</strong>
                <span>Aktif Masa</span>
            </div>
            <div class="stat">
                <strong>28.451</strong>
                <span>Bugün Oyuna Katılan</span>
            </div>
            <div class="stat">
                <strong>7/24</strong>
                <span>Kesintisiz Hizmet</span>
            </div>
        </div>
    </div>
</section>

<section class="section">
    <div class="container">
        <div class="section-head">
            <div>
                <h2>🎲 Oyun Özellikleri</h2>
                <p>Profesyonel, kaliteli ve premium bir okey deneyimi.</p>
            </div>
        </div>

        <div class="grid-3">
            <div class="card feature-card-pro">
                <div class="feature-top">
                    <div class="icon">🎮</div>
                    <div class="feature-badge">Premium Oyun</div>
                </div>
                <h3>Gerçek Okey Deneyimi</h3>
                <p>101 Batman Okey, gerçek oyuncularla kesintisiz oyun deneyimi, hızlı masa sistemi ve profesyonel oyun altyapısıyla klasik okey keyfini modern teknolojiyle buluşturur.</p>
                <div class="meta">
                    <span>Akıcı Oyun</span>
                    <span>Gerçek Oyuncu</span>
                    <span>Premium Masa</span>
                </div>
            </div>

            <div class="card feature-card-pro">
                <div class="feature-top">
                    <div class="icon">💬</div>
                    <div class="feature-badge">Sosyal Platform</div>
                </div>
                <h3>Sohbet ve Topluluk</h3>
                <p>Oyun oynarken sohbet edin, yeni dostluklar kurun ve aktif oyuncu topluluğunun bir parçası olun. Oyun kadar sosyal deneyimi de yaşayın.</p>
                <div class="meta">
                    <span>Canlı Sohbet</span>
                    <span>Arkadaşlık</span>
                    <span>Topluluk</span>
                </div>
            </div>

            <div class="card feature-card-pro">
                <div class="feature-top">
                    <div class="icon">👑</div>
                    <div class="feature-badge">Üyelik Sistemi</div>
                </div>
                <h3>Gold • Premium • VIP</h3>
                <p>Özel üyelik paketleri sayesinde ekstra avantajlar, özel rozetler, premium içerikler ve oyunculara özel ayrıcalıklarla oyunun keyfini üst seviyede yaşayın.</p>
                <div class="meta">
                    <span>Gold</span>
                    <span>Premium</span>
                    <span>VIP</span>
                </div>
            </div>
        </div>
    </div>
</section>

<section class="section package-showcase">
    <div class="container">
        <div class="section-head">
            <div>
                <h2>🎖️ Üyelik Paketlerimiz</h2>
                <p>Gold, Premium ve VIP üyeliklerle oyun deneyimini bir üst seviyeye taşı.</p>
            </div>
            <a href="packages.php" class="btn btn-gold">Tüm Paketleri Gör</a>
        </div>

        <div class="package-grid">
            <?php foreach ($packageCards as $card): ?>
                <article class="package-card <?= site_e($card['class']) ?>">
                    <div class="package-image-box">
                        <img src="<?= site_e($card['image']) ?>" alt="<?= site_e($card['title']) ?>">
                    </div>

                    <h3><?= site_e($card['title']) ?></h3>

                    <ul class="package-features">
                        <?php foreach ($card['features'] as $feature): ?>
                            <li><?= site_e($feature) ?></li>
                        <?php endforeach; ?>
                    </ul>

                    <a href="<?= site_e($card['url']) ?>" class="package-btn">
                        <?= site_e($card['button']) ?>
                    </a>
                </article>
            <?php endforeach; ?>
        </div>
    </div>
</section>

<section class="section">
    <div class="container">
        <div class="section-head">
            <div>
                <h2>📢 Son Duyurular</h2>
                <p>Platformumuzdan en son haberler, kampanyalar ve güncellemeler.</p>
            </div>
            <a href="announcements.php" class="btn btn-gold">Tüm Duyurular</a>
        </div>

        <div class="announcement-grid">
            <?php if (!empty($announcements)): ?>
                <?php foreach ($announcements as $item): ?>
                    <article class="announcement-card">
                        <div class="announcement-top">
                            <span class="announcement-date"><?= site_e(site_date($item)) ?></span>
                            <span class="announcement-badge">DUYURU</span>
                        </div>

                        <h3><?= site_e(site_val($item, ['title', 'name', 'subject'], 'Duyuru')) ?></h3>

                        <p><?= site_e(site_short(site_val($item, ['summary', 'description', 'content', 'message'], 'Duyuru içeriği yakında yayınlanacaktır.'), 120)) ?></p>

                        <a href="announcements.php" class="announcement-btn">
                            Devamını Oku →
                        </a>
                    </article>
                <?php endforeach; ?>
            <?php else: ?>
                <article class="announcement-card">
                    <div class="announcement-top">
                        <span class="announcement-date"><?= date('d.m.Y') ?></span>
                        <span class="announcement-badge">TURNUVA</span>
                    </div>
                    <h3>Yaz Turnuvası Başladı</h3>
                    <p>Büyük ödüllü yaz turnuvası kayıtları başladı. Hemen katılarak yerinizi ayırtın.</p>
                    <a href="announcements.php" class="announcement-btn">Devamını Oku →</a>
                </article>

                <article class="announcement-card">
                    <div class="announcement-top">
                        <span class="announcement-date"><?= date('d.m.Y') ?></span>
                        <span class="announcement-badge">KAMPANYA</span>
                    </div>
                    <h3>Gold Üyelere Özel Hediye</h3>
                    <p>Gold üyelik paketlerinde yeni avantajlar ve özel kampanyalar aktif edildi.</p>
                    <a href="announcements.php" class="announcement-btn">Devamını Oku →</a>
                </article>
            <?php endif; ?>

            <article class="announcement-card manager-card">
                <div class="announcement-top">
                    <span class="announcement-date">👑 OKEY YÖNETİMİ</span>
                    <span class="announcement-badge">KADRO</span>
                </div>

                <h3>Okey Yönetim Kadrosu</h3>

                <?php if (!empty($okeyManagers)): ?>
                    <div class="manager-slider-wrap">
                        <div class="manager-slider">
                            <?php foreach ($okeyManagers as $manager): ?>
                                <?php
                                $managerName  = site_val($manager, ['display_name', 'username'], 'Okey Yöneticisi');
                                $managerTitle = trim(site_val($manager, ['title_icon'], '👑') . ' ' . site_val($manager, ['title_name'], 'Okey Yöneticisi'));
                                ?>
                                <div class="manager-item">
                                    <img src="<?= site_e(site_manager_image($manager)) ?>" alt="<?= site_e($managerName) ?>">
                                    <div class="manager-info">
                                        <strong><?= site_e($managerName) ?></strong>
                                        <span><?= site_e($managerTitle) ?></span>
                                    </div>
                                </div>
                            <?php endforeach; ?>

                            <?php foreach ($okeyManagers as $manager): ?>
                                <?php
                                $managerName  = site_val($manager, ['display_name', 'username'], 'Okey Yöneticisi');
                                $managerTitle = trim(site_val($manager, ['title_icon'], '👑') . ' ' . site_val($manager, ['title_name'], 'Okey Yöneticisi'));
                                ?>
                                <div class="manager-item">
                                    <img src="<?= site_e(site_manager_image($manager)) ?>" alt="<?= site_e($managerName) ?>">
                                    <div class="manager-info">
                                        <strong><?= site_e($managerName) ?></strong>
                                        <span><?= site_e($managerTitle) ?></span>
                                    </div>
                                </div>
                            <?php endforeach; ?>
                        </div>
                    </div>
                <?php else: ?>
                    <p class="manager-empty">
                        Okey yönetim kadrosu yakında burada resimli olarak yayınlanacaktır.
                    </p>
                <?php endif; ?>
            </article>
        </div>
    </div>
</section>

<section class="section promo-section">
    <div class="container">
        <div class="section-head">
            <div>
                <h2>📣 Reklam ve Sponsorlarımız</h2>
                <p>Platformumuza destek veren sponsorlarımız, özel tanıtımlarımız ve iş ortaklarımız.</p>
            </div>
        </div>

        <div class="promo-grid">
            <?php foreach ($promoCards as $promo): ?>
                <article class="promo-card <?= site_e($promo['class']) ?>">
                    <div class="promo-image">
                        <img src="<?= site_e($promo['image']) ?>" alt="<?= site_e($promo['title']) ?>">
                        <span class="promo-label"><?= site_e($promo['label']) ?></span>
                    </div>

                    <div class="promo-body">
                        <h3><?= site_e($promo['title']) ?></h3>
                        <p><?= site_e($promo['description']) ?></p>

                        <a href="<?= site_e($promo['button_url']) ?>" class="promo-btn <?= $promo['class'] === '' ? 'red' : '' ?>">
                            <?= site_e($promo['button_text']) ?>
                        </a>
                    </div>
                </article>
            <?php endforeach; ?>
        </div>
    </div>
</section>

<section class="footer-cta-section">
    <div class="container">
        <div class="footer-cta">
            <div class="footer-cta-inner">
                <a href="downloads.php" class="footer-cta-btn red">
                    <span class="footer-cta-icon">⬇</span>
                    <span class="footer-cta-text">
                        <strong>Oyunu İndir</strong>
                        <span>Windows için .exe</span>
                    </span>
                </a>

                <a href="register.php" class="footer-cta-btn dark">
                    <span class="footer-cta-icon">👥</span>
                    <span class="footer-cta-text">
                        <strong>Üye Ol</strong>
                        <span>Hemen aramıza katıl!</span>
                    </span>
                </a>

                <div class="footer-cta-device"></div>
            </div>
        </div>
    </div>
</section>

<footer class="footer">
    <div>Powered By <?= date('Y') ?> <a href="https://www.radyohost.biz" target="_blank">🌐RadyoHost.BiZ</a><span> Web Teknolojileri</span></div>
    <div class="footer-center">Premium Okey ve Sohbet Platformu</div>
    <div class="footer-right">
        Developed By VoLKaN75
        <a href="https://wa.me/905415917536" target="_blank">
            <img src="uploads/footer/whatsapp.png" alt="WhatsApp">
        </a>
    </div>
</footer>

</main>
</div>

<script>
document.addEventListener('DOMContentLoaded', function () {
    const mobileMenuBtn = document.getElementById('mobileMenuBtn');
    const mainMenu = document.getElementById('mainMenu');

    if (mobileMenuBtn && mainMenu) {
        mobileMenuBtn.addEventListener('click', function () {
            const isOpen = mainMenu.classList.toggle('active');
            mobileMenuBtn.classList.toggle('active', isOpen);
            mobileMenuBtn.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
        });

        mainMenu.querySelectorAll('a').forEach(function (link) {
            link.addEventListener('click', function () {
                mainMenu.classList.remove('active');
                mobileMenuBtn.classList.remove('active');
                mobileMenuBtn.setAttribute('aria-expanded', 'false');
            });
        });

        window.addEventListener('resize', function () {
            if (window.innerWidth > 768) {
                mainMenu.classList.remove('active');
                mobileMenuBtn.classList.remove('active');
                mobileMenuBtn.setAttribute('aria-expanded', 'false');
            }
        });
    }
});
</script>

</body>
</html>