body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background-color: #141414;
    color: #fff;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 4%;
    background-color: #141414;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #333;
}

nav .logo svg {
    height: 30px; 
    width: auto;
}

nav .logo text {
    fill: #e50914; 
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    margin: 0 10px;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #e50914;
}

.legal-dropdown {
    position: relative;
    display: inline-block;
}

.legal-dropdown .dropdown-content {
    display: none;
    position: absolute;
    background-color: #222;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    left: 0;
    padding: 10px 0;
    border-radius: 5px;
}

.legal-dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    display: block;
    text-align: left;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: #333;
    color: #e50914;
}

.search-container {
    display: flex;
    align-items: center;
}

#search-input {
    padding: 8px 15px;
    border: 1px solid #333;
    border-radius: 20px;
    background-color: #222;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

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

#search-input:focus {
    border-color: #e50914;
}

#search-button {
    background-color: #e50914;
    border: none;
    border-radius: 20px;
    padding: 8px 12px;
    margin-left: 10px;
    cursor: pointer;
    color: #fff;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

#search-button:hover {
    background-color: #ff0b1a;
}

/* Hero section */
.hero {
    position: relative;
    height: 60vh;
    background: url('https://image.tmdb.org/t/p/original/rM6N30eK1L71jH2D9yS9jB3P0Vb.jpg') no-repeat center center/cover; 
    display: flex;
    align-items: center;
    color: #fff;
    padding: 0 4%;
    margin-bottom: 30px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(20, 20, 20, 1), rgba(20, 20, 20, 0) 50%, rgba(20, 20, 20, 1) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 500px;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
}

.hero-buttons button {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.hero-buttons .play-btn {
    background-color: #e50914;
    color: #fff;
}

.hero-buttons .play-btn:hover {
    background-color: #ff0b1a;
}

.hero-buttons .info-btn {
    background-color: rgba(109, 109, 110, 0.7);
    color: #fff;
}

.hero-buttons .info-btn:hover {
    background-color: rgba(109, 109, 110, 0.9);
}

/* Movies container */
.movies-container {
    padding: 0 4%;
    display: grid;
    --movie-card-min-width: 150px; 
    grid-template-columns: repeat(auto-fill, minmax(var(--movie-card-min-width), 1fr));
    gap: 15px;
}

/* New style for individual movie cards */
.movie-card {
    background-color: #181818;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    display: flex; /* Use flex to align content */
    flex-direction: column; /* Stack image and title vertically */
    height: 100%; /* Ensure cards in a row have similar height */
}

.movie-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.movie-card img {
    width: 100%;
    aspect-ratio: 2 / 3; 
    object-fit: cover;
    border-bottom: 1px solid #333;
}

.movie-card h3 {
    font-size: 0.9rem;
    padding: 10px;
    margin: 0;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 30px;
    font-size: 1.2rem;
    color: #aaa;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #e50914;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Modals --- */
.modal-overlay {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 2000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.8); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #181818;
    margin: auto;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 700px; /* Slightly wider for movie details */
    position: relative;
    color: #fff;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-height: 90vh; /* Limit height for scrollability */
    overflow-y: auto; /* Allow scrolling inside modal content */
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.close-btn:hover,
.close-btn:focus {
    color: #fff;
    text-decoration: none;
}

.modal-body h2 {
    color: #e50914;
    margin-bottom: 20px;
    font-size: 2rem;
}

.modal-body .overview {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.modal-buttons .play-btn {
    background-color: #e50914;
    color: #fff;
    padding: 10px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.modal-buttons .play-btn:hover {
    background-color: #ff0b1a;
}

/* Movie Details Modal Specific Styles */
.movie-details-content {
    max-width: 900px; /* Even wider for movie details and player */
    padding: 20px;
}

.movie-details-body .overview {
    margin-bottom: 20px;
    text-align: left;
    font-size: 1rem;
}

.movie-details-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.modal-poster {
    width: 150px;
    min-width: 150px; /* Ensure poster doesn't shrink too much */
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

.movie-details-header > div {
    flex-grow: 1;
}

#modal-title {
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 10px;
    color: #e50914;
    text-align: left;
}

#modal-genres-year {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 15px;
    text-align: left;
}

.modal-action-buttons {
    margin-top: 20px;
    text-align: center;
}

/* Video Player Container */
.movie-player-container {
    position: relative;
    width: 100%;
    /* This padding-bottom trick maintains the aspect ratio */
    /* Calculated in JS using MOVIE_PLAYER_ASPECT_RATIO (e.g., 16/9 = 56.25%) */
    padding-bottom: 56.25%; 
    height: 0;
    overflow: hidden;
    background-color: #000;
    border-radius: 8px;
    margin-top: 20px;
}

.movie-player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Utility to hide elements dynamically */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 4%;
    margin-top: 50px;
    background-color: #141414;
    border-top: 1px solid #333;
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.6;
}

footer p {
    margin: 5px 0;
}

/* Responsive adjustments for modals */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .movie-details-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .modal-poster {
        margin-bottom: 15px;
    }

    #modal-title, #modal-genres-year, .movie-details-body .overview {
        text-align: center;
    }

    #modal-title {
        font-size: 2rem;
    }
}