/* Base styles */
body {
  font-family: "Inter", sans-serif;
  background-color: #f0f2f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0; /* Adjusted for fixed nav */
  padding-bottom: 2rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Navigation Bar Styles */
.navbar {
  width: 100%;
  background-color: #333;
  padding: 1rem 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  margin-bottom: 2rem; /* Space below nav */
  position: sticky; /* Make it stick to the top */
  top: 0;
  z-index: 1000; /* Ensure it's above other content */
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: center; /* Center the nav items */
  gap: 2rem; /* Space between nav items */
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.nav-link:hover {
  background-color: #555;
  color: #fff;
}

/* Container styles */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 1.5rem;
  background-color: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
  margin-top: 2rem; /* Added margin-top to push content below sticky nav */
}

@media (min-width: 768px) {
  .container {
    width: 75%;
  }
}

@media (min-width: 1024px) {
  .container {
    width: 50%;
  }
}

/* Heading styles */
h1 {
  font-size: 2.25rem;
  font-weight: 700;
  text-align: center;
  color: #1f2937;
  margin-bottom: 1.5rem;
}

/* Search form styles */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .search-form {
    flex-direction: row;
  }
}

/* Input field styles */
.search-input {
  flex-grow: 1;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1.125rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

/* Search button styles */
.search-button {
  background-image: linear-gradient(to right, #6366f1, #8b5cf6);
  color: #ffffff;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  border: none;
  outline: none;
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(99, 102, 241, 0.4);
}

.search-button:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5), 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Loading and No Results indicators */
.loading-indicator,
.no-results {
  text-align: center;
  color: #4b5563;
  font-size: 1.125rem;
  margin-top: 2rem;
}

.hidden {
  display: none;
}

/* Results grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .results-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Movie card styles - UPDATED */
.movie-card {
  background-color: #ffffff;
  border-radius: 0.75rem;
  overflow: hidden;
  position: relative; /* For hover overlay */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out;
  cursor: pointer; /* Indicate clickable */
  display: flex;
  flex-direction: column;
  height: 100%; /* Ensure cards are same height in grid */
}

.movie-card:hover {
  transform: translateY(-5px);
}

.poster-image {
  width: 100%;
  height: 250px; /* Adjusted height for more compact card */
  object-fit: cover;
  border-radius: 0.5rem;
  display: block; /* Remove extra space below image */
}

.movie-info-summary {
  padding: 1rem;
  text-align: center;
  flex-grow: 1; /* Allows it to take available space */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Push year to bottom */
}

.movie-info-summary h2 {
  font-size: 1.1rem; /* Slightly smaller title */
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}
.movie-info-summary h2 a {
  /* Style for clickable title */
  text-decoration: none;
  color: #111827;
  transition: color 0.2s ease;
}
.movie-info-summary h2 a:hover {
  color: #6366f1; /* Highlight on hover */
}

.movie-info-summary p.genre-year {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

/* Hover Overlay for Overview */
.movie-overview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8); /* Dark overlay */
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none; /* Allows click-through to the link below */
  border-radius: 0.75rem; /* Match card border-radius */
  text-align: center;
  overflow: hidden; /* Hide overflow text */
}

.movie-card:hover .movie-overview-overlay {
  opacity: 1;
  pointer-events: auto; /* Enable interaction with overlay on hover */
}

.movie-overview-overlay p {
  font-size: 0.9rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 8; /* Limit overview to 8 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Custom Message Box styles */
.message-box {
  background-color: #fff;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  display: none;
  max-width: 400px;
  width: 90%;
  text-align: left;
}
.message-box.show {
  display: block;
}
.message-box .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.message-box h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
}
.message-box .close-button {
  color: #6b7280;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.message-box .close-button:hover {
  color: #374151;
}
.message-box p {
  color: #374151;
}
