<?php
session_start();
require_once 'config.php';

// Check Login
if (!isset($_SESSION['user_id'])) {
    header("Location: login.php");
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>Super Jackpot - 91CLUB</title>
    <style>
        /* ORIGINAL 91CLUB FONT */
        @font-face { font-family: 'Bahnschrift'; src: url('https://91appt.com/assets/woff2/bahnschrift-610d57ac.woff2') format('woff2'); font-display: swap; }

        :root {
            --bg-body: #F7F8FA;         
            --primary: #F3595B;         
            --primary-grad: linear-gradient(135deg, #ff8b7b 0%, #f3595b 100%);
            --text-dark: #333333;
            --text-muted: #888888;
        }

        * { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent;}
        .bahnschrift { font-family: 'Bahnschrift', sans-serif !important; }
        
        body { background-color: var(--bg-body); color: var(--text-dark); max-width: 480px; margin: 0 auto; min-height: 100vh; overflow-x: hidden; }

        /* HEADER */
        .header { position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: 50px; background: #fff; display: flex; justify-content: center; align-items: center; z-index: 1000;}
        .back-btn { position: absolute; left: 15px; font-size: 20px; color: #666; cursor: pointer; text-decoration: none; padding: 10px;}
        .title { font-size: 16px; font-weight: bold; color: #333; }

        /* PAGE CONTAINER SETUP */
        .page-view { padding-top: 50px; display: none; padding-bottom: 20px;}
        .page-view.active { display: block; animation: fadeIn 0.3s ease; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

        /* =========================================
           1. MAIN PAGE STYLES
           ========================================= */
        .jp-banner { background: var(--primary-grad); color: white; padding: 20px 20px 30px; position: relative; overflow: hidden; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px;}
        .jp-banner h1 { font-size: 22px; font-weight: 900; margin-bottom: 10px; position: relative; z-index: 2;}
        .jp-banner p { font-size: 11px; line-height: 1.5; font-weight: 500; position: relative; z-index: 2; width: 65%; opacity: 0.9;}
        .jp-gift-img { position: absolute; right: -20px; bottom: -10px; width: 160px; z-index: 1; opacity: 0.9;}

        .main-content { padding: 0 15px; margin-top: -15px; position: relative; z-index: 10;}
        .btn-receive { background: #e0e0e0; color: #fff; text-align: center; padding: 12px; border-radius: 25px; font-size: 14px; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 15px; box-shadow: 0 4px 10px rgba(0,0,0,0.05);}
        .btn-receive svg { width: 18px; height: 18px; fill: #fff;}

        .action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 30px;}
        .action-btn { background: #fff; padding: 15px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: bold; color: #555; box-shadow: 0 2px 8px rgba(0,0,0,0.04); cursor: pointer; transition: 0.2s;}
        .action-btn:active { transform: scale(0.97); background: #f9f9f9;}
        .action-btn svg { width: 20px; height: 20px; }

        .empty-state { text-align: center; padding: 40px 20px;}
        .empty-state svg { width: 120px; height: 120px; margin-bottom: 15px; opacity: 0.5;}
        .empty-state p { font-size: 12px; color: #999; margin-bottom: 20px;}
        
        .btn-go-bet { background: var(--primary-grad); color: white; border: none; width: 100%; padding: 14px; border-radius: 25px; font-size: 16px; font-weight: bold; box-shadow: 0 4px 15px rgba(243, 89, 91, 0.3); cursor: pointer; display: block; text-align: center; text-decoration: none;}

        /* =========================================
           2. RULE PAGE STYLES
           ========================================= */
        .rule-banner { background: var(--primary-grad); color: white; padding: 20px 15px 40px; text-align: center; position: relative;}
        .rule-banner h1 { font-size: 22px; font-weight: 900; margin-bottom: 10px;}
        .rule-banner p { font-size: 11px; line-height: 1.5; font-weight: 500; opacity: 0.9;}

        .warning-box { background: rgba(255, 240, 230, 0.2); border: 1px solid rgba(255,255,255,0.4); border-radius: 10px; padding: 10px; margin-top: 15px; font-size: 10px; text-align: left; display: flex; gap: 8px; align-items: flex-start;}
        .warning-box svg { width: 14px; height: 14px; fill: #fff; flex-shrink: 0; margin-top: 2px;}

        .rule-content { padding: 0 15px; margin-top: -20px; position: relative; z-index: 10;}
        .bonus-card { background: #fff; border-radius: 12px; padding: 15px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); margin-bottom: 20px;}
        .bonus-card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: bold; color: var(--primary); margin-bottom: 15px;}
        .bonus-card-title svg { width: 18px; height: 18px; fill: var(--primary);}

        .bonus-table { width: 100%; border-collapse: collapse; font-size: 11px; text-align: center;}
        .bonus-table th { background: var(--primary); color: white; padding: 10px 5px; font-weight: bold;}
        .bonus-table th:first-child { border-top-left-radius: 8px;}
        .bonus-table th:last-child { border-top-right-radius: 8px;}
        .bonus-table td { padding: 12px 5px; border-bottom: 1px solid #f0f0f0; color: #555; font-weight: 600;}
        .bonus-table tr:last-child td { border-bottom: none;}
        .bonus-table td:nth-child(2) { color: #333; font-weight: bold;}
        .bonus-table td:nth-child(3) { color: var(--primary); font-weight: bold; font-size: 12px;}

        .rule-footer { font-size: 10px; color: #999; display: flex; gap: 8px; align-items: flex-start; margin-bottom: 20px; padding: 0 5px;}
        .rule-footer svg { width: 12px; height: 12px; fill: var(--primary); flex-shrink: 0; margin-top: 2px;}

        .btn-contact { background: linear-gradient(135deg, #FF7B7B, #F3595B); color: white; border: none; width: 100%; padding: 14px; border-radius: 25px; font-size: 14px; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 4px 15px rgba(243, 89, 91, 0.3); cursor: pointer;}
        .btn-contact svg { width: 18px; height: 18px; fill: #fff;}

        /* =========================================
           3. WINNING STAR PAGE STYLES
           ========================================= */
        .star-content { padding: 15px; }
        .winner-card { background: #fff; border-radius: 12px; padding: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); margin-bottom: 15px; display: flex; flex-direction: column; gap: 10px; border: 1px solid #f5f5f5;}
        .winner-top { display: flex; align-items: center; gap: 10px; border-bottom: 1px dashed #eee; padding-bottom: 10px;}
        .winner-top img { width: 35px; height: 35px; border-radius: 50%; object-fit: cover;}
        .winner-id { font-size: 14px; font-weight: bold; color: #333; }
        
        .w-row { display: flex; justify-content: space-between; font-size: 11px; color: #888;}
        .w-val { color: #333; font-weight: 600;}
        .w-val.highlight { color: var(--primary); font-weight: bold; font-size: 12px;}
    </style>
</head>
<body>

    <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
        <symbol id="icon-receive" viewBox="0 0 24 24"><path d="M19 15v4H5v-4h14m1-2H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zM7 18.5c-.82 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-2-5.5l6-4.5-6-4.5v9z"/></symbol>
        <symbol id="icon-rule" viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"/></symbol>
        <symbol id="icon-star" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></symbol>
        <symbol id="icon-warning" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/></symbol>
        <symbol id="icon-cs" viewBox="0 0 24 24"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"/></symbol>
        <symbol id="icon-play" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></symbol>
    </svg>

    <div class="header">
        <a href="javascript:void(0);" class="back-btn" id="headerBackBtn" onclick="goBack()">❮</a>
        <div class="title" id="headerTitle">Super Jackpot</div>
    </div>

    <div id="page-main" class="page-view active">
        <div class="jp-banner">
            <h1>Super Jackpot</h1>
            <p>When you get the Super Jackpot in [Slots] Can get 1 additional bonus<br><br>The reward is valid for 1 day, and you will not be able to claim it after it expires!</p>
            <img src="https://91appt.com/assets/png/giftRedeem-bb2f7a92.webp" alt="Gift" class="jp-gift-img">
        </div>

        <div class="main-content">
            <div class="btn-receive">
                <svg><use href="#icon-receive"></use></svg>
                Receive in batches
            </div>

            <div class="action-row">
                <div class="action-btn" onclick="switchPage('rule')">
                    <svg fill="#f3595b"><use href="#icon-rule"></use></svg> Rule
                </div>
                <div class="action-btn" onclick="switchPage('star')">
                    <svg fill="#f3595b"><use href="#icon-star"></use></svg> Winning star
                </div>
            </div>

            <div class="empty-state">
                <svg viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M150 150H50C38.9543 150 30 141.046 30 130V50C30 38.9543 38.9543 30 50 30H150C161.046 30 170 38.9543 170 50V130C170 141.046 161.046 150 150 150Z" fill="#E8EAF6"/>
                    <path d="M70 150V170M130 150V170M50 170H150" stroke="#CFD8DC" stroke-width="8" stroke-linecap="round"/>
                    <rect x="50" y="50" width="100" height="80" rx="4" fill="#FFFFFF"/>
                    <path d="M80 80L100 100L120 80" stroke="#CFD8DC" stroke-width="6" stroke-linecap="round" stroke-linejoin="round"/>
                </svg>
                <p>You don't have a big jackpot yet, let's bet</p>
                <a href="index.php" class="btn-go-bet">Go bet</a>
            </div>
        </div>
    </div>

    <div id="page-rule" class="page-view">
        <div class="rule-banner">
            <h1>Super Jackpot</h1>
            <p>When you win the Super Jackpot in the game, you can get additional platform bonuses, and the bonuses will be distributed to you according to the multiple of the winning prize</p>
            
            <div class="warning-box">
                <svg><use href="#icon-warning"></use></svg>
                <div>Warning: Please claim all bonuses before the event ends, after the event ends, you will lose the chance to get the bonus</div>
            </div>
        </div>

        <div class="rule-content">
            <div class="bonus-card">
                <div class="bonus-card-title">
                    <svg><use href="#icon-receive"></use></svg> Bonus
                </div>
                
                <table class="bonus-table">
                    <thead>
                        <tr>
                            <th>Winning rate</th>
                            <th>Bet amount</th>
                            <th>Bonus</th>
                        </tr>
                    </thead>
                    <tbody class="bahnschrift">
                        <tr>
                            <td>10X-19.9X</td>
                            <td>₹30-₹99999</td>
                            <td>₹35.00</td>
                        </tr>
                        <tr>
                            <td>20X-29.9X</td>
                            <td>₹30-₹99999</td>
                            <td>₹70.00</td>
                        </tr>
                        <tr>
                            <td>30X-39.9X</td>
                            <td>₹30-₹99999</td>
                            <td>₹140.00</td>
                        </tr>
                        <tr>
                            <td>40X-59.9X</td>
                            <td>₹30-₹99999</td>
                            <td>₹210.00</td>
                        </tr>
                        <tr>
                            <td>60X-999999X</td>
                            <td>₹30-₹99999</td>
                            <td>₹300.00</td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <div class="rule-footer">
                <svg><use href="#icon-play"></use></svg>
                <span>All event interpretation rights belong to the platform. If you have any questions, please contact customer service now</span>
            </div>

            <button class="btn-contact" onclick="window.location.href='support.php'">
                <svg><use href="#icon-cs"></use></svg>
                Contact customer service
            </button>
        </div>
    </div>

    <div id="page-star" class="page-view">
        <div class="star-content">
            
            <div class="winner-card">
                <div class="winner-top">
                    <img src="assets/images/face.png" onerror="this.src='https://ui-avatars.com/api/?name=User1&background=random&color=fff&rounded=true'">
                    <span class="winner-id bahnschrift">919***006</span>
                </div>
                <div class="w-row"><span>Game name</span> <span class="w-val">Royal Fishing</span></div>
                <div class="w-row"><span>Number of wins</span> <span class="w-val highlight">10X</span></div>
                <div class="w-row"><span>Bonus</span> <span class="w-val highlight">₹35.00</span></div>
                <div class="w-row"><span>Winning time</span> <span class="w-val bahnschrift">2026-03-02 11:48:01</span></div>
            </div>

            <div class="winner-card">
                <div class="winner-top">
                    <img src="assets/images/face.png" onerror="this.src='https://ui-avatars.com/api/?name=User2&background=random&color=fff&rounded=true'">
                    <span class="winner-id bahnschrift">919***561</span>
                </div>
                <div class="w-row"><span>Game name</span> <span class="w-val">Mines</span></div>
                <div class="w-row"><span>Number of wins</span> <span class="w-val highlight">18.59X</span></div>
                <div class="w-row"><span>Bonus</span> <span class="w-val highlight">₹35.00</span></div>
                <div class="w-row"><span>Winning time</span> <span class="w-val bahnschrift">2026-03-02 11:48:01</span></div>
            </div>

            <div class="winner-card">
                <div class="winner-top">
                    <img src="assets/images/face.png" onerror="this.src='https://ui-avatars.com/api/?name=User3&background=random&color=fff&rounded=true'">
                    <span class="winner-id bahnschrift">919***592</span>
                </div>
                <div class="w-row"><span>Game name</span> <span class="w-val">Vortex</span></div>
                <div class="w-row"><span>Number of wins</span> <span class="w-val highlight">12.5X</span></div>
                <div class="w-row"><span>Bonus</span> <span class="w-val highlight">₹35.00</span></div>
                <div class="w-row"><span>Winning time</span> <span class="w-val bahnschrift">2026-03-02 11:48:01</span></div>
            </div>

        </div>
    </div>


    <script>
        let currentView = 'main';

        function switchPage(page) {
            // Hide all pages
            document.getElementById('page-main').classList.remove('active');
            document.getElementById('page-rule').classList.remove('active');
            document.getElementById('page-star').classList.remove('active');

            // Show target page
            document.getElementById('page-' + page).classList.add('active');
            currentView = page;

            // Update Header Title
            const titleEl = document.getElementById('headerTitle');
            if(page === 'main') {
                titleEl.innerText = 'Super Jackpot';
            } else if (page === 'rule') {
                titleEl.innerText = 'Rule';
            } else if (page === 'star') {
                titleEl.innerText = 'Winning star';
            }
        }

        function goBack() {
            if (currentView === 'main') {
                // Return to previous activity page
                window.location.href = 'activity.php'; 
            } else {
                // Return to main jackpot view
                switchPage('main');
            }
        }
    </script>
</body>
</html>