@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background: #121212;
  color: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 20px;
  background: #1f1f1f;
  box-shadow: 0 2px 5px rgba(0,0,0,0.6);
}

header h1 {
  margin-bottom: 15px;
  color: #ff9800;
}

#search {
  width: 60%;
  max-width: 500px;
  padding: 12px 20px;
  border-radius: 30px;
  border: none;
  outline: none;
  font-size: 16px;
}

.controls {
  text-align: center;
  margin: 20px 0;
}

.controls button {
  background: #ff9800;
  color: white;
  border: none;
  padding: 10px 18px;
  margin: 0 8px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
}

.controls button:hover {
  background: #e68900;
}

.movie-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  padding: 30px;
}

.movie-card {
  background: #1f1f1f;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.movie-card:hover {
  transform: scale(1.05);
}

.movie-card img {
  width: 100%;
  height: 320px;
  object-fit: cover;
}

.movie-info {
  padding: 15px;
}

.movie-info h2 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #ff9800;
}

.movie-info p {
  font-size: 14px;
  color: #ccc;
  max-height: 60px;
  overflow: hidden;
}

.rating {
  font-weight: bold;
  color: #ffcc00;
}

.rating.green { color: #4caf50; }
.rating.orange { color: #ff9800; }
.rating.red { color: #f44336; }

footer {
  text-align: center;
  padding: 15px;
  background: #1f1f1f;
  margin-top: auto;
}

/* Loader */
#loader {
  display: none;
  margin: 30px auto;
  border: 6px solid #333;
  border-top: 6px solid #ff9800;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Modal */
#modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  justify-content: center; align-items: center;
  z-index: 1000;
}

.modal-content {
  background: #1f1f1f;
  padding: 20px;
  border-radius: 15px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  color: white;
  position: relative;
}

.modal-content img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 15px;
}

.modal-content .close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  color: #ff9800;
}

.error, .no-results {
  text-align: center;
  margin: 30px 0;
  font-size: 18px;
  color: #ff4d4d;
}
