@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap");

:root {
  --primary-color: #ff6b6b;
  --secondary-color: #4ecdc4;
  --background-color: #1a1a2e;
  --text-color: #f0f0f0;
  --card-bg-color: #16213e;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

header {
  background-color: rgba(0, 0, 0, 0.9);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

#search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

#search-input {
  width: 100%;
  padding: 12px 40px 12px 15px;
  border: none;
  font-size: 16px;
  border-radius: 25px;
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

#search-input:focus {
  background-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.btn:hover {
  transform: scale(1.1);
}

main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

section {
  margin-bottom: 3rem;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.movie-card {
  background-color: var(--card-bg-color);
  border-radius: 10px;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.movie-card:hover {
  transform: translateY(-5px);
}

.movie-card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 10px 10px 0 0;
}

.movie-info {
  padding: 0.5rem;
}

.movie-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.movie-rating {
  font-size: 0.8rem;
  color: var(--primary-color);
}

.hidden {
  display: none;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  overflow-y: auto;
}

.modal-content {
  background-color: var(--card-bg-color);
  margin: 5% auto;
  padding: 2rem;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  position: relative;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: var(--primary-color);
  text-decoration: none;
  cursor: pointer;
}

#modal-poster {
  max-width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  nav {
    flex-direction: column;
    gap: 1rem;
  }

  #search-form {
    width: 100%;
  }

  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .movie-card img {
    height: 180px;
  }

  .movie-title {
    font-size: 0.8rem;
  }

  .movie-rating {
    font-size: 0.7rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (min-width: 1025px) {
  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}