/* General Body and Container Styles - Dark Theme (IMDb-like blue-grey) */
body {
    font-family: 'Inter', sans-serif;
    background-color: #0b0e13;
    /* Very dark blue-grey for general app background */
    color: #e0e0e0;
    /* Light text color */
    display: flex;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow-x: hidden;
    /* Prevent horizontal scroll when sidebar is off-screen */
}

/* Main layout with sidebar and content */
.app-container {
    display: flex;
    width: 100%;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background-color: #05070a;
    /* Even darker blue-grey for sidebar */
    padding: 25px 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    /* Stronger shadow */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    /* Prevent shrinking */
    z-index: 10;
    position: relative;
    /* Default position for desktop */
    transition: transform 0.3s ease-in-out;
    /* Smooth transition for mobile slide */
}

.sidebar h2 {
    color: #f0f0f0;
    font-size: 1.5em;
    padding: 0 25px 20px;
    margin-top: 0;
    border-bottom: 1px solid #1a1e24;
    /* Darker blue-grey border */
    margin-bottom: 20px;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li {
    padding: 12px 25px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 1.05em;
    border-left: 4px solid transparent;
    /* For active state, adjusted to 4px */
}

.sidebar ul li:hover:not(.active) {
    background-color: #1a1e24;
    /* Darker blue-grey hover */
    color: #ffffff;
}

.sidebar ul li.active {
    background-color: #11141a;
    /* Darker active blue-grey */
    color: #4a90e2;
    /* Muted blue for active genre */
    font-weight: bold;
    border-left-color: #4a90e2;
    /* Adjusted to 4px */
    border-left-width: 4px;
    /* Ensure the width is explicitly set */
}

/* New styles for primary navigation items (Movies, TV Shows) */
.sidebar .primary-nav-item {
    padding: 15px 25px;
    font-size: 1.2em;
    font-weight: bold;
    color: #f0f0f0;
    border-bottom: 1px solid #1a1e24;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar .primary-nav-item:hover {
    background-color: #1a1e24;
    color: #ffffff;
}

.sidebar .primary-nav-item.active {
    color: #4a90e2;
    background-color: #11141a;
    border-left-color: #4a90e2;
    /* Match genre active style */
    border-left-width: 4px;
    /* Ensure the width is explicitly set */
}

/* Adjust genre list padding when nested */
.sidebar .genre-list-nested {
    padding-left: 20px;
    /* Indent genres under primary nav */
    margin-top: 10px;
    /* Space from primary item */
    border-bottom: none;
    /* Remove duplicate border */
    padding-bottom: 0;
}

.sidebar .genre-list-nested li {
    font-size: 0.95em;
    /* Slightly smaller font for nested genres */
    padding: 8px 25px;
    /* Adjust padding */
}


/* Main Content Area */
.main-content {
    flex-grow: 1;
    /* Take remaining space */
    padding: 25px 35px;
    display: flex;
    flex-direction: column;
    position: relative;
    /* For absolute positioning of detail page */
    background-color: #11141a;
    /* Slightly lighter blue-grey for contrast */
    transition: margin-left 0.3s ease-in-out;
    /* For shifting content on desktop if sidebar hidden */
}

/* Header / Search Bar */
.header {
    display: flex;
    flex-direction: row;
    /* Default to row on desktop */
    align-items: center;
    /* Align items vertically in the center */
    justify-content: space-between;
    /* Distribute items with space between them */
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #1a1e24;
    flex-wrap: nowrap;
    /* Prevent wrapping on desktop */
    gap: 20px;
    /* Space between the main header sections */
}

/* New container for hamburger and mobile credit - hidden on desktop */
.hamburger-menu-and-mobile-credit {
    display: none;
}

.logo {
    font-size: 2em;
    font-weight: bold;
    color: #4a90e2;
    /* Muted blue logo */
    text-shadow: 1px 1px 3px rgba(74, 144, 226, 0.3);
    flex-shrink: 0;
}

.header-buttons {
    display: flex;
    gap: 15px;
    /* Space between buttons */
    align-items: center;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.header-button {
    background-color: #1e212b;
    /* Dark background */
    color: #e0e0e0;
    border: none;
    border-radius: 25px;
    /* Rounded pill shape */
    padding: 8px 15px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    /* Space between icon and text */
    white-space: nowrap;
    /* Prevent text wrapping */
}

.header-button:hover {
    background-color: #2a2e3a;
    color: #ffffff;
}

.header-button.active {
    background-color: #4a90e2;
    /* Muted blue for active state */
    color: white;
}

.search-bar {
    position: relative;
    width: 300px;
    /* Fixed width on desktop */
    flex-shrink: 0;
    /* Prevent shrinking on desktop */
    padding: 10px 15px 10px 40px;
    /* Input styling handled by input within */
    border-radius: 25px;
    background-color: #272a35;
    color: #e0e0e0;
    font-size: 1em;
    box-sizing: border-box;
    margin-left: auto;
    /* Push to the right on desktop */
}

.search-bar input {
    width: 100%;
    padding: 0;
    /* Reset inner input padding */
    border: none;
    background-color: transparent;
    color: inherit;
    font-size: inherit;
    outline: none;
}

.search-bar input::placeholder {
    color: #777;
    /* Darker placeholder */
}

.search-bar input:focus {
    background-color: #333642;
    outline: none;
}

.search-bar .fa-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #777;
}

/* Hamburger menu for mobile */
.hamburger-menu {
    display: none;
    /* Hidden by default on desktop */
    font-size: 1.8em;
    color: #f0f0f0;
    cursor: pointer;
    padding: 5px;
    z-index: 10;
    /* Ensure it's clickable */
    flex-shrink: 0;
}

/* Close button for mobile sidebar */
.sidebar .close-sidebar-btn {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.8em;
    color: #f0f0f0;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
    z-index: 101;
    /* Above sidebar content */
}

/* Credit links styling */
.desktop-credit-link,
.mobile-credit-link,
.sidebar-credit-link {
    font-size: 0.9em;
    color: #777;
    /* Muted color */
    white-space: nowrap;
    /* Keep on one line */
    flex-shrink: 0;
}

.desktop-credit-link a,
.mobile-credit-link a,
.sidebar-credit-link a {
    color: #4a90e2;
    /* Blue like the logo */
    text-decoration: none;
    transition: color 0.2s ease;
}

.desktop-credit-link a:hover,
.mobile-credit-link a:hover,
.sidebar-credit-link a:hover {
    color: #72aae6;
}

/* Default state: Desktop credit visible, mobile hidden */
.desktop-credit-link {
    display: block;
    /* Visible on desktop */
    margin: 0 auto;
    /* Centers it horizontally within remaining space */
    flex-grow: 1;
    /* Allows it to take available space */
    text-align: center;
    /* Center the text */
}

.mobile-credit-link {
    display: none;
    /* Hidden on desktop */
}

/* Sidebar credit link specific styling */
.sidebar-credit-link {
    font-size: 0.85em;
    color: #777;
    margin-top: 30px;
    /* Space from elements above */
    padding: 0 25px;
    /* Match sidebar padding */
    text-align: center;
    flex-grow: 1;
    /* Push to bottom if space allows */
    display: flex;
    /* Use flex to align content */
    align-items: flex-end;
    /* Align to the bottom of the sidebar if there's extra space */
    justify-content: center;
}

.sidebar-credit-link a {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.sidebar-credit-link a:hover {
    color: #c90a3d;
    /* Your theme color */
}



/* Movie Listing Section */
.movie-listing-section {
    display: block;
}

.movie-listing-section h2 {
    color: #f0f0f0;
    font-size: 1.8em;
    margin-bottom: 25px;
    text-align: left;
}

/* Specific styling for 'You May Also Like' heading */
.movie-listing-section.you-may-also-like-section h2,
.user-list-page h2 {
    /* Also apply to user list grid */
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 25px;
}


#movieGrid,
.user-list-grid {
    /* Apply grid styles to user list grid as well */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding-bottom: 30px;
}

.movie-card {
    background-color: #1e212b;
    /* Darker card background */
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
    /* Stronger shadow */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
}

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

.movie-card img {
    width: 100%;
    height: 270px;
    object-fit: cover;
    border-bottom: 1px solid #2a2e3a;
    background-color: #2a2e3a;
}

.movie-card .info {
    padding: 10px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.movie-card h3 {
    font-size: 1.1em;
    margin: 5px 0;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

.movie-card .rating-year {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #aaa;
    /* Slightly darker */
    margin-top: 5px;
}

.movie-card .rating-year .fa-star {
    color: #f39c12;
}

.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #4a90e2;
    /* Muted blue spinner */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.placeholder-message {
    grid-column: 1 / -1;
    text-align: center;
    font-style: italic;
    color: #777;
    padding: 20px;
}

/* Load More Button */
.load-more-container {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.load-more-button {
    background-color: #c90a3d;
    /* Reddish-purple from image */
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    /* More rounded */
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.load-more-button:hover {
    background-color: #9b0830;
    transform: translateY(-2px);
}

.load-more-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Movie Detail Page Styles */
.movie-detail-page {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    /* Changed to transparent, JavaScript will set image */
    overflow-y: auto;
    background-size: cover;
    background-position: center;
    transition: background-image 0.5s ease-in-out;
    position: relative;
}

/* Overlay for detail page background */
.movie-detail-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    /* Dark overlay to match IMDb, slightly more transparent */
    backdrop-filter: blur(20px);
    /* Blur effect */
    z-index: 1;
    /* Below content but above background image */
}

.detail-content-wrapper {
    position: relative;
    /* Position content above the overlay */
    z-index: 2;
    padding: 25px 35px;
    /* Apply padding here */
}

.detail-back-button {
    background: none;
    border: none;
    color: #4a90e2;
    /* Muted blue */
    font-size: 1.1em;
    cursor: pointer;
    padding: 1px 0;
    margin-bottom: -1px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1px;
    transition: color 0.2s ease;
    position: relative;
    /* To be above overlay */
    z-index: 3;
    /* Even higher z-index for button */
}

.detail-back-button:hover {
    color: #72aae6;
}

.detail-header {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
    align-items: flex-start;
    position: relative;
    /* Ensure header content is above overlay */
    z-index: 2;
}

.detail-poster {
    width: 250px;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.7);
    /* Darker shadow */
    flex-shrink: 0;
}

.detail-info {
    flex-grow: 1;
    text-align: left;
}

.detail-info h1 {
    font-size: 2.8em;
    margin-top: 0;
    margin-bottom: 10px;
    color: #f0f0f0;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1em;
    color: #bbb;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.detail-meta .rating {
    color: #f39c12;
    font-weight: bold;
}

.detail-plot {
    font-size: 1.1em;
    line-height: 1.6;
    color: #e0e0e0;
    margin-bottom: 25px;
}

.detail-cast-director {
    margin-bottom: 25px;
}

.detail-cast-director p {
    margin: 8px 0;
    font-size: 1em;
    color: #ccc;
}

.detail-cast-director strong {
    color: #f0f0f0;
    font-weight: bold;
}

/* Movie Detail Action Buttons */
.detail-action-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.detail-action-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #1e212b;
    /* Dark background for circular buttons, matches cards */
    color: #e0e0e0;
    font-size: 1.2em;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 1px solid #2a2e3a;
    /* Subtle border */
}

.detail-action-button:hover {
    background-color: #2a2e3a;
    transform: translateY(-2px);
}

.detail-action-button.active {
    /* Class for active state */
    background-color: #4a90e2;
    /* Muted blue for active, consistent with genre highlight */
    color: white;
    border-color: #4a90e2;
}

.detail-action-button.play-trailer-button {
    border-radius: 25px;
    /* Pill shape */
    padding: 0 20px;
    width: auto;
    /* Auto width */
    background-color: #c90a3d;
    /* Reddish-purple from image */
    font-weight: bold;
    font-size: 1em;
    gap: 8px;
    /* Space between icon and text */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.detail-action-button.play-trailer-button:hover {
    background-color: #9b0830;
}


.trailer-section h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #f0f0f0;
    border-bottom: 1px solid #333642;
    padding-bottom: 10px;
}

/* Reuse movie-listing-section and #movieGrid for "You May Also Like" */
.you-may-also-like-detail {
    margin-top: 40px;
    position: relative;
    /* Ensure this section is above the overlay */
    z-index: 2;
}

/* Styling for the grid within the detail page's "You May Also Like" section */
#detailYouMayAlsoLikeGrid {
    display: flex;
    /* Changed from grid to flex */
    flex-wrap: nowrap;
    /* Prevent wrapping */
    overflow-x: auto;
    /* Enable horizontal scrolling */
    gap: 20px;
    /* Consistent spacing */
    padding-bottom: 30px;
    /* Maintain padding if needed for scrollbar */
    /* Add scrollbar styling for better visibility */
    scrollbar-width: thin;
    /* Firefox */
    scrollbar-color: #4a90e2 #1e212b;
    /* Thumb and Track color Firefox */
}

#detailYouMayAlsoLikeGrid::-webkit-scrollbar {
    height: 8px;
    /* Height of horizontal scrollbar */
}

#detailYouMayAlsoLikeGrid::-webkit-scrollbar-track {
    background: #1e212b;
    /* Scrollbar track color */
    border-radius: 10px;
}

#detailYouMayAlsoLikeGrid::-webkit-scrollbar-thumb {
    background-color: #4a90e2;
    /* Scrollbar thumb color */
    border-radius: 10px;
    border: 2px solid #1e212b;
    /* Padding around thumb */
}

/* Ensure movie cards within the flex container don't shrink */
#detailYouMayAlsoLikeGrid .movie-card {
    flex-shrink: 0;
    /* Prevent cards from shrinking */
    width: 180px;
    /* Maintain a consistent width for scrolling items */
}


/* User List Page Styles */
.user-list-page {
    display: none;
    /* Hidden by default */
    padding: 25px 35px;
    /* Consistent with main-content padding */
    flex-direction: column;
    /* To make h2 and grid stack */
    flex-grow: 1;
}

/* Confirmation Message */
.confirmation-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(74, 144, 226, 0.9);
    /* Muted blue background for confirmations */
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1em;
    z-index: 1000;
    /* Above everything */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.confirmation-message.show {
    opacity: 1;
    visibility: visible;
}

/* Trailer Modal Styles */
.trailer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    /* Darker overlay for video */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    /* Ensure it's on top */
    display: none;
    /* Hidden by default */
}

.trailer-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    /* Max width for the video */
    aspect-ratio: 16 / 9;
    /* Standard video aspect ratio */
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.8);
}

.trailer-modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.close-trailer-modal-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    z-index: 1001;
    /* Above iframe */
    padding: 5px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
    transition: background-color 0.2s ease;
}

.close-trailer-modal-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Overlay for mobile sidebar */
.overlay {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    /* Semi-transparent black */
    z-index: 99;
    /* Below sidebar, above main content */
}

.overlay.active {
    display: block;
    /* Show when sidebar is open */
}

/* —— Preloader Overlay —— */
#videoLoader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    /* show when “Watch” is clicked */
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    /* semi‑dark backdrop */
    z‑index: 1000;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 6px solid #444;
    /* dark track */
    border-top: 6px solid #FFC107;
    /* yellow arc */
    border-radius: 50%;
    animation: spin 20s linear forwards;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* —— Verify Pop‑Up —— */
#verifyOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    /* show after 20s */
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.9);
    /* darker backdrop */
    z‑index: 1100;
}

.verify-modal {
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    max-width: 320px;
    width: 80%;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.verify-modal h2 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    color: #222;
}

.verify-modal p {
    margin: 0 0 1rem;
    color: #555;
}

.verify-modal button {
    background: #FFC107;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    color: #222;
    border-radius: 8px;
    cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .app-container {
        flex-direction: row;
        /* Keep it row for the main content to be beside the off-screen sidebar */
        position: relative;
        /* For proper positioning of fixed sidebar */
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -250px;
        /* Hide sidebar off-screen initially */
        height: 100vh;
        /* Full viewport height */
        width: 250px;
        /* Fixed width for the sidebar */
        padding: 25px 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.8);
        z-index: 100;
        /* Ensure it's above everything else */
        background-color: #05070a;
        /* Ensure background is solid */
    }

    .sidebar.open {
        transform: translateX(250px);
        /* Slide in from left */
    }

    .sidebar .close-sidebar-btn {
        display: block;
        /* Show close button when sidebar is open */
    }

    .main-content {
        width: 100%;
        /* Take full width */
        margin-left: 0;
        /* No fixed margin on mobile */
        padding: 20px;
    }

    .header {
        /* Main header container for mobile */
        flex-direction: column;
        /* Stack top row and buttons */
        align-items: flex-start;
        /* Align contents to start */
        padding: 20px 0;
        /* Adjust padding for mobile header */
        overflow-x: hidden;
        /* Prevent main header from scrolling */
        gap: 15px;
        /* Space between header-top-row and header-buttons */
    }

    .header-top-row {
        /* New container for hamburger, credit, search for mobile */
        display: flex;
        align-items: center;
        width: 100%;
        /* Take full width */
        gap: 15px;
        /* Space between items in the top row */
        overflow-x: auto;
        /* Enable horizontal scrolling for this row */
        padding: 0 10px;
        /* Add some horizontal padding */
        padding-bottom: 5px;
        /* Space for scrollbar */
    }

    .header-top-row::-webkit-scrollbar {
        height: 5px;
    }

    .header-top-row::-webkit-scrollbar-track {
        background: #1e212b;
        border-radius: 10px;
    }

    .header-top-row::-webkit-scrollbar-thumb {
        background-color: #4a90e2;
        border-radius: 10px;
    }

    .hamburger-menu-and-mobile-credit {
        display: flex;
        /* Show this container on mobile */
        align-items: center;
        gap: 15px;
        /* Space between hamburger and credit */
    }

    .hamburger-menu {
        display: block;
        /* Ensure visible */
        flex-shrink: 0;
        /* Don't shrink */
    }

    .mobile-credit-link {
        display: block;
        /* Make credit link visible on mobile */
        flex-shrink: 0;
        /* Don't shrink */
        font-size: 0.8em;
        margin-left: 0;
        /* Reset this to allow search bar to push it */
    }

    .desktop-credit-link {
        display: none;
        /* Hide desktop credit */
    }

    .search-bar {
        flex-grow: 1;
        /* Allow search bar to grow */
        min-width: 150px;
        /* Ensure search bar is still usable if space is tight */
        margin-left: auto;
        /* Push search bar to the right, before mobile-credit-link pushes *itself* right */
    }

    .header-buttons {
        justify-content: center;
        margin-top: 0;
        /* No top margin as it's a separate row now */
        width: 100%;
        /* Ensure buttons are still full width and centered */
        flex-wrap: wrap;
        /* Allow buttons to wrap if they don't fit */
    }

    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .detail-poster {
        width: 180px;
    }

    .detail-info h1 {
        font-size: 2em;
    }

    .detail-meta {
        justify-content: center;
        gap: 10px;
    }

    .detail-plot {
        font-size: 0.95em;
    }

    .detail-cast-director p {
        text-align: center;
    }

    .movie-detail-page {
        padding: 20px;
    }

    #movieGrid,
    .user-list-grid {
        /* Apply to user list grid */
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        /* Smaller cards for mobile */
        gap: 15px;
    }

    /* IMPORTANT: The movie-card within #detailYouMayAlsoLikeGrid needs specific sizing for mobile to allow horizontal scrolling */
    #detailYouMayAlsoLikeGrid .movie-card {
        width: 140px;
        /* Smaller fixed width for mobile to ensure scrollability */
    }

    .movie-card img {
        height: 220px;
        /* Adjust image height for smaller cards */
    }

    .detail-action-buttons {
        justify-content: center;
    }

}

@media (max-width: 480px) {
    .detail-info h1 {
        font-size: 1.8em;
    }

    .detail-meta {
        font-size: 0.9em;
    }

    .detail-plot {
        font-size: 0.85em;
    }

    .trailer-modal-content {
        width: 95%;
        /* Adjust for smaller screens */
    }

    /* Further reduce general padding on very small screens */
    .main-content {
        padding: 15px;
        /* Minimal padding for main content */
    }

    .sidebar h2,
    .sidebar ul li,
    .sidebar .primary-nav-item {
        padding-left: 15px;
        padding-right: 15px;
    }

    .search-bar {
        width: 50%;
        /* Almost full width on small screens */
    }

    .sidebar-header {
        padding: 12px 20px;
    }

    .logo {
        font-size: 1.3em;
    }

    .close-sidebar-btn {
        font-size: 1.5em;
    }
}