body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #121212;
    color: #e0e0e0;
}

/* Main site scrollbar styling */
body::-webkit-scrollbar {
    width: 10px; /* Wider scrollbar for better visibility */
}

body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1); /* Light transparent track */
    border-radius: 5px; /* Rounded track edges */
}

body::-webkit-scrollbar-thumb {
    background: #444; /* Dark gray scrollbar thumb */
    border-radius: 5px; /* Rounded thumb edges */
}

body::-webkit-scrollbar-thumb:hover {
    background: #666; /* Lighter gray on hover */
}

body {
    scrollbar-width: thin; /* For Firefox: thin scrollbar */
    scrollbar-color: #444 rgba(255, 255, 255, 0.1); /* Thumb and track colors */
}

body.popup-open {
    overflow: hidden; /* Disable background scrolling */
}

.container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.card {
    background-color: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    width: 200px;
    text-align: center;
    position: relative;
    padding: 10px; /* Added padding for better spacing */
}

.card img {
    width: 100%;
    height: auto;
}

.card-title {
    padding: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #e0e0e0;
}

.badge {
    display: inline-block;
    margin: 10px 0;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background-color: #007bff;
    border-radius: 12px;
    text-transform: uppercase;
}

.card-separator {
    height: 1px;
    background-color: #333;
    margin: 10px 0;
}

.card-release-date {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 10px;
}

.search-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px auto;
    max-width: 800px; /* Adjusted for better alignment */
    padding: 0 20px; /* Added padding for space on both sides */
}

.search-bar input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #1e1e1e;
    color: #e0e0e0;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-bar input:focus {
    border-color: #007bff;
}

.search-bar button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-bar button:hover {
    background-color: #0056b3;
}

#load-more {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#load-more:hover {
    background-color: #0056b3;
}

.filter-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #1e1e1e;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    min-width: 150px;
}

.filter-options label {
    display: block;
    margin-bottom: 5px;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
}

.filter-options input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.filter-options input[type="number"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #1e1e1e;
    color: #e0e0e0;
    outline: none;
    font-size: 14px;
    margin-top: 5px;
    box-sizing: border-box;
}

.filter-options input[type="number"]::placeholder {
    color: #aaa;
}

.filter-dropdown:hover .filter-options {
    display: block;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Fallback dark background */
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden; /* Prevent background scroll */
    background-size: cover; /* Ensure backdrop covers the entire popup */
    background-position: center; /* Center the backdrop */
    background-repeat: no-repeat; /* Prevent tiling */
}

body.popup-open {
    overflow: hidden; /* Disable background scroll when popup is open */
}

.popup {
    background-color: #1e1e1e;
    padding: 30px 28px; /* Increased left/right padding */
    border-radius: 12px;
    width: 400px;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.7);
    position: relative;
    animation: fadeIn 0.3s ease-in-out;
    box-sizing: border-box; /* Ensure padding is included in width */
}

.popup h2 {
    color: #e0e0e0;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: bold;
}

.popup input {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #444;
    border-radius: 6px;
    background-color: #121212;
    color: #e0e0e0;
    outline: none;
    font-size: 16px;
    box-sizing: border-box; /* Prevent overflow */
}

.popup button {
    width: 100%; /* Make button full width for better alignment */
    padding: 12px 0;
    border: none;
    border-radius: 6px;
    background-color: #007bff;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 0;
    box-sizing: border-box;
}

.popup button:not(.popup-close) {
    width: 100%;
}

.popup button:hover {
    background-color: #0056b3;
}

.popup-close {
    position: absolute;
    top: 10px; /* Adjusted for better alignment */
    right: 10px; /* Adjusted for better alignment */
    width: 30px;
    height: 30px;
    background: #ff4d4d; /* Updated for better visibility */
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s;
}

.popup-close:hover {
    background: #cc0000; /* Darker red on hover */
}

.popup-content {
    background-color: rgba(30, 30, 30, 0.9); /* Semi-transparent background for content */
    background-size: cover; /* Ensure backdrop covers the popup content */
    background-position: center; /* Center the backdrop */
    background-repeat: no-repeat; /* Prevent tiling */
    padding: 0; /* Remove unnecessary padding */
    border-radius: 8px;
    width: 400px;
    max-height: 80vh; /* Limit height for scrollability */
    overflow-y: auto; /* Enable vertical scrolling */
    text-align: center;
    color: #e0e0e0;
    position: relative; /* Ensure inner content is positioned correctly */
}

/* Popup content scrollbar styling */
.popup-content::-webkit-scrollbar {
    width: 8px; /* Narrow scrollbar width */
}

.popup-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1); /* Light transparent track */
    border-radius: 4px; /* Rounded track edges */
}

.popup-content::-webkit-scrollbar-thumb {
    background: #007bff; /* Blue scrollbar thumb */
    border-radius: 4px; /* Rounded thumb edges */
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: #0056b3; /* Darker blue on hover */
}

.popup-content {
    scrollbar-width: thin; /* For Firefox: thin scrollbar */
    scrollbar-color: #007bff rgba(255, 255, 255, 0.1); /* Thumb and track colors */
}

/* Modern scrollbar styling */
.popup-content::-webkit-scrollbar {
    width: 8px; /* Narrow scrollbar width */
}

.popup-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1); /* Light transparent track */
    border-radius: 4px; /* Rounded track edges */
}

.popup-content::-webkit-scrollbar-thumb {
    background: #007bff; /* Blue scrollbar thumb */
    border-radius: 4px; /* Rounded thumb edges */
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: #0056b3; /* Darker blue on hover */
}

.popup-content {
    scrollbar-width: thin; /* For Firefox: thin scrollbar */
    scrollbar-color: #007bff rgba(255, 255, 255, 0.1); /* Thumb and track colors */
}

.popup-inner {
    background-color: rgba(0, 0, 0, 0.7); /* Add a dark overlay for better readability */
    padding: 20px; /* Add padding inside the inner content */
    border-radius: 8px;
    box-sizing: border-box; /* Ensure padding is included in width */
}

.popup-content img {
    width: 70%; /* Reduced size for better layout */
    border-radius: 8px;
    margin-bottom: 15px;
}

.popup-content h2 {
    margin-bottom: 15px;
    font-size: 20px; /* Slightly smaller for better layout */
    color: #fff;
}

.popup-content p {
    margin: 5px 0;
    font-size: 14px;
}

.popup-content .dropdown {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.popup-content select {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #444;
    background-color: #2a2a2a;
    color: #fff;
}

.popup-content button {
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
}

.popup-content button:hover {
    background-color: #0056b3;
}

.imdb-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #f5c518; /* IMDb yellow */
    color: #000; /* Black text for contrast */
    font-size: 12px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
    z-index: 1;
    cursor: pointer; /* Make it clickable */
}

.imdb-badge:hover {
    opacity: 0.8; /* Slight hover effect */
}

.share-button {
    margin-top: 15px;
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    background-color: #007bff;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}

.share-button:hover {
    background-color: #0056b3;
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff4d4d;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: none; /* Initially hidden */
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.search-clear:hover {
    background: #cc0000;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-bar {
        flex-direction: column;
        gap: 10px;
        max-width: 100%;
        padding: 0 10px;
    }

    .search-bar input {
        width: 100%;
        border-radius: 4px;
    }

    .search-bar button {
        width: 100%;
        border-radius: 4px;
    }

    .container {
        padding: 10px;
        gap: 15px;
    }

    .card {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .popup {
        width: 90%;
        max-width: 350px;
    }
}

@media (max-width: 480px) {
    .container {
        justify-content: space-between; /* Ensure space between cards */
    }

    .card {
        width: 48%; /* Adjusted to allow two cards per row */
        margin: 0 auto;
    }

    .search-bar {
        gap: 8px;
    }

    .popup {
        padding: 20px;
    }
}

/* Hide the number input spinner */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
}
