/* Universal Box-Sizing and Margin Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body Styles */
body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #111;
  color: white;
  overflow-x: hidden;
}

/* Hide scrollbar for Webkit browsers (Chrome, Safari) */
body::-webkit-scrollbar {
  display: none;
}

/* Smooth scroll behavior for HTML */
html {
  scroll-behavior: smooth;
  overflow-y: scroll;
}

/* Row (Movie/TV Show Rows on Homepage) */
.row {
  color: white;
  margin-left: 20px;
  position: relative;
  margin-bottom: 20px;
}

/* Row Posters Container */
.row__posters {
  display: flex;
  overflow-x: scroll;
  padding: 20px;
  position: relative;
}

/* Hide scrollbar for row posters */
.row__posters::-webkit-scrollbar {
  display: none;
}

/* NEW/MODIFIED: Movie Card Container (This now defines the size of each poster slot) */
.movie-card {
  position: relative;
  width: 200px;
  flex-shrink: 0;
  height: 300px;
  margin-right: 10px;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 450ms ease;
}

.movie-card:hover {
  transform: scale(1.08);
}

/* MODIFIED: Individual Movie/TV Show Poster (should fill its parent .movie-card) */
.row__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  transition: transform 450ms ease;
}

/* NEW: Reset poster transform on card hover if the main scale is on .movie-card */
.movie-card:hover .row__poster {
  transform: scale(1);
}


/* Large Posters (e.g., for Netflix Originals row) - Keep if used for different size cards */
.row__posterLarge {
  max-height: 250px;
  width: auto;
}

/* If .row__posterLarge is applied directly to the img, keep its specific hover */
.row__posterLarge:hover {
  transform: scale(1.09);
}


/* Banner Section */
.banner {
  background-size: cover;
  background-position: center center;
  color: white;
  object-fit: contain;
  height: 500px;
  position: relative;
  overflow: hidden;
}

.banner__contents {
  margin-left: 30px;
  padding-top: 140px;
  height: 190px;
  position: relative;
  z-index: 2;
}

.banner__title {
  font-size: 3rem;
  font-weight: 900;
  padding-bottom: 0.2rem;
}

.banner__description {
  width: 45rem;
  line-height: 1.5;
  padding-top: 1rem;
  font-size: 0.8rem;
  max-width: 380px;
  height: 100px;
}

/* Responsive Banner Description and Title */
@media (max-width: 768px) {
  .banner__title {
    font-size: 2.5rem;
  }

  .banner__description {
    width: 90%;
    font-size: 0.8rem;
    max-width: none;
    height: auto;
    padding-top: 1.5rem;
  }
}

@media (max-width: 480px) {
  .banner__title {
    font-size: 2rem;
  }

  .banner__description {
    width: 100%;
    font-size: 0.8rem;
    height: auto;
    padding-top: 1.5rem;
  }
}

/* Banner Buttons (Play, My List) */
.banner__button {
  cursor: pointer;
  color: #fff;
  outline: none;
  border: none;
  font-weight: 700;
  border-radius: 0.2vw;
  padding-left: 2rem;
  padding-right: 2rem;
  margin-right: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  background-color: rgba(51, 51, 51, 0.5);
}

.banner__button:hover {
  color: #000;
  background-color: #e6e6e6;
  transition: all 0.2s;
}

/* Banner Fade Effect */
.banner--fadeBottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 7.4rem;
  background-image: linear-gradient(180deg, transparent, rgba(37, 37, 37, 0.61), #111);
  z-index: 3;
}

/* Row Arrow Buttons (Prev/Next) */
.arrow-buttons {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  width: 100%;
  z-index: 1;
}

.arrow-button {
  background-color: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  padding: 10px;
  cursor: pointer;
  font-size: 2rem;
  border-radius: 50%;
}

.arrow-button.prev {
  left: 10px;
}

.arrow-button.next {
  right: 10px;
}

.arrow-button:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.arrow-button i {
  pointer-events: none;
  font-size: 1.5rem;
}

/* Top Right Icons Container */
.icons-container {
  position: fixed;
  top: 20px;
  right: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
  z-index: 999;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 10px 15px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.icon {
  font-size: 17px;
  color: white;
  cursor: pointer;
  transition: color 0.3s ease, transform 0.3s ease;
}

.icon a {
  text-decoration: none;
  color: inherit;
}

.icon:hover {
  color: #888484;
  transform: scale(1.1);
}

/* Font Awesome Icon Styling */
.fas {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
}

/* Logo Container (Top Left) */
.logo-container {
  position: fixed;
  top: 20px;
  left: 10px;
  z-index: 999;
}

.logo {
  width: 130px;
  height: auto;
  object-fit: contain;
}

/* Search Container and Bar (existing from your file, adjusted for new placement) */
.search-container { /* This might be redundant if using .search-container-top-right, but keeping it in case it's used elsewhere. */
  display: flex;
  justify-content: center;
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 0 20px;
}

#search-bar { /* This might be redundant if using #search-input. Adjust as needed. */
  width: 100%;
  max-width: 400px;
  padding: 10px;
  font-size: 16px;
  border: 2px solid #0c0c0c;
  border-radius: 5px;
  background-color: #f9fafb;
  outline: none;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}

#search-bar:focus {
  border-color: #264653;
}

/* Recommended Section */
#recommended {
  align-items: center;
  background-color: transparent;
  color: white;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
}

#recommended h2 {
  margin: 0;
  font-size: 28px;
}

/* Movie/TV Show Item Grid (for Search Results) */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 5px;
  margin-top: 5px;
}

.movie-item {
  position: relative;
  background-color: transparent;
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  transition: transform 0.3s ease;
}

.movie-item:hover {
  transform: scale(1.05);
}

.movie-item img {
  width: 70%;
  height: auto;
  border-radius: 10px;
}

/* No Results Message */
#movie-results p {
  text-align: center;
  font-size: 18px;
  color: #999;
}

/* Loading Spinner */
.loading-spinner {
  margin: 20px auto;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #da2121;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 2s linear infinite;
}

/* Keyframe for spinner animation */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.993);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #fff;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 15px;
  font-size: 15px;
  color: white;
  font-family: 'Arial', sans-serif;
}

/* Add to List Icon */
.add-to-list-icon {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 15px;
  color: white;
  background-color: rgba(179, 179, 179, 0.411);
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s, filter 0.3s;
  z-index: 2;
}

.add-to-list-icon:hover {
  background-color: rgba(87, 84, 84, 0.6);
}

.add-to-list-icon i {
  color: rgb(212, 212, 212);
  filter: none;
}

/* Global H3 Styling (for sections like "More Like This") */
h3 {
  margin: 0;
  padding: 20px 0;
  font-size: 30px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #fff;
  text-align: center;
}

/* List Icon (potentially for watchlist/favorites) - if this is different from add-to-list-icon */
.list-icon {
  position: absolute;
  top: 15px;
  right: 50px;
  font-size: 25px;
  color: white;
  background-color: rgba(92, 90, 90, 0);
  border: none;
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s, filter 0.3s;
  backdrop-filter: blur(10px);
}

.list-icon:hover {
  background-color: rgba(87, 84, 84, 0);
}

@media (max-width: 768px) {
  .list-icon {
    top: 15px;
    right: 70px;
    font-size: 18px;
  }
}

/* Floating Message (e.g., cookie consent) */
#floating-message {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background-color: #22222242;
  color: white;
  text-align: center;
  padding: 15px;
  font-size: 15px;
  z-index: 1000;
  border-radius: 20px 20px 0 0;
  width: 80%;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#floating-message button {
  background-color: #111;
  color: white;
  border: none;
  font-size: 10px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 5px;
  margin-top: 10px;
}

#floating-message button:hover {
  background-color: #000000;
}

/* Movie/TV Show Trailer Container (on Banner) */
#trailer-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

#trailer-iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
}

/* Watch Trailer section (on details page) */
.trailer-container {
  background-color: transparent;
  padding: 20px;
  border-radius: 10px;
  color: white;
  margin-top: 30px;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.trailer-title {
  font-size: 30px;
  color: white;
  margin-bottom: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* --- Details Page Styles (Unified for Movies and TV Shows) --- */

/* Blurred background for details pages */
.blurred-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000;
    background-size: cover;
    background-position: center;
    filter: blur(8px);
    z-index: -1;
}

/* Close button on details pages */
.close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2.5rem;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    transition: color 0.3s ease;
}

.close-button:hover {
    color: #e42f2f;
}

/* Main content container for details pages */
.movie-details-container,
.tv-show-details-container {
    position: relative;
    z-index: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Top section for poster, title, description, rating, year, genres, and buttons */
.top-section {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
    justify-content: center;
}

/* Poster styling */
.movie-poster-wrapper,
.tv-show-poster-wrapper {
    flex-shrink: 0;
    width: 300px;
    height: 450px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.movie-poster,
.tv-show-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Container for Title, Description, Rating, Year, Genres, and Buttons */
.info-description-watch-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex-grow: 1;
    max-width: 600px;
}

/* Title */
#movie-title,
#tv-show-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #e42f2f;
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
    text-align: left;
}

/* Description */
#movie-description,
#tv-show-description {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 20px;
    background-color: rgba(56, 55, 55, 0.644);
    padding: 20px;
    border-radius: 8px;
    text-align: justify;
    color: #eee;
}

/* Rating and Year/First Air Date container */
.rating-year-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #ccc;
}

/* Genres container */
.movie-genres-inline,
.tv-show-genres-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.genre-tag {
    background-color: rgba(228, 47, 47, 0.7);
    padding: 5px 15px;
    border-radius: 5px;
    font-size: 1rem;
    text-transform: capitalize;
    color: white;
}

/* Watch Now Button (common for movies and TV shows) */
.watch-now-btn {
    background-color: #e42f2f;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 0;
    align-self: flex-start;
}

.watch-now-btn:hover {
    background-color: #b91515;
    transform: translateY(-2px);
}

/* Season and Episode Selection (for TV shows only) */
.season-episode-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: flex-start;
}

.selection-btn {
    background-color: #e42f2f;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.selection-btn:hover {
    background-color: #b91515;
}

.dropdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(51, 51, 51, 0.9);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    z-index: 5;
    display: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    width: 200px;
}

.dropdown-list.show {
    display: block;
}

.dropdown-list li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    color: white;
}

.dropdown-list li:last-child {
    border-bottom: none;
}

.dropdown-list li:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #e42f2f;
}

.dropdown-list li img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 10px;
}

/* Star Rating Styles (common) */
.star {
    font-size: 1.1rem;
    margin-right: 5px;
    display: inline-block;
}

.star.filled::before {
    content: '★';
    color: #f7c400;
}

.star.empty::before {
    content: '☆';
    color: #ccc;
}

/* Cast Section (common) */
.movie-cast-section,
.tv-show-cast-section {
    width: 100%;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.movie-cast-section h3,
.tv-show-cast-section h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    text-align: center;
    color: #fff;
}

.cast-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
}

.cast-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 120px;
}

.cast-member img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #e42f2f;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.cast-member p {
    font-size: 0.9rem;
    color: #eee;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Similar Movies/TV Shows Section (common) */
.similar-movies-section,
.similar-tv-shows-section {
    width: 100%;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.similar-movies-section h3,
.similar-tv-shows-section h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    text-align: center;
    color: #fff;
}

.similar-movies-grid,
.similar-tv-shows-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    justify-items: center;
}

.similar-movie-item,
.similar-tv-show-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.similar-movie-item:hover,
.similar-tv-show-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.similar-movie-item img,
.similar-tv-show-item img {
    width: 100%;
    height: 270px;
    object-fit: cover;
    border-radius: 8px;
}

.similar-movie-item p,
.similar-tv-show-item p {
    font-size: 1rem;
    font-weight: bold;
    padding: 10px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: rgba(0, 0, 0, 0.7);
    margin: 0;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Iframe container for watching movie/TV show */
#iframe-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#iframe-container iframe {
    width: 90%;
    height: 80%;
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

/* Iframe Controls and Server Dropdown Styling */
.iframe-controls {
    position: absolute;
    top: -2px;      /* Nilapitan pa natin sa taas */
    right: 10px;    /* Nilapitan pa natin sa gilid */
    display: flex;
    gap: 10px;
    z-index: 1100;
}

/* Style para sa "Change Server" button */
#change-server-btn {
    background-color: #e50914; /* GINAWA NATING PULA */
    color: white;              /* GINAWA NATING PUTI ANG TEXT */
    padding: 10px 15px;
    border: none; /* Tinanggal ang border para mas malinis */
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#change-server-btn:hover {
    background-color: #f40612; /* Mas matingkad na pula kapag naka-hover */
}

/* Style para sa "Close" button */
#close-iframe-btn {
    background-color: #333; /* Nanatiling dark gray */
    color: white;
    padding: 10px 15px;
    border: 1px solid #555;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#close-iframe-btn:hover {
    background-color: #444;
}


/* Dropdown container */
.server-dropdown {
    position: absolute;
    top: 60px;  /* Inayos ang pwesto sa ilalim ng button */
    right: 15px;
    background-color: #181818;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    width: 250px;
    z-index: 1050;
    display: none; /* ITO ANG DEFAULT: NAKATAGO */
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(128, 128, 128, 0.2);
}

/* ITO ANG NAGPAPALABAS SA DROPDOWN */
.server-dropdown.show {
    display: block;
}

/* (Ang natitirang style para sa <ul>, <li>, at scrollbar ay pareho lang sa unang sagot at tama na) */
/* Kung nabura mo, heto ulit: */
.server-dropdown ul {
    list-style: none;
    padding: 5px;
    margin: 0;
}

.server-dropdown ul li {
    padding: 12px 15px;
    cursor: pointer;
    font-size: 1rem;
    color: #f1f1f1;
    border-radius: 4px;
    margin-bottom: 3px;
    transition: background-color 0.2s ease;
}

.server-dropdown ul li:not(.active):hover {
    background-color: #2a2a2a;
}

.server-dropdown ul li.active {
    background-color: #e50914;
    color: white;
    font-weight: bold;
}

.server-dropdown::-webkit-scrollbar {
    width: 8px;
}
.server-dropdown::-webkit-scrollbar-track {
    background: #181818;
}
.server-dropdown::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 4px;
    border: 2px solid #181818;
}


/* Responsive adjustments for details pages */
@media (max-width: 768px) {
    .movie-details-container .top-section,
    .tv-show-details-container .top-section {
        flex-direction: column;
        align-items: center;
    }

    .movie-poster-wrapper,
    .tv-show-poster-wrapper {
        width: 200px;
        height: 300px;
    }

    .info-description-watch-container {
        max-width: 90%;
        align-items: center;
    }

    #movie-title,
    #tv-show-title {
        font-size: 2rem;
        text-align: center;
    }

    #movie-description,
    #tv-show-description {
        font-size: 1rem;
        text-align: center;
        padding: 15px;
    }

    .rating-year-container {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 10px;
    }

    .movie-genres-inline,
    .tv-show-genres-inline {
        justify-content: center;
        margin-bottom: 10px;
    }

    .season-episode-selection {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin-bottom: 10px;
    }

    .dropdown-list {
        position: static;
        width: 90%;
    }

    .watch-now-btn {
        align-self: center;
        margin-top: 10px;
    }

    .movie-cast-section h3,
    .tv-show-cast-section h3,
    .similar-movies-section h3,
    .similar-tv-shows-section h3 {
        font-size: 1.5rem;
    }

    .cast-member {
        width: 100px;
    }

    .cast-member img {
        width: 80px;
        height: 80px;
    }

    .similar-movies-grid,
    .similar-tv-shows-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .similar-movie-item img,
    .similar-tv-show-item img {
        height: 180px;
    }

    .similar-movie-item p,
    .similar-tv-show-item p {
        font-size: 0.9rem;
    }

    .close-button {
        font-size: 1.8rem;
        top: 10px;
        right: 10px;
    }

    #iframe-container iframe {
        width: 95%;
        height: 70%;
    }
}

/* Specific styling for recommendation list (from original recommendation-list) */
.recommendation-list {
  margin-top: 20px;
  padding: 0;
  list-style: none;
}

.recommendation-list li {
  background-color: transparent;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.397);
  margin-bottom: 20px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 20px;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
  color: white;
}

.recommendation-list img {
  width: 150px;
  height: 200px;
  border-radius: 8px;
  flex-shrink: 0;
}

.recommendation-list .content-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.recommendation-list h4 {
  margin: 0;
  font-size: 20px;
  color: #f3f3f3;
  font-weight: bold;
  text-align: left;
}

.recommendation-list p {
  color: #777;
  font-size: 14px;
  margin: 0;
  text-align: left;
}

.recommendation-list li:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  background-color: rgba(255, 255, 255, 0.1);
}

/* "CONTENT TODAY" and "TOP" styling */
.content-today {
  font-family: "Electronica Display Outline";
  font-size: 20px;
  color: white;
  display: inline-block;
  vertical-align: top;
  margin-top: 40px;
  letter-spacing: -0.5px;
  margin-left: 5px;
  line-height: 1;
}

h4.top-label {
  font-family: "Electronica Display Outline";
  font-size: 120px;
  color: transparent;
  background-image: linear-gradient(180deg, transparent, rgba(228, 47, 47, 0.61), rgb(228, 47, 47));
  -webkit-background-clip: text;
  background-clip: text;
  letter-spacing: 1px;
  word-spacing: 1px;
  line-height: 1.2;
  text-align: left; /* Always left-aligned */
  animation: fadeInFromRight 2s ease-out;
  /* Removed any flex-related properties from here as its parent handles it now */
}

@keyframes fadeInFromRight {
  0% {
    opacity: 0;
    transform: translateX(50px);
    background-image: linear-gradient(180deg, transparent, rgba(228, 47, 47, 0.61), rgb(228, 47, 47));
  }
  100% {
    opacity: 1;
    transform: translateX(0);
    background-image: linear-gradient(180deg, transparent, rgba(228, 47, 47, 0.61), rgb(228, 47, 47));
  }
}

@media (max-width: 768px) {
  .content-today {
    font-size: 18px;
    margin-top: 30px;
  }

  h4.top-label {
    font-size: 90px;
    letter-spacing: 0.5px;
    word-spacing: 0.5px;
    text-align: left; /* Left on mobile for better stacking */
    margin-right: 30%;
    width: 100%; /* Take full width on mobile */
  }
}

@media (max-width: 480px) {
  .content-today {
    font-size: 16px;
    margin-top: 20px;
  }

  h4.top-label {
    font-size: 70px;
    letter-spacing: 0.3px;
    word-spacing: 0.3px;
  }
}

/* Go Back Button */
#backButton {
  background-color: #504d4dab;
  color: white;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  font-size: 16px;
  margin: 10px 0;
  border-radius: 10px;
}

#backButton:hover {
  background-color: #000000;
}

/* Go Back Button Styling */
.go-back-btn {
    background-color: #e50914;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s ease;
    text-decoration: none;
    width: fit-content;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.go-back-btn:hover {
    background-color: #ff0b1c;
}

.go-back-btn i {
    font-size: 18px;
}

/* Container for general content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background-color: transparent;
  /* Removed text-align: center here as it conflicts with flexbox/grid layout */
}

/* Top Ten Label (for specific content) */
.top-ten-label {
  position: absolute;
  top: 80px;
  left: 30px;
  background-color: rgb(228, 47, 47);
  color: white;
  padding: 10px 20px;
  font-size: 24px;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 5px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 60px;
  width: 60px;
  text-align: center;
}

@media (max-width: 768px) {
  .top-ten-label {
    top: 90px;
    left: 30px;
    font-size: 18px;
    height: 50px;
    width: 50px;
    padding: 8px 15px;
  }
}

/* Overlay Styling */
.poster-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 10px;
  padding: 10px;
  box-sizing: border-box;
}

.movie-card:hover .poster-overlay {
  opacity: 1;
}

/* Play Button Image */
.play-button-overlay {
  width: 50px;
  height: 50px;
  margin-bottom: 10px;
}

/* Overlay Text Styling */
.overlay-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: white;
  text-align: left;
  margin-bottom: 5px;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.overlay-meta {
  font-size: 0.9rem;
  color: #ccc;
  text-align: left;
  width: 100%;
}

.view-all-button {
    background-color: #e42f2f;
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.view-all-button:hover {
    background-color: #b91515;
}

/* MODIFIED: Filter Section Layout */
.filter-section {
    display: grid; /* Use grid for precise placement */
    grid-template-columns: 1fr auto; /* Two columns: left for title (auto width), right for search/filters */
    grid-template-rows: auto auto; /* Two rows: top for title/search, bottom for filters */
    gap: 20px; /* Space between grid items */
    margin-bottom: 20px;
    padding: 15px 0;
    border-bottom: 1px solid #333;
    width: 100%;
}

/* Position "Explore Movies" title in the top-left grid cell */
h4.top-label {
    grid-column: 1 / 2; /* Spans the first column */
    grid-row: 1 / 2; /* Stays in the first row */
    align-self: start; /* Align to the start of the row */
    justify-self: start; /* Align to the start of the column */
}

/* Position search bar in the top-right grid cell */
.search-container-top-right {
    grid-column: 2 / 3; /* Spans the second column */
    grid-row: 1 / 2; /* Stays in the first row */
    align-self: center; /* Vertically center in its cell */
    justify-self: end; /* Align to the end (right) of the column */
    display: flex; /* Keep flex for its internal elements */
    gap: 10px;
    align-items: center;
}

#search-input {
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #444;
    background-color: #222;
    color: white;
    font-size: 1em;
    width: 200px;
    transition: border-color 0.3s ease;
}

#search-input::placeholder {
    color: #aaa;
}

#search-input:focus {
    outline: none;
    border-color: #e42f2f;
}

#search-button {
    background-color: #e42f2f;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

#search-button:hover {
    background-color: #b91515;
}

/* Position filters directly below search, aligned to the right */
.filter-controls {
    grid-column: 2 / 3; /* Spans the second column */
    grid-row: 2 / 3; /* Moves to the second row */
    align-self: start; /* Align to the start of the row */
    justify-self: end; /* Align to the end (right) of the column */
    display: flex; /* Keep flex for internal arrangement */
    flex-wrap: wrap; /* Allow wrapping */
    gap: 15px;
    /* Removed width: 100% here as grid handles its width */
}

.filter-dropdown select {
    background-color: #222;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%20163.6c-4.5%204.5-10.6%207-17%207H22.4c-6.4%200-12.5-2.5-17-7s-7-10.6-7-17%207-17%2017-17h247.6c6.4%200%2012.5%202.5%2017%207s7%2010.6%207%2017%20-2.5%2012.5-7%2017z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px auto;
}

.filter-dropdown select:focus {
    outline: none;
    border-color: #e50914;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    color: #fff;
    font-size: 1em;
}

.filter-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 5px;
    accent-color: #e50914;
    cursor: pointer;
}

.filter-checkbox label {
    cursor: pointer;
}

/* Ensure your existing .container and .grid styles are compatible */
.container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 20px;
    justify-items: center;
}

/* Responsive adjustments for filter section and general layout */
@media (max-width: 768px) {
    .filter-section {
        grid-template-columns: 1fr; /* Single column on mobile */
        grid-template-rows: auto auto auto; /* Three rows for title, search, filters */
        gap: 15px; /* Adjust gap for mobile */
        align-items: center; /* Center everything on mobile horizontally */
        padding: 10px;
    }

    h4.top-label {
        grid-column: 1 / 2; /* Full width */
        grid-row: 1 / 2; /* First row */
        justify-self: center; /* Center horizontally */
        text-align: center; /* Center text */
        font-size: 90px; /* Adjust size for mobile */
        width: 100%; /* Ensure it takes full width */
    }

    .search-container-top-right {
        grid-column: 1 / 2; /* Full width */
        grid-row: 2 / 3; /* Second row */
        justify-self: center; /* Center horizontally */
        justify-content: center; /* Center search input and button */
        width: 100%; /* Take full width */
    }

    #search-input {
        width: 80%; /* Adjust width for mobile input */
        max-width: 250px;
    }

    .filter-controls {
        grid-column: 1 / 2; /* Full width */
        grid-row: 3 / 4; /* Third row */
        justify-self: center; /* Center horizontally */
        flex-direction: column; /* Stack filters vertically */
        justify-content: center; /* Center stacked filters */
        align-items: center; /* Center items within column */
        width: 100%; /* Take full width */
        gap: 10px;
    }

    .filter-dropdown,
    .filter-checkbox {
        width: 100%; /* Filters take full width for stacking */
        max-width: 300px; /* Limit max width for readability */
    }

    .filter-dropdown select {
        width: 100%;
        padding: 10px;
        font-size: 1.1em;
    }

    .filter-checkbox {
        justify-content: center; /* Center checkbox on mobile */
        font-size: 1.1em;
    }

    .content-today {
        font-size: 18px;
        margin-top: 10px;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .movie-card {
        width: 150px;
        height: 225px;
        margin-right: 0;
    }

    .similar-movie-item img,
    .similar-tv-show-item img {
        height: 220px;
    }

    .go-back-btn {
        top: 10px;
        left: 10px;
        padding: 8px 15px;
        font-size: 14px;
    }
}

/* Optional: Further fine-tuning for even smaller screens (e.g., less than 480px) */
@media (max-width: 480px) {
    #search-input {
        width: 70%;
    }

    .filter-dropdown select {
        padding: 8px;
        font-size: 1em;
    }

    .filter-checkbox {
        font-size: 1em;
    }

    h4.top-label {
        font-size: 50px;
    }

    .content-today {
        font-size: 16px;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 5px;
    }

    .movie-card {
        width: 120px;
        height: 180px;
        margin-right: 0;
    }

    .similar-movie-item img,
    .similar-tv-show-item img {
        height: 180px;
    }
}

/* Icon Style */

.icon {
  position: relative; /* Essential for positioning the tooltip text */
  font-size: 17px;
  color: white;
  cursor: pointer;
  transition: color 0.3s ease, transform 0.3s ease;
}

.icon a {
  text-decoration: none;
  color: inherit;
  display: flex; /* Makes the anchor tag a flex container to align icon and text, if needed */
  flex-direction: column; /* Stacks icon and text vertically */
  align-items: center; /* Centers items horizontally within the link */
}

/* Style for the hidden text */
.icon-text {
  position: absolute;
  top: 100%; /* Position below the icon */
  left: 50%;
  transform: translateX(-50%); /* Center the text horizontally */
  background-color: rgba(0, 0, 0, 0.85); /* Dark background for the tooltip */
  color: white;
  padding: 5px 8px;
  border-radius: 4px;
  white-space: nowrap; /* Prevent text from wrapping */
  font-size: 0.8em; /* Smaller font size for tooltip */
  opacity: 0; /* Initially invisible */
  visibility: hidden; /* Hide from screen readers and pointer events */
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out; /* Smooth transition */
  z-index: 1000; /* Ensure it's above other elements */
  margin-top: 5px; /* Small space between icon and text */
}

/* Show the text on hover */
.icon:hover .icon-text,
.icon a:hover .icon-text { /* Target the text inside both div.icon and a.icon */
  opacity: 1;
  visibility: visible;
}

/* Adjust icon container gap if needed to accommodate text */
.icons-container {
    gap: 20px; /* You might want to increase this slightly to prevent text overlap */
}

/* Adjust for smaller screens if the tooltip becomes problematic */
@media (max-width: 768px) {
    .icon-text {
        font-size: 0.7em; /* Even smaller font on mobile */
        padding: 3px 6px;
    }
}

/* Update your existing .icons-container if necessary */
.icons-container {
    position: fixed;
    top: 20px;
    right: 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px; /* Adjust gap to ensure space for expanding bar */
    z-index: 999;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Specific styles for the expanding search icon */
.search-icon-with-bar {
    position: relative; /* Crucial for positioning internal elements */
    width: 35px; /* Initial width of the icon, adjust to match your fas icon size */
    height: 35px; /* Initial height of the icon */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Hide the expanding input when it's shrunk */
    border-radius: 50%; /* Make it circular when collapsed */
    background-color: rgba(0, 0, 0, 0.4); /* Background for the icon itself */
    transition: width 0.3s ease, background-color 0.3s ease, border-radius 0.3s ease, padding 0.3s ease;
    padding: 0; /* Reset padding to control it in expanded state */
}

.search-icon-with-bar .search-main-icon {
    font-size: 17px; /* Match your existing icon size */
    color: white;
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    position: absolute; /* Position it within the container */
    z-index: 2; /* Ensure it's above the wrapper initially */
}

.search-icon-with-bar .icon-text {
    /* Existing icon-text styles. Make sure it positions correctly relative to .search-icon-with-bar */
    top: 100%; /* Position below the icon */
    left: 50%;
    transform: translateX(-50%); /* Center the text horizontally */
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    white-space: nowrap;
    font-size: 0.8em;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    z-index: 1000;
    margin-top: 5px;
}

/* Styles for the wrapper holding the input and button */
.search-input-wrapper {
    position: absolute;
    top: 0;
    right: 0; /* Position to the right edge of its parent (.search-icon-with-bar) */
    height: 100%;
    display: flex;
    align-items: center;
    opacity: 0; /* Start hidden */
    visibility: hidden;
    pointer-events: none; /* Make non-interactive when hidden */
    transition: opacity 0.3s ease, visibility 0.3s ease;
    width: 0; /* Initial width is 0 */
    overflow: hidden; /* Hide content that overflows */
    background-color: transparent; /* No background for the wrapper itself, the parent takes care of it */
}

.search-input-wrapper input {
    width: 0; /* Start with zero width */
    padding: 0; /* No padding when hidden */
    border: none; /* No border when hidden */
    background-color: transparent; /* Transparent background when hidden */
    color: white;
    font-size: 1em;
    height: 100%; /* Match parent height */
    box-sizing: border-box; /* Include padding/border in element's total width and height */
    transition: width 0.3s ease, padding 0.3s ease, background-color 0.3s ease;
    outline: none; /* Remove outline on focus */
}

.search-input-wrapper button {
    background-color: transparent; /* Make button background transparent initially */
    color: white;
    border: none;
    padding: 0; /* No padding when hidden */
    cursor: pointer;
    font-size: 1em;
    height: 100%;
    opacity: 0; /* Hide button initially */
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    width: 0; /* Start with zero width */
}

/* State when the search bar is "shown" (expanded) */
.search-icon-with-bar.expanded {
    width: 250px; /* Expanded width, adjust as needed */
    border-radius: 8px; /* Change to a rectangular shape */
    background-color: rgba(0, 0, 0, 0.7); /* Background for the expanded bar */
    padding: 5px 10px; /* Add padding when expanded */
}

.search-icon-with-bar.expanded .search-main-icon {
    opacity: 0; /* Hide the main icon */
    transform: translateX(100%); /* Move it out of the way */
}

.search-icon-with-bar.expanded .search-input-wrapper {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* Enable interaction */
    width: 100%; /* Take full width of parent */
}

.search-icon-with-bar.expanded .search-input-wrapper input {
    width: calc(100% - 30px); /* Input takes most of the width, leaving space for button */
    padding: 8px 12px; /* Add padding when visible */
    background-color: #222; /* Add background to input field */
    border: 1px solid #444; /* Add border to input field */
}

.search-icon-with-bar.expanded .search-input-wrapper button {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    width: 30px; /* Width for the search button */
    padding: 0 5px; /* Adjust padding for the button */
    background-color: #080808; /* Button background */
    border-radius: 5px; /* Button border radius */
    height: auto; /* Allow button height to adjust */
}

.search-icon-with-bar.expanded .search-input-wrapper button:hover {
    background-color: #1a1919;
}


/* Responsive adjustments for the expanding search bar */
@media (max-width: 768px) {
    .search-icon-with-bar.expanded {
        width: 180px; /* Smaller expanded width on mobile */
        padding: 5px;
    }
    .search-icon-with-bar.expanded .search-input-wrapper input {
        width: calc(100% - 25px); /* Adjust input width */
        font-size: 0.9em;
        padding: 6px 8px;
    }
    .search-icon-with-bar.expanded .search-input-wrapper button {
        width: 25px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .search-icon-with-bar.expanded {
        width: 150px; /* Even smaller expanded width */
    }
    .search-icon-with-bar.expanded .search-input-wrapper input {
        width: calc(100% - 20px);
        padding: 5px 7px;
    }
    .search-icon-with-bar.expanded .search-input-wrapper button {
        width: 20px;
        font-size: 0.8em;
    }
}
