<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Movies</title>
    <link rel="icon" href="fire.png" type="image/png">
    <style>
        body {
            margin: 0;
            padding: 0;
            background: url('background.jpg') no-repeat center center fixed;
            background-size: cover;
            font-family: Arial, sans-serif;
            color: white;
            user-select: none; 
        }

        .search-container {
            position: fixed;
            top: 10px;
            right: 20px;
            z-index: 10;
        }

        .search-container input {
            padding: 10px;
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }

        .movies-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 20px;
            padding: 20px;
            margin-top: 100px; /* move below search bar */
        }

        .movie {
            display: flex;
            align-items: center;
            background: rgba(255, 255, 255, 0.1);
            padding: 10px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
            transition: transform 0.3s, box-shadow 0.3s;
            cursor: pointer;
            width: 200px; /* Adjusted size */
            text-align: center;
            position: relative; /* For positioning info box */
        }

        .movie:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
        }

        .movie img {
            width: 100px;
            height: 150px;
            border-radius: 10px;
            margin-bottom: 10px;
        }

        .movie span {
            font-size: 18px;
        }

        .movie-info {
            display: none;
        }

        /* Modal style */
        #videoModal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            z-index: 9999;
            justify-content: center;
            align-items: center;
        }

        #videoModal div {
            position: relative;
            width: 80%;
            max-width: 800px;
            background: #000;
            border-radius: 10px;
            overflow: hidden;
        }

        #videoModal iframe {
            width: 100%;
            height: 450px;
            border: none;
        }

        #videoModal button {
            position: absolute;
            top: 10px;
            right: 10px;
            background: #fff;
            color: #000;
            border: none;
            border-radius: 5px;
            padding: 5px 10px;
            cursor: pointer;
        }

        /* Corrected movie-info positioning */
        .movie-info {
            position: absolute;
            top: 160px;
            left: 0;
            background: rgba(0, 0, 0, 0.8);
            padding: 10px;
            border-radius: 5px;
            text-align: left;
            width: 180px;
            box-sizing: border-box;
        }
    </style>
</head>
<body>
    <!-- Search bar -->
    <div class="search-container">
        <input type="text" id="search" placeholder="Search movies..." oninput="filterMovies()">
    </div>

    <div class="movies-container" id="movies">
        <div class="movie" onmouseover="showInfo(this, ''')"
            onmouseout="hideInfo(this)" onclick="showMovie('https://drive.google.com/file/d/1r1oGq0tE2tTOmlKXmDVSxAl--nI5Gnbn/preview')">
            <img src="terrifer3.jpg" alt="Terrifier 3">
            <span>Terrifier 3 ქართულად</span>
            <div class="movie-info"></div>
        </div>
        <div class="movie" onmouseover="showInfo(this, ''')"
            onmouseout="hideInfo(this)" onclick="showMovie('https://drive.google.com/file/d/1ECQ6dncykLv1tFg8ziaHaqz68qcCIpIP/preview')">
            <img src="mufasa.jpg" alt="Mufasa: The Lion King">
            <span>Mufasa ქართულად</span>
            <div class="movie-info"></div>
        </div>
        <div class="movie" onmouseover="showInfo(this, ''')"
            onmouseout="hideInfo(this)" onclick="showMovie('https://drive.google.com/file/d/1H5kodHbJoqgYTxeBtq5mPGm9Mr6XHQtm/preview')">
            <img src="venom.jpg" alt="Venom 3">
            <span>Venom 3 ქართულად</span>
            <div class="movie-info"></div>
        </div>
        <div class="movie" onmouseover="showInfo(this, ''')"
            onmouseout="hideInfo(this)" onclick="showMovie('https://drive.google.com/file/d/1tp4mLiMhr8KEIrm7loD9YmbTttP36INL/preview')">
            <img src="yourfault.jpg" alt="Your Fault">
            <span>Your Fault ქართულად</span>
            <div class="movie-info"></div>
        </div>
        <div class="movie" onmouseover="showInfo(this, ')"
            onmouseout="hideInfo(this)" onclick="showMovie('https://drive.google.com/file/d/1sxqmkuGxwoWJAgcYbNKbA54QYUWkjj5x/preview')">
            <img src="redone.jpg" alt="RedOne">
            <span>RedOne ქართულად</span>
            <div class="movie-info"></div>
        </div>
        <!-- New Movies Added -->
        <div class="movie" onmouseover="showInfo(this, ')"
            onmouseout="hideInfo(this)" onclick="showMovie('https://drive.google.com/file/d/1A4Ja2rSJYyuwYvCnnIQG06MFBRtjA7-e/preview')">
            <img src="smile.jpg" alt="The Flash">
            <span>Smile 2 ქართულად</span>
            <div class="movie-info"></div>
        </div>
        <div class="movie" onmouseover="showInfo(this, ')"
            onmouseout="hideInfo(this)" onclick="showMovie('https://drive.google.com/file/d/1iygVZdS6kY_lAbXQ1TMRQP22ZXFzJAzu/preview')">
            <img src="migration.jpg" alt="The Hunger Games">
            <span>Migration ქართულად</span>
            <div class="movie-info"></div>
        </div>
        <div class="movie" onmouseover="showInfo(this, ')"
            onmouseout="hideInfo(this)" onclick="showMovie('https://drive.google.com/file/d/1NGwf8313XvMCPzXo-2Yqot_cYx6tk3F3/preview')">
            <img src="joker.jpg" alt="კალმარის თამაშები">
            <span>Jocker 2 ქართულად</span>
            <div class="movie-info"></div>
        </div>
    </div>

    <!-- Modal for movie -->
    <div id="videoModal">
        <div>
            <iframe id="videoFrame" src="" allow="autoplay" allowfullscreen></iframe>
            <button onclick="closeModal()">Close</button>
        </div>
    </div>

    <script>
        // Movie search functionality
        function filterMovies() {
            const searchValue = document.getElementById('search').value.toLowerCase();
            const movies = document.querySelectorAll('.movie');
            movies.forEach(movie => {
                const title = movie.querySelector('span').textContent.toLowerCase();
                movie.style.display = title.includes(searchValue) ? 'flex' : 'none';
            });
        }

        // Show movie in modal
        function showMovie(url) {
            const modal = document.getElementById('videoModal');
            const frame = document.getElementById('videoFrame');
            frame.src = url;
            modal.style.display = 'flex';
        }

        // Close the modal
        function closeModal() {
            const modal = document.getElementById('videoModal');
            const frame = document.getElementById('videoFrame');
            frame.src = ''; // Stop video
            modal.style.display = 'none';
        }

        // Show additional movie information on hover
        function showInfo(element, title, rating, year, director, description) {
            const infoBox = element.querySelector('.movie-info');
            infoBox.innerHTML = ` 
                <strong>${title}</strong><br>
                <strong>IMDb:</strong> ${rating}<br>
                <strong>${director}</strong><br>
                <small>${description}</small>
            `;
            infoBox.style.display = 'block';
        }

        // Hide movie information on mouse out
        function hideInfo(element) {
            const infoBox = element.querySelector('.movie-info');
            infoBox.style.display = 'none';
            infoBox.innerHTML = ''; // Clear content
        }
    </script>
</body>
</html>