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

/*
|--------------------------------------------------------------------------
| İLETİŞİM SAYFASI
|--------------------------------------------------------------------------
| contact.php
| RadyoHost Okey Premium İletişim ve Destek Merkezi
| Developed By VoLKaN75
|--------------------------------------------------------------------------
*/

declare(strict_types=1);

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

$success = '';
$error = '';

$fullname = '';
$email = '';
$phone = '';
$subject = '';
$message = '';

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

$logoImage = 'uploads/site/logo.png';
$heroBgImage = 'uploads/site/contact-hero.webp';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $fullname = trim((string)($_POST['fullname'] ?? ''));
    $email    = trim((string)($_POST['email'] ?? ''));
    $phone    = trim((string)($_POST['phone'] ?? ''));
    $subject  = trim((string)($_POST['subject'] ?? ''));
    $message  = trim((string)($_POST['message'] ?? ''));

    if ($fullname === '' || $email === '' || $subject === '' || $message === '') {
        $error = 'Lütfen zorunlu alanları doldurun.';
    } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $error = 'Geçerli bir e-posta adresi yazın.';
    } else {
        try {
            $ip = $_SERVER['REMOTE_ADDR'] ?? '';

            $stmt = $pdo->prepare("
                INSERT INTO contact_messages
                (fullname, email, phone, subject, message, ip_address, status, created_at)
                VALUES (?, ?, ?, ?, ?, ?, 'new', NOW())
            ");

            $stmt->execute([
                $fullname,
                $email,
                $phone,
                $subject,
                $message,
                $ip
            ]);

            $success = 'Mesajınız başarıyla gönderildi. En kısa sürede dönüş yapılacaktır.';

            $fullname = '';
            $email = '';
            $phone = '';
            $subject = '';
            $message = '';
        } catch (Throwable $e) {
            $error = 'Mesaj gönderilirken sistem hatası oluştu.';
        }
    }
}
?>
<!doctype html>
<html lang="tr">
<head>
<meta charset="utf-8">
<title>RadyoHost Okey | İletişim</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="RadyoHost Okey iletişim ve destek merkezi. Oyun, üyelik, paket ve teknik destek için bize ulaşın.">

<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;min-width:240px;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)}

.page-hero{
    position:relative;
    overflow:hidden;
    padding:74px 0 54px;
    border-bottom:1px solid rgba(245,182,66,.18);
    background:
        linear-gradient(90deg,rgba(0,0,0,.88) 0%,rgba(0,0,0,.70) 44%,rgba(0,0,0,.48) 100%),
        url('<?= site_e($heroBgImage) ?>') center center/cover no-repeat;
}
.page-hero:before{
    content:"";
    position:absolute;
    inset:0;
    background:
        radial-gradient(circle at 18% 28%,rgba(245,182,66,.18),transparent 30%),
        linear-gradient(90deg,rgba(0,0,0,.30),rgba(0,0,0,.08));
}
.page-hero .container{position:relative;z-index:2}
.badge{display:inline-flex;padding:10px 15px;border-radius:999px;background:rgba(245,182,66,.13);border:1px solid rgba(245,182,66,.25);color:#f5b642;font-weight:1000;margin-bottom:18px}
.page-hero h1{font-size:clamp(42px,6vw,74px);line-height:1.02;margin:0;letter-spacing:-1.7px;text-transform:uppercase}
.page-hero h1 span{color:#f5b642}
.page-hero p{margin:18px 0 0;max-width:740px;color:#dce3ef;font-size:18px;font-weight:800;line-height:1.7}
.hero-buttons{display:flex;gap:14px;flex-wrap:wrap;margin-top:26px}

.contact-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:18px;margin-top:-32px;position:relative;z-index:5}
.contact-card{position:relative;overflow:hidden;padding:23px 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)}
.contact-card:after{content:"";position:absolute;right:14px;bottom:14px;width:70px;height:70px;border-radius:24px;background:rgba(245,182,66,.10)}
.contact-card em{display:block;font-style:normal;font-size:34px;margin-bottom:12px}
.contact-card strong{display:block;color:#f5b642;font-size:17px;margin-bottom:7px}
.contact-card span{color:#cfd6e3;font-size:13px;font-weight:900;line-height:1.5}

.section{padding:56px 0}
.contact-layout{display:grid;grid-template-columns:.85fr 1.15fr;gap:24px;align-items:start}
.info-panel,.form-panel{padding:30px;border-radius:36px;background:rgba(255,255,255,.055);border:1px solid rgba(255,255,255,.09);box-shadow:0 24px 75px rgba(0,0,0,.20)}
.info-panel h2,.form-panel h2{margin:0 0 12px;color:#f5b642;font-size:30px}
.info-panel p,.form-panel p{margin:0 0 22px;color:#aeb7c7;line-height:1.7;font-weight:800}
.check-list{display:grid;gap:13px;margin-top:22px}
.check-item{padding:16px;border-radius:20px;background:rgba(0,0,0,.23);border:1px solid rgba(255,255,255,.08);font-weight:900;color:#dce3ef}
.support-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:22px}
.support-stat{padding:17px;border-radius:20px;background:linear-gradient(135deg,rgba(245,182,66,.13),rgba(185,0,0,.10));border:1px solid rgba(255,255,255,.09)}
.support-stat strong{display:block;color:#f5b642;font-size:23px;margin-bottom:5px}
.support-stat span{color:#aeb7c7;font-size:12px;font-weight:900}

.form-alert{padding:15px 17px;border-radius:17px;font-weight:900;margin-bottom:16px}
.form-alert.success{background:rgba(0,150,70,.20);border:1px solid rgba(0,255,120,.30);color:#d8ffe8}
.form-alert.error{background:rgba(185,0,0,.20);border:1px solid rgba(255,80,80,.30);color:#ffdede}
.form-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}
.form-group.full{grid-column:1/-1}
.form-group label{display:block;margin-bottom:8px;color:#dce3ef;font-size:14px;font-weight:1000}
.form-control{width:100%;height:54px;border:1px solid rgba(255,255,255,.12);border-radius:18px;background:rgba(0,0,0,.26);color:#fff;padding:0 16px;outline:none;font-weight:800}
textarea.form-control{height:auto;min-height:170px;padding:16px;resize:vertical}
.form-control:focus{border-color:#f5b642;box-shadow:0 0 0 4px rgba(245,182,66,.12)}
.form-button{width:100%;margin-top:16px;border:0;cursor:pointer}

.faq-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:18px}
.faq-card{padding:24px;border-radius:28px;background:rgba(255,255,255,.055);border:1px solid rgba(255,255,255,.08)}
.faq-card strong{display:block;color:#f5b642;font-size:18px;margin-bottom:9px}
.faq-card span{display:block;color:#aeb7c7;line-height:1.7;font-weight:700}
.final-support{padding:40px;border-radius:40px;background:radial-gradient(circle at top right,rgba(245,182,66,.23),transparent 36%),linear-gradient(135deg,rgba(255,255,255,.08),rgba(255,255,255,.035));border:1px solid rgba(255,255,255,.10);display:flex;justify-content:space-between;align-items:center;gap:22px}
.final-support h2{margin:0;color:#fff;font-size:34px}
.final-support p{margin:8px 0 0;color:#aeb7c7;font-weight:800}

.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}
    .contact-cards,.faq-grid{grid-template-columns:repeat(2,1fr)}
}

@media(max-width:980px){
    .contact-layout{grid-template-columns:1fr}
    .support-stats{grid-template-columns:1fr}
    .final-support{display:block}
    .final-support .btn{margin-top:18px}
}

@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}
    .footer{grid-template-columns:1fr;text-align:center}
    .footer-right{justify-content:center}
    .page-hero{padding:54px 0 46px}
}

@media(max-width:620px){
    .contact-cards,.faq-grid,.form-grid{grid-template-columns:1fr}
}

@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}
    .page-hero h1{font-size:40px}
    .hero-buttons .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">🏠 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" class="active">☎️ İ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="page-hero">
    <div class="container">
        <div class="badge">☎️ İletişim ve Destek Merkezi</div>

        <h1>Bize <span>Ulaşın</span></h1>

        <p>Oyun kurulumu, üyelik işlemleri, paket satın alma ve teknik destek için ekibimiz size yardımcı olmaya hazır.</p>

        <div class="hero-buttons">
            <a href="#form" class="btn btn-gold">Mesaj Gönder</a>
            <a href="https://wa.me/905415917536" target="_blank" class="btn">WhatsApp Destek</a>
        </div>
    </div>
</section>

<section>
    <div class="container">
        <div class="contact-cards">
            <div class="contact-card"><em>📞</em><strong>Telefon</strong><span>0541 591 75 36</span></div>
            <div class="contact-card"><em>📧</em><strong>E-Posta</strong><span>destek@radyohost.biz</span></div>
            <div class="contact-card"><em>💬</em><strong>WhatsApp</strong><span>Hızlı destek hattı</span></div>
            <div class="contact-card"><em>📍</em><strong>Konum</strong><span>İstanbul / Türkiye</span></div>
        </div>
    </div>
</section>

<section class="section" id="form">
    <div class="container contact-layout">

        <aside class="info-panel">
            <h2>Neden Bize Ulaşmalısınız?</h2>
            <p>RadyoHost Okey kullanıcılarına hızlı, net ve güven veren destek sunmak için hazırlandı.</p>

            <div class="check-list">
                <div class="check-item">✅ Oyun kurulum desteği</div>
                <div class="check-item">✅ Şifre ve hesap yardımı</div>
                <div class="check-item">✅ Gold / Premium / VIP paket desteği</div>
                <div class="check-item">✅ Teknik sorun ve bağlantı desteği</div>
            </div>

            <div class="support-stats">
                <div class="support-stat"><strong>15 dk</strong><span>Ortalama dönüş</span></div>
                <div class="support-stat"><strong>7/24</strong><span>Aktif takip</span></div>
                <div class="support-stat"><strong>%98</strong><span>Memnuniyet</span></div>
            </div>
        </aside>

        <section class="form-panel">
            <h2>Mesaj Gönder</h2>
            <p>Formu doldurun, mesajınız doğrudan yönetim paneline iletilsin.</p>

            <?php if ($success !== ''): ?>
                <div class="form-alert success"><?= site_e($success) ?></div>
            <?php endif; ?>

            <?php if ($error !== ''): ?>
                <div class="form-alert error"><?= site_e($error) ?></div>
            <?php endif; ?>

            <form method="post">
                <div class="form-grid">
                    <div class="form-group">
                        <label>Ad Soyad</label>
                        <input type="text" name="fullname" class="form-control" value="<?= site_e($fullname) ?>" required>
                    </div>

                    <div class="form-group">
                        <label>E-Posta</label>
                        <input type="email" name="email" class="form-control" value="<?= site_e($email) ?>" required>
                    </div>

                    <div class="form-group">
                        <label>Telefon</label>
                        <input type="text" name="phone" class="form-control" value="<?= site_e($phone) ?>">
                    </div>

                    <div class="form-group">
                        <label>Konu</label>
                        <input type="text" name="subject" class="form-control" value="<?= site_e($subject) ?>" required>
                    </div>

                    <div class="form-group full">
                        <label>Mesajınız</label>
                        <textarea name="message" class="form-control" required><?= site_e($message) ?></textarea>
                    </div>
                </div>

                <button type="submit" class="btn btn-gold form-button">Mesajı Gönder</button>
            </form>
        </section>

    </div>
</section>

<section class="section">
    <div class="container">
        <div class="faq-grid">
            <div class="faq-card"><strong>Oyunu nasıl indiririm?</strong><span>İndir sayfasından güncel oyun dosyasını indirip kurulum yapabilirsiniz.</span></div>
            <div class="faq-card"><strong>Şifremi unuttum?</strong><span>Giriş ekranından destek alabilir veya iletişim formundan bize yazabilirsiniz.</span></div>
            <div class="faq-card"><strong>Paket nasıl alınır?</strong><span>Paketler sayfasından Gold, Premium veya VIP seçeneklerini inceleyebilirsiniz.</span></div>
            <div class="faq-card"><strong>Destek ne kadar sürede döner?</strong><span>Mesajlar düzenli kontrol edilir ve en kısa sürede dönüş sağlanır.</span></div>
        </div>
    </div>
</section>

<section class="section">
    <div class="container">
        <div class="final-support">
            <div>
                <h2>Hızlı destek için WhatsApp hattı.</h2>
                <p>Oyun, paket veya üyelik işlemleri için doğrudan WhatsApp üzerinden ulaşabilirsiniz.</p>
            </div>
            <a href="https://wa.me/905415917536" target="_blank" class="btn btn-gold">WhatsApp Destek</a>
        </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>