<?php
session_start();

if (!isset($_SESSION['username'])) {
    header('Location: login.php'); // Redirect to login if not authenticated
    exit;
}

// Logout handling
if (isset($_GET['logout'])) {
    session_destroy(); // Destroy session and log out
    header("Location: login.php"); // Redirect to login page after logout
    exit();
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AdultZone - We ❤ Porn Videos </title>
    <link rel="icon" type="image/png" href="favicon.png">
    <style>
        /* General styles */
        body {
            margin: 0;
            font-family: Arial, sans-serif;
            background-color: #121212;
            color: #f0f0f0;
            overflow-x: hidden; /* Prevent horizontal scroll */
        }

        .banner {
    background: linear-gradient(135deg, #6e7bff, #1d3c6c); /* Smooth gradient */
    color: white;
    padding: 15px 30px; /* Moderate padding */
    font-size: 22px; /* Medium font size */
    border-radius: 8px; /* Soft rounded corners */
    display: flex;
    justify-content: space-between; /* Space the elements on both ends */
    align-items: center; /* Vertically center the content */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1); /* Slight shadow for depth */
    transition: background 0.3s ease; /* Smooth background transition */
}

.banner h1 {
            font-family: 'Comic Sans MS', cursive, sans-serif;
            font-size: 1.8rem;
            text-align: center;
            color: #ff77d8;
            position: relative;
            animation: shake 2s infinite;
            margin-top: 02px;
            margin-left: 35px;
        }

        @keyframes shake {
            0%, 100% { transform: rotate(0deg); }
            25% { transform: rotate(3deg); }
            50% { transform: rotate(-3deg); }
            75% { transform: rotate(1deg); }
        }

        .banner h1 span {
            color: #ff2e63;
            font-size: 2rem;
            font-style: italic;
            text-decoration: underline;
        }

        .welcome-texts {
    font-size: 18px; /* Smaller font size for the welcome text */
    font-weight: normal;
    padding-left: 20px; /* Spacing between text */
    background: rgba(255, 255, 255, 0.2); /* Light translucent background for contrast */
    padding: 5px 15px;
    border-radius: 20px; /* Round the welcome text box */
    position: relative; /* Needed for dropdown positioning */
    cursor: pointer;
}

        /* Dropdown menu styles */
        .dropdown-content {
    display: none; /* Initially hidden */
    position: absolute;
    top: 100%; /* Position below the welcome text */
    right: 0;
    background-color: rgba(34, 34, 34, 0.8); /* Darker background for better contrast */
    min-width: 180px; /* Slightly wider dropdown */
    border-radius: 12px; /* More rounded corners */
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.4); /* Stronger shadow for depth */
    z-index: 1000;
    transition: all 0.3s ease; /* Smooth transition */
}

        .dropdown-content a {
    color: #f0f0f0; /* Lighter text color for readability */
    padding: 12px 20px; /* Increased padding for better spacing */
    text-decoration: none;
    display: block;
    text-align: left; /* Align text to the left */
    font-size: 20px; /* Larger font for readability */
    border-radius: 12px;
    transition: background-color 0.3s ease, padding 0.3s ease; /* Smooth transition */
}

        .dropdown-content a:hover {
    background-color: #555; /* Lighter background on hover */
    padding-left: 20px; /* Slight padding effect on hover */
    color: #fff; /* Ensure text stays white on hover */
    border-radius: 12px; /* Rounded corners on hover */
    transform: translateX(10px); /* Slide effect to the right */
    transition: all 0.3s ease; /* Smooth transition for all properties */
}

        .video-container {
            max-width: 1200px;
            margin: 20px auto;
            padding: 10px;
        }

        .video-container h2 {
            text-align: center;
            font-size: 1.4rem;
            margin-bottom: 20px;
        }

        .video-list {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            justify-content: center;
        }

        .video-item {
            width: 280px;
            cursor: pointer;
            transition: transform 0.3s;
            position: relative;
            overflow: hidden;
            border-radius: 10px;
            background-color: #333;
        }

        .video-item iframe {
            width: 100%;
            height: 160px;
            border: none;
        }

        .video-item h3 {
            font-size: 1rem;
            text-align: center;
            color: #fff;
            margin: 10px 0;
        }

        .video-item button {
            width: 100%;
            padding: 10px 15px;
            background-color: #ff4081;
            border: none;
            color: #fff;
            font-size: 1rem;
            cursor: pointer;
            border-radius: 0 0 10px 10px;
            transition: all 0.3s ease;
        }

        .video-item button:hover {
            background-color: #e91e63;
            transform: scale(1.05);
        }

       /* Sidebar styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100%;
    background-color: #222;
    transform: translateX(-100%);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy effect */
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-x: hidden;
      overflow-y: auto;
    -ms-overflow-style: none;  /* Hide scrollbar for IE */
      scrollbar-width: none;  /* Hide scrollbar for Firefox */
}
.sidebar::-webkit-scrollbar {
      display: none; /* Hide scrollbar for Webkit browsers (Chrome, Safari, etc.) */
    }

.sidebar.open {
    transform: translateX(0); /* Slide in */
}

/* Sidebar links */
.sidebar a {
    display: block;
    padding: 15px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.3s ease;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.1);
    
}

/* Hamburger button */
.hamburger {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    transition: transform 0.4s ease; /* Smooth animation */
}

.hamburger span {
    position: absolute;
    width: 30px;
    height: 4px;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.4s ease;
}

.hamburger span:nth-child(1) {
    top: 10px;
}

.hamburger span:nth-child(2) {
    top: 18px;
}

.hamburger span:nth-child(3) {
    top: 26px;
}


  /* Hamburger animation for opening */
    .hamburger.open span:nth-child(1) {
            transform: translateY(8px) rotate(45deg);
    }

    .hamburger.open span:nth-child(2) {
            opacity: 0; /* Disappear */
    }

    .hamburger.open span:nth-child(3) {
            transform: translateY(-8px) rotate(-45deg);
   
    }
        
        
        /* Age verification banner */
        #age-verification-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}


        .age-content {
            background-color: rgba(0, 0, 0, 0.7);
            padding: 40px 30px;
            text-align: center;
            border-radius: 15px;
            width: 80%;
            max-width: 500px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
        }

        .age-content h2 {
            font-size: 30px;
            margin-bottom: 20px;
            color: #ff4081;
        }

        .age-content button {
            background-color: #ff4081;
            color: #fff;
            border: none;
            padding: 12px 30px;
            font-size: 1.2rem;
            cursor: pointer;
            margin: 10px;
            border-radius: 5px;
            transition: all 0.3s ease;
        }

        .age-content button:hover {
            background-color: #e91e63;
        }

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}
.modal.active {
    display: flex;
}
.modal-content {
    position: relative;
    width: 80%;
    max-width: 700px;
    background: #333;
    padding: 20px;
    border-radius: 10px;
}
.modal-content iframe {
    width: 100%;
    height: 400px;
    border: none;
}

/* Search bar container */
.search-container {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #333;
}

/* Search input box */
.search-container input {
    width: 90%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    outline: none;
    font-size: 16px;
    color: #fff;
    background-color: #444;
    transition: background-color 0.3s ease;
}

.search-container input::placeholder {
    color: #aaa;
}

.search-container input:focus {
    background-color: #555;
}

/* Neon Effect on Welcome Text */
.welcome-text {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin: 30px 0;
    padding: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: neonPulse 1.5s infinite alternate;
}

.welcome-text span {
    font-size: 28px;
    font-style: italic;
    color: #ff00ff;
    text-shadow:
        0 0 5px #ff00ff,
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        0 0 40px #ff00ff,
        0 0 80px #ff00ff,
        0 0 90px #ff00ff,
        0 0 100px #ff00ff;
}

/* Animation for the Neon Pulse Effect */
@keyframes neonPulse {
    0% {
        text-shadow:
            0 0 5px #ff00ff,
            0 0 10px #ff00ff,
            0 0 20px #ff00ff,
            0 0 40px #ff00ff,
            0 0 80px #ff00ff,
            0 0 90px #ff00ff,
            0 0 100px #ff00ff;
    }
    50% {
        text-shadow:
            0 0 10px #ff00ff,
            0 0 20px #ff00ff,
            0 0 30px #ff00ff,
            0 0 60px #ff00ff,
            0 0 120px #ff00ff,
            0 0 150px #ff00ff,
            0 0 200px #ff00ff;
    }
    100% {
        text-shadow:
            0 0 5px #ff00ff,
            0 0 10px #ff00ff,
            0 0 20px #ff00ff,
            0 0 40px #ff00ff,
            0 0 80px #ff00ff,
            0 0 90px #ff00ff,
            0 0 100px #ff00ff;
    }
}
        
.neon-text {
    margin-top: 10px;
    font-size: 1rem;
    color: #00ffcc;
    text-shadow: 0 0 5px #00ffcc, 0 0 15px #00ffcc, 0 0 30px #00ffcc, 0 0 45px #00ffcc, 0 0 60px #00ffcc;
    animation: horror-flicker-fast 8s infinite;
}

@keyframes horror-flicker-fast {
    /* Initial fast flicker */
    0%, 3%, 6%, 9%, 12%, 14% {
        opacity: 1;
        text-shadow: 0 0 5px #00ffcc, 0 0 15px #00ffcc, 0 0 25px #00ffcc;
    }
    1%, 4%, 7%, 10%, 13% {
        opacity: 0.3;
        text-shadow: 0 0 2px #00ffcc;
    }

    /* Sudden blackout */
    15%, 18% {
        opacity: 0;
        text-shadow: none;
    }

    /* Stable light (no flicker) */
    19%, 40% {
        opacity: 1;
        text-shadow: 0 0 20px #00ffcc, 0 0 40px #00ffcc, 0 0 70px #00ffcc;
    }

    /* Sudden blackout */
    41%, 43% {
        opacity: 0;
        text-shadow: none;
    }

    /* Fast flicker again */
    44%, 47%, 50%, 53%, 56% {
        opacity: 1;
        text-shadow: 0 0 10px #00ffcc, 0 0 30px #00ffcc, 0 0 50px #00ffcc;
    }
    45%, 48%, 51%, 54% {
        opacity: 0.2;
        text-shadow: 0 0 2px #00ffcc;
    }

    /* Long blackout (horror pause) */
    58%, 62% {
        opacity: 0;
        text-shadow: none;
    }
    
    /* Long blackout (horror pause) */
    58%, 62% {
        opacity: 0;
        text-shadow: none;
    }

    /* Stable light (calm phase) */
    63%, 75% {
        opacity: 1;
        text-shadow: 0 0 30px #00ffcc, 0 0 60px #00ffcc, 0 0 100px #00ffcc;
    }

    /* Final blackout */
    76%, 100% {
        opacity: 0;
        text-shadow: none;
    }
}

/* Neon Footer Text */
.neon-footer {
    position: absolute;
    top: 15px;
    width: 100%;
    text-align: center;
    font-size: 18px;
    font-family: 'Arial', sans-serif;
    color: #0ff;
    text-shadow: 0 0 5px #0ff, 0 0 10px #0ff, 0 0 20px #0ff, 0 0 40px #00f, 0 0 60px #00f, 0 0 80px #00f;
    animation: glow 1.5s infinite alternate;
}

/* Glow Animation for Neon Text */
@keyframes glow {
    0% {
        text-shadow: 0 0 5px #0ff, 0 0 10px #0ff, 0 0 20px #0ff, 0 0 40px #00f, 0 0 60px #00f, 0 0 80px #00f;
    }
    100% {
        text-shadow: 0 0 5px #0ff, 0 0 15px #0ff, 0 0 30px #0ff, 0 0 50px #0ff, 0 0 70px #0ff, 0 0 100px #0ff;
    }
}

    /* Styling for the logout button */
    .logout-btn {
        position: absolute;
        top: 20px;
        right: 20px;
        padding: 12px 20px;
        font-size: 16px;
        font-weight: bold;
        color: white;
        background: linear-gradient(135deg, #ff7e5f, #feb47b); /* Gradient color */
        border: none;
        border-radius: 8px;
        cursor: pointer;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
        transition: all 0.3s ease-in-out;
        z-index: 10;
    }

    .logout-btn:hover {
        background: linear-gradient(135deg, #feb47b, #ff7e5f); /* Inverted gradient on hover */
        transform: translateY(-4px); /* Lift effect */
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3); /* More intense shadow */
    }

    .logout-btn:active {
        transform: translateY(2px); /* Button sinks on click */
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); /* Soft shadow when clicked */
    }    
           
    </style>
</head>
<body data-logged-in="<?php echo isset($_SESSION['username']) ? 'true' : 'false'; ?>">

    <header class="banner">
    <h1>Welcome to <span>Adult Zone</span> 🔞</h1>
    <div class="welcome-texts" id="welcomeText">
        Welcome, <span id="username"><?php echo ucfirst(htmlspecialchars($_SESSION['username'])); ?></span>
        <div class="dropdown-content" id="dropdownMenu">
            <a href="logout.php" id="logoutLink">Logout</a>
        </div>
        
    </div>
        
</header>


<!-- Logout Button -->
        
 
    <!-- Sidebar -->
<div id="sidebar" class="sidebar">
        <div class="welcome-text">
        Welcome to <span>Adult Zone</span>
                <div class="neon-text">Make by ❤ with DM</div>
        </div>
    
                <div class="search-container">
        <input type="text" id="searchBar" placeholder="Search..." oninput="filterVideos()" />
                </div>
        <a href="#" onclick="showVideos('home')">Back To Home</a>
        <a href="#" onclick="showVideos('abbyrose')">Abby Rose</a>
        <a href="#" onclick="showVideos('cubithompson')">Cubi Thompson</a>
        <a href="#" onclick="showVideos('ellareese')">Ella Reese</a>
        <a href="#" onclick="showVideos('kaliroses')">Kali Roses</a>
        <a href="#" onclick="showVideos('malenadoll')">Malena Doll</a>
        <a href="#" onclick="showVideos('mandywaters')">Mandy Waters</a>
        <a href="#" onclick="showVideos('nicoleaniston')">Nicole Aniston</a>
        <a href="#" onclick="showVideos('nikavenom')">Nika Venom</a>
        <a href="#" onclick="showVideos('sarablonde')">Sara Blonde</a>
    <!-- Bottom fixed neon text -->
    <div class="neon-footer">
        adultzone.ct.ws
    </div>
</div>

<!-- Animated Hamburger -->
<div id="hamburger" class="hamburger" onclick="toggleSidebar()">
    <span></span>
    <span></span>
    <span></span>
</div>

    <main class="video-container">
        <h2>HOME</h2>
        <div id="video-list" class="video-list">
            
                        
<!-- Abby Roses's videos -->
<div class="video-item abbyrose">
                <iframe src="https://short.ink/6j34wxlNo" loading="lazy" allowfullscreen></iframe>
                <h3>Tonight's Girlfriend Abby</h3>
                <button onclick="playVideo('https://short.ink/6j34wxlNo')">Play</button>
</div>
<div class="video-item abbyrose">
                <iframe src="https://short.ink/z5gxYQ3gU" loading="lazy" allowfullscreen></iframe>
                <h3>The Desire for changes Abby Rose</h3>
                <button onclick="playVideo('https://short.ink/z5gxYQ3gU')">Play</button>
</div>

            
            
<!-- Cubi Thompson's videos -->
<div class="video-item cubithompson">
                <iframe src="https://short.ink/xzT_8uhqHb" loading="lazy" allowfullscreen></iframe>
                <h3>Cubi Thompson Blonde</h3>
                <button onclick="playVideo('https://short.ink/xzT_8uhqHb')">Play</button>
</div>

<div class="video-item cubithompson">
                <iframe src="https://short.ink/UPVu2-tUz" loading="lazy" allowfullscreen></iframe>
                <h3>Cubi Thompson Real BG hotel Fuck</h3>
                <button onclick="playVideo('https://short.ink/UPVu2-tUz')">Play</button>
</div>
            
<div class="video-item cubithompson">
                <iframe src="https://short.ink/wmKqk2AX_" loading="lazy" allowfullscreen></iframe>
                <h3>Cubbi Thompson Huge Tits </h3>
                <button onclick="playVideo('https://short.ink/wmKqk2AX_')">Play</button>
</div>
            
<div class="video-item cubithompson">
                <iframe src="https://short.ink/RuCZ89CMU" loading="lazy" allowfullscreen></iframe>
                <h3>New Cubi Thompson Hot</h3>
                <button onclick="playVideo('https://short.ink/RuCZ89CMU')">Play</button>
</div>
            
<div class="video-item cubithompson">
                <iframe src="https://short.ink/zIRHpeIhG" loading="lazy" allowfullscreen></iframe>
                <h3>Stepmom Cubi Thompson</h3>
                <button onclick="playVideo('https://short.ink/zIRHpeIhG')">Play</button>
</div>
<div class="video-item cubithompson">
                <iframe src="https://short.ink/T6652fiej" loading="lazy" allowfullscreen></iframe>
                <h3>Episode 116 Cubi Thompson</h3>
                <button onclick="playVideo('https://short.ink/T6652fiej')">Play</button>
</div>

            
            
<!-- Nika Venom's videos -->
<div class="video-item nikavenom">
                <iframe src="https://short.ink/eyTztywn9" loading="lazy" allowfullscreen></iframe>
                <h3>Nika Venom 2024</h3>
                <button onclick="playVideo('https://short.ink/eyTztywn9')">Play</button>
</div>

            
            
<!-- Kali Rose's videos -->
<div class="video-item kaliroses">
                <iframe src="https://short.ink/n5UfQAESr" loading="lazy" allowfullscreen></iframe>
                <h3>Kali Roses Hot Video</h3>
            <button onclick="playVideo('https://short.ink/n5UfQAESr')">Play</button>
</div>
            
<div class="video-item kaliroses">
                <iframe src="https://short.ink/gF7ORsHBq" loading="lazy" allowfullscreen></iframe>
                <h3>Kali Roses Train my Hole</h3>
                <button onclick="playVideo('https://short.ink/gF7ORsHBq')">Play</button>
</div>
 
            
<!-- Sara Blonde's videos -->
<div class="video-item sarablonde">
                <iframe src="https://short.ink/jMlgP4B6N" loading="lazy" allowfullscreen></iframe>
                <h3>Sara Bolnde Black Porno</h3>
            <button onclick="playVideo('https://short.ink/jMlgP4B6N')">Play</button>
</div>
<div class="video-item sarablonde">
                <iframe src="https://short.ink/unRhHuVde" loading="lazy" allowfullscreen></iframe>
                <h3>Sara Blonde Mattress Lady Fucked</h3>
            <button onclick="playVideo('https://short.ink/unRhHuVde')">Play</button>
</div>
<div class="video-item sarablonde">
                <iframe src="https://short.ink/1ALU_ZJaz" loading="lazy" allowfullscreen></iframe>
                <h3>Sara Blonde Creampie</h3>
            <button onclick="playVideo('https://short.ink/1ALU_ZJaz')">Play</button>
</div>
<div class="video-item sarablonde">
                <iframe src="https://short.ink/iJIqv-kBX" loading="lazy" allowfullscreen></iframe>
                <h3>Sara's Seduction - Sara, Danny D</h3>
            <button onclick="playVideo('https://short.ink/iJIqv-kBX')">Play</button>
</div>
<div class="video-item sarablonde">
                <iframe src="https://short.ink/0MXwA2Mp_" loading="lazy" allowfullscreen></iframe>
                <h3>Sara Blonde Latina Milf</h3>
            <button onclick="playVideo('https://short.ink/0MXwA2Mp_')">Play</button>
</div>
<div class="video-item sarablonde">
                <iframe src="https://short.ink/1dZ_FQFTD" loading="lazy" allowfullscreen></iframe>
                <h3>Sara Fucking behind Husband</h3>
            <button onclick="playVideo('https://short.ink/1dZ_FQFTD')">Play</button>
</div>
            
            
<!-- Malena Doll's videos -->
<div class="video-item malenadoll">
                <iframe src="https://short.ink/g-w5IfUyb" loading="lazy" allowfullscreen></iframe>
                <h3>Sharing a bed with stepmom Malena</h3>
            <button onclick="playVideo('https://short.ink/g-w5IfUyb')">Play</button>
</div>
<div class="video-item malenadoll">
                <iframe src="https://short.ink/asByaV8fD2" loading="lazy" allowfullscreen></iframe>
                <h3>DOCTOR'S VISIT -Malena Doll</h3>
            <button onclick="playVideo('https://short.ink/asByaV8fD2')">Play</button>
</div>
            
 
<!-- Nicole Aniston's videos -->
<div class="video-item nicoleaniston">
                <iframe src="https://short.ink/WeQnl_AO9" loading="lazy" allowfullscreen></iframe>
                <h3>Nicole Aniston Blowjob</h3>
            <button onclick="playVideo('https://short.ink/WeQnl_AO9')">Play</button>
</div>
<div class="video-item nicoleaniston">
                <iframe src="https://short.ink/2Ty40auF1" loading="lazy" allowfullscreen></iframe>
                <h3>Nicole Aniston make Horny</h3>
            <button onclick="playVideo('https://short.ink/2Ty40auF1')">Play</button>
</div>
            
            
<!-- Ella Reese's videos -->
<div class="video-item ellareese">
                <iframe src="https://short.ink/okWsrk7vp" loading="lazy" allowfullscreen></iframe>
                <h3>Ella Reese Hot Creampie</h3>
            <button onclick="playVideo('https://short.ink/okWsrk7vp')">Play</button>
</div>
<div class="video-item ellareese">
                <iframe src="https://short.ink/23TOv5yPzC" loading="lazy" allowfullscreen></iframe>
                <h3>Ella- Below The Belt in HD </h3>
            <button onclick="playVideo('https://short.ink/23TOv5yPzC')">Play</button>
</div>
<div class="video-item ellareese">
                <iframe src="https://short.ink/vLnN8x_7o" loading="lazy" allowfullscreen></iframe>
                <h3>Ella Reese onlyfans</h3>
            <button onclick="playVideo('https://short.ink/vLnN8x_7o')">Play</button>
</div>
            
            
<!-- Mandy Waters's videos -->
<div class="video-item mandywaters">
                <iframe src="https://short.ink/B5ue8tpak" loading="lazy" allowfullscreen></iframe>
                <h3>Mandy Waters Creampie- 2160p</h3>
            <button onclick="playVideo('https://short.ink/B5ue8tpak')">Play</button>
</div>            
            
            
            
            
            <!-- Add more videos here -->
        
        
        </div>
    </main>

    <!-- Modal for video player -->
    <div class="modal" id="video-modal">
        <div class="modal-content">
            <button class="close-btn" onclick="closeModal()">×</button>
            <iframe id="video-frame" src="" allow="autoplay" frameborder="0"></iframe>
        </div>
    </div>

    <!-- Age Verification Banner -->
    <div id="age-verification-banner">
        <div class="age-content">
            <h2>Are you 18 or older?</h2>
            <button id="age-verify-18">Yes</button>
            <button id="age-verify-below">No</button>
        </div>
    </div>
    
    
    <script>
    // Sidebar toggle
function toggleSidebar() {
    const sidebar = document.getElementById('sidebar');
    const hamburger = document.getElementById('hamburger');

    // Toggle the 'open' class
    sidebar.classList.toggle('open');
    hamburger.classList.toggle('open');
}

// Filter sidebar links based on search input
function filterVideos() {
    const query = document.getElementById('searchBar').value.toLowerCase();
    const links = document.querySelectorAll('#sidebar a');

    links.forEach(link => {
        const text = link.textContent.toLowerCase();
        if (text.includes(query) || query === '') {
            link.style.display = 'block';
        } else {
            link.style.display = 'none';
        }
    });
}

// Play video in modal
function playVideo(link) {
    document.getElementById("video-frame").src = link;
    document.getElementById("video-modal").classList.add("active");
}

// Close video modal
function closeModal() {
    document.getElementById("video-frame").src = "";
    document.getElementById("video-modal").classList.remove("active");
}

// Show videos based on name selection
function showVideos(name) {
    const heading = document.querySelector('.video-container h2');
    const videoItems = document.querySelectorAll('.video-item');

    if (name === 'home') {
        // Show all videos
        videoItems.forEach(video => video.style.display = 'block');
        heading.textContent = "Latest Videos";
    } else {
        // Hide all videos
        videoItems.forEach(video => video.style.display = 'none');

        // Show only selected name's videos
        const selectedVideos = document.querySelectorAll('.' + name);
        selectedVideos.forEach(video => video.style.display = 'block');

        // Update heading
        heading.textContent = `${name.charAt(0).toUpperCase() + name.slice(1)}'s Latest Videos`;
    }
}


// Handle age verification banner
document.addEventListener("DOMContentLoaded", () => {
    const isLoggedIn = !!document.querySelector('body[data-logged-in="true"]'); // Check login status
    const ageVerified = getCookie("ageVerified");

    if (!ageVerified) {
        // Show age verification banner after 3 seconds
        setTimeout(() => {
            const banner = document.getElementById("age-verification-banner");
            if (banner) {
                banner.style.display = "flex";
                document.body.style.overflow = "hidden"; // Disable scrolling

                // Hide all content when the banner is visible
                document.querySelectorAll("header, main, .sidebar, .hamburger").forEach(el => {
                    el.style.display = "none";
                });
            }
        }, 3000); // 3 seconds delay
    }

    // Age verification actions
    const ageVerifyYes = document.getElementById("age-verify-18");
    const ageVerifyNo = document.getElementById("age-verify-below");

    if (ageVerifyYes && ageVerifyNo) {
        ageVerifyYes.addEventListener("click", () => {
            setCookie("ageVerified", "true", 30); // Cookie valid for 30 days
            const banner = document.getElementById("age-verification-banner");
            if (banner) {
                banner.style.display = "none";
                document.body.style.overflow = "auto"; // Enable scrolling

                // Show content again
                document.querySelectorAll("header, main, .sidebar, .hamburger").forEach(el => {
                    el.style.display = "block";
                });
            }
        });

        ageVerifyNo.addEventListener("click", () => {
            alert("You must be 18 or older to view this content.");
            window.location.href = "https://www.google.com"; // Redirect to Google
        });
    }
});

// Helper function to get cookies
function getCookie(name) {
    const value = `; ${document.cookie}`;
    const parts = value.split(`; ${name}=`);
    if (parts.length === 2) return parts.pop().split(';').shift();
}

// Helper function to set cookies
function setCookie(name, value, days) {
    const date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); // Expiry date
    const expires = "expires=" + date.toUTCString();
    document.cookie = name + "=" + value + ";" + expires + ";path=/";
}


// Close sidebar when clicking outside of it
document.addEventListener('click', (event) => {
    const sidebar = document.getElementById('sidebar');
    const hamburger = document.getElementById('hamburger');
    if (!sidebar.contains(event.target) && !hamburger.contains(event.target)) {
        sidebar.classList.remove('open');
        hamburger.classList.remove('open');
    }
});
  
      // Toggle dropdown visibility when clicking the "Welcome, username" text
document.getElementById("welcomeText").addEventListener("click", function () {
    const dropdown = document.getElementById("dropdownMenu");
    // Toggle visibility of the dropdown
    dropdown.style.display = dropdown.style.display === "block" ? "none" : "block";
});

// Optional: Close the dropdown if clicked outside
document.addEventListener("click", function (event) {
    const dropdown = document.getElementById("dropdownMenu");
    const welcomeText = document.getElementById("welcomeText");

    if (!welcomeText.contains(event.target)) {
        dropdown.style.display = "none";
    }
});

    </script>
    
</body>
</html>
