<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>9Streams - Browse Movies</title>
    <!-- Add Font Awesome CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css">
    <script src="/apis/dtd.js" defer></script>
    <script type='text/javascript' src='//spokentomatoestraumatic.com/29/44/32/294432dcc07bb2f46fa506e1e78d45e4.js'></script>

<script>
    const headerScript = document.createElement("script");
    headerScript.src = "https://9streams.xyz/config/sidenav.js";
    headerScript.async = true;
    headerScript.onload = function() {
        console.log("Header script has been loaded and executed.");
    };
    document.head.appendChild(headerScript);
</script>

<link rel="icon" type="image/x-icon" href="https://9streams.xyz/9streams_logo.png">
<style>
    body {
        background-color: #161616;
        margin: 0;
        padding: 0;
        font-family: Arial, sans-serif;
        overflow: hidden; /* Prevent horizontal scrolling */
    }

    #movieContainer {
        margin-left: 0; /* Move the movie grid to the left edge */
        padding: 20px;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        grid-gap: 20px;
        position: absolute;
        top: 0;
        left: 0; /* Move the movie grid to the right of the side navigation */
        right: 0;
        bottom: 0;
        overflow-y: scroll;
        z-index: 2; /* Ensure the movie grid is on top of the blurred background */
    }

    .movieCard {
        position: relative;
        cursor: pointer;
        z-index: 2;
        transition: opacity 0.3s;
    }

    .movieCard:hover {
        opacity: 0.9; /* Slight transparency on hover */
    }

    /* Movie poster styles */
    .movieCover {
        width: 100%;
        height: auto;
        transition: transform 0.3s, filter 0.3s, border-radius 0.3s; /* Added border-radius transition */
        border-radius: 10px; /* Slightly rounded corners */
    }

    .movieCard:hover .movieCover {
        transform: scale(1.1);
        filter: blur(5px);
    }

    /* Add movie info card */
    .movieInfoCard {
        position: absolute;
        background-color: #131313;
        color: white;
        max-width: 300px;
        padding: 10px;
        border-radius: 5px;
        pointer-events: none;
        display: none;
        top: 0;
        left: -320px;
        transition: opacity 0.3s, left 0.3s;
        z-index: 1;
    }

    .movieCard:hover .movieInfoCard {
        display: block;
        opacity: 1;
        left: -10px;
    }

    .movieInfoCard h3 {
        font-size: 18px;
        margin: 0;
        margin-bottom: 5px;
    }

    .movieInfoCard p {
        font-size: 14px;
        margin: 0;
        max-height: 150px; /* Limit the description height */
        overflow: hidden;
    }

    /* Star rating */
    .starRating {
        color: #f1c40f;
        font-size: 18px;
    }

    /* "Watch Now" button */
    .watchButton {
        background-color: #007bff;
        color: white;
        border: none;
        border-radius: 20px;
        padding: 5px 15px;
        text-align: center;
        cursor: pointer;
        transition: 0.3s;
        margin: 10px auto; /* Center the button horizontally */
        display: block; /* Make the button a block element */
    }

    .watchButton:hover {
        background-color: #0056b3;
    }

    /* Pagination buttons */
    .pagination {
        text-align: center;
        position: fixed; /* Fixed position at the bottom */
        bottom: 20px; /* Adjust the distance from the bottom */
        left: 0;
        right: 0;
        background-color: rgba(34, 34, 34, 0.8); /* Blurred background */
        backdrop-filter: blur(10px); /* Add blur effect to background */
        padding: 10px 0; /* Adjust padding as needed */
        z-index: 3; /* Ensure buttons are on top of other content */
    }

    .pagination button {
        background-color: transparent;
        color: white;
        border: none;
        font-size: 18px; /* Decrease button font size */
        cursor: pointer;
        margin: 0 5px; /* Adjust margin for smaller buttons */
        border-radius: 5px; /* Slightly rounded corners */
        padding: 5px 10px; /* Adjust padding for smaller buttons */
        position: relative;
        z-index: 3; /* Ensure buttons are on top of movie posters */
    }

    .pagination button:hover {
        background-color: #444;
    }

    /* Center the pagination buttons */
    .pagination-centered {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Pagination button text */
    .pagination-text {
        color: white;
        font-size: 14px; /* Decrease button text font size */
        margin: 0 5px; /* Adjust margin for smaller buttons */
    }

::-webkit-scrollbar {
            width: 10px; /* Adjust the width */
        }

        /* Customize the thumb */
        ::-webkit-scrollbar-thumb {
            background: #525252; /* Change the thumb color */
            border-radius: 10px; /* Add rounded corners */
        }

        /* Customize the track */
        ::-webkit-scrollbar-track {
            background: #0d0d0d; /* Change the track color */
        }
</style>


</head>
<body>

    <div id="movieContainer">
        <!-- Movie covers and info will be dynamically added here -->
    </div>

    <!-- Pagination buttons -->
    <div class="pagination pagination-centered">
        <button id="prevPage" class="pagination-button"><i class="fas fa-chevron-left"></i> Previous Page</button>
        <button id="nextPage" class="pagination-button">Next Page <i class="fas fa-chevron-right"></i></button>
    </div>
    
    
    
<script>
const movieContainer = document.getElementById("movieContainer");
let currentPage = 0x1;
async function fetchMovies(_0x21b14d) {
  try {
    const _0x4c5b52 = await fetch("https://9streams.xyz/apis/tmdb.php?path=trending/movie/week" + "?page=" + _0x21b14d);
    const _0x328b41 = await _0x4c5b52.json();
    const _0x6b8764 = _0x328b41.results;
    movieContainer.innerHTML = '';
    _0x6b8764.forEach(_0x575a09 => {
      const _0x147d2e = document.createElement("div");
      _0x147d2e.className = 'movieCard';
      const _0x5bfcdb = document.createElement("img");
      _0x5bfcdb.className = "movieCover";
      _0x5bfcdb.src = 'https://image.tmdb.org/t/p/w500' + _0x575a09.poster_path;
      const _0x28d49f = document.createElement("div");
      _0x28d49f.className = "movieInfoCard";
      _0x28d49f.innerHTML = "\n                        <h3>" + _0x575a09.title + "</h3>\n                        <div class=\"starRating\">" + getStarRating(_0x575a09.vote_average) + "</div>\n                        <p>" + _0x575a09.overview.substring(0x0, 0x96) + (_0x575a09.overview.length > 0x96 ? "..." : '') + "</p>\n                        <button class=\"watchButton\" onclick=\"window.location.href = 'https://9streams.xyz/movie/default?movie=" + _0x575a09.id + "'\">Watch Now</button>\n                    ";
      _0x147d2e.addEventListener("click", () => {
        window.location.href = 'https://9streams.xyz/movie/default?movie=' + _0x575a09.id;
      });
      _0x147d2e.appendChild(_0x28d49f);
      _0x147d2e.appendChild(_0x5bfcdb);
      movieContainer.appendChild(_0x147d2e);
    });
  } catch (_0xc20455) {
    console.error("Error fetching data:", _0xc20455);
  }
}
fetchMovies(currentPage);
document.getElementById("nextPage").addEventListener("click", () => {
  currentPage++;
  fetchMovies(currentPage);
});
document.getElementById("prevPage").addEventListener('click', () => {
  if (currentPage > 0x1) {
    currentPage--;
    fetchMovies(currentPage);
  }
});
function getStarRating(_0x4babec) {
  const _0x23e66d = _0x4babec / 0xa * 0x5;
  let _0x5cb9dd = '';
  for (let _0x5c8de0 = 0x0; _0x5c8de0 < 0x5; _0x5c8de0++) {
    if (_0x5c8de0 < _0x23e66d) {
      _0x5cb9dd += "<i class=\"fas fa-star\"></i>";
    } else {
      _0x5cb9dd += "<i class=\"far fa-star\"></i>";
    }
  }
  return _0x5cb9dd;
}
const sideNav = document.getElementById("sideNav");
const menuToggle = document.getElementById("menuToggle");
menuToggle.addEventListener("click", () => {
  sideNav.classList.toggle("show");
});
if (window.location.hostname !== "9streams.xyz" || window.location.protocol === "file:") {
  window.location.href = "https://9streams.xyz";
}
</script>
</body>
</html>