/* public/style.css */

:root {
  /* Dark Mode (Default) */
  --bg-primary: #0f0c29;
  --bg-secondary: #24243e;
  --bg-tertiary: #302b63;
  --text-primary: #ffffff;
  --text-secondary: #c0c0c0;
  --accent-primary: #8e44ad;
  --accent-secondary: #5e3370;
  --shadow-color: rgba(0, 0, 0, 0.4);

  --rating-good: #2ecc71;
  --rating-mid: #f1c40f;
  --rating-bad: #e74c3c;
}

.light-mode {
  /* Light Mode */
  --bg-primary: #f4f4f9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e9ecef;
  --text-primary: #121212;
  --text-secondary: #495057;
  --accent-primary: #6a11cb;
  --accent-secondary: #2575fc;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header and Navigation */
header {
  background-color: var(--bg-secondary);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px var(--shadow-color);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Space between the two icons */
}

header h1 {
  font-size: 1.8rem;
  color: var(--accent-primary);
}

.genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.genre-btn {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

.genre-btn:hover,
.genre-btn.active {
  background-color: var(--accent-primary);
  color: #fff;
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-primary);
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  font-size: 1rem;
  padding: 0.3rem;
  position: relative;
  width: 70px;
  height: 36px;
}

.theme-toggle .moon-icon,
.theme-toggle .sun-icon {
  transition: opacity 0.3s ease;
}

.light-mode .theme-toggle .moon-icon {
  opacity: 0;
}
.light-mode .theme-toggle .sun-icon {
  opacity: 1;
}
.theme-toggle .moon-icon {
  opacity: 1;
}
.theme-toggle .sun-icon {
  opacity: 0;
}

/* Banner and Search */
.banner {
  background-color: var(--bg-secondary);
  border-radius: 10px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
}

#search-form {
  margin-top: 1.5rem;
}

#search-form input {
  width: 100%;
  max-width: 500px;
  padding: 0.8rem 1.2rem;
  border-radius: 30px;
  border: 2px solid var(--bg-tertiary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1.1rem;
  transition: border-color 0.3s;
}

#search-form input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Movie Grid and Cards */
.results-section {
  padding-bottom: 2rem;
}

#results-heading {
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
  border-left: 4px solid var(--accent-primary);
  padding-left: 10px;
}

#movie-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
}

.movie-card {
  background-color: var(--bg-tertiary);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  box-shadow: 0 4px 8px var(--shadow-color);
}

.movie-card:hover {
  transform: scale(1.08);
  z-index: 10;
  box-shadow: 0 8px 20px var(--shadow-color);
}

.movie-card img {
  width: 100%;
  display: block;
}

.movie-card .rating {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 5px;
  font-weight: bold;
  font-size: 0.9rem;
  z-index: 5;
  display: flex; /* Helps align the star and number */
  align-items: center;
}
.star-icon {
  opacity: 1; /* Hidden by default */
  margin-right: 4px; /* Space between star and number */
}

.movie-card:hover .star-icon {
  opacity: 1; /* Revealed on hover */
}
.rating.good {
  border-left: 3px solid var(--rating-good);
}
.rating.mid {
  border-left: 3px solid var(--rating-mid);
}
.rating.bad {
  border-left: 3px solid var(--rating-bad);
}

/* --- HOVER DETAILS OVERLAY --- */
.movie-details-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.95) 20%,
    transparent 100%
  );
  color: #fff;
  padding: 3rem 1rem 1rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.movie-card:hover .movie-details-overlay {
  opacity: 1;
  transform: translateY(0);
}

.movie-details-overlay h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.movie-details-overlay p {
  font-size: 0.8rem;
  line-height: 1.4;
  max-height: 5.6em; /* max 4 lines */
  overflow: hidden;
}

/* Pagination and Footer */
#pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}

.page-btn {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.page-btn:hover,
.page-btn.active {
  background-color: var(--accent-primary);
  color: #fff;
}

.page-btn:disabled {
  background-color: #333;
  cursor: not-allowed;
}
.ellipsis {
  padding: 0.75rem 0;
}
footer {
  text-align: center;
  padding: 1rem 0;
  background-color: var(--bg-secondary);
  margin-top: 2rem;
  font-size: 0.9rem;
}
footer a {
  color: var(--accent-primary);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
  header .container {
    flex-wrap: wrap; /* Allow items to wrap */
    justify-content: space-between;
  }
  header .genres {
    order: 3; /* This ensures it's the last item */
    flex-basis: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }
  .header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Space between the two icons */
  }

  #movie-container {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
  }
}
/* --- LOAD MORE BUTTON STYLES --- */
#load-more-container {
  text-align: center;
  margin-top: 2rem;
}

.load-more-btn {
  background-color: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 0.8rem 2.5rem;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
}

.load-more-btn:hover {
  background-color: var(--accent-secondary);
  transform: translateY(-2px);
}

.load-more-btn:disabled {
  background-color: #555;
  cursor: not-allowed;
  transform: none;
}
/* Style for new icon buttons in the header */
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.5rem;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, color 0.3s;
}

.icon-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}
/* Add this to the bottom of style.css */

/* Watchlist Icon on Movie Cards */
.watchlist-icon {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: color 0.3s, transform 0.3s;
  z-index: 5;
}

.watchlist-icon:hover {
  transform: scale(1.1);
}

.watchlist-icon.in-watchlist {
  color: var(--rating-mid); /* Yellow color */
}
