* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f4f4f4;
  display: flex;
  justify-content: center;
  padding: 40px 10px;
  min-height: 100vh;
}

.app-container {
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  max-width: 700px;
  width: 100%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}


h1 {
  text-align: center;
  margin-bottom: 25px;
  color: #4C4D8F;
  font-size: 32px;
}

.input,
#search-btn {
  font-size: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
}

.input {
  width: 70%;
  margin-right: 10px;
}

#search-btn {
  background-color: #4C4D8F;
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.3s;

}

#search-btn:hover {
  background-color: #33349E;
}

#search-btn:active {
  transform: translateY(0);
}

.search-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.movie-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.movie-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid #eee;
}

.movie-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}



.movie-card img {
  width: 100%;
  height: 270px;
  object-fit: cover;
}

.movie-info {
  padding: 15px;
}

.movie-info h4 {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-info p {
  color: #666;
  font-size: 14px;
  margin: 0;
}



.movieDetails {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.movieDetails.active {
  opacity: 1;
  visibility: visible;
}

.details-container {
  background: white;
  border-radius: 12px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.details-content {
  display: flex;
  gap: 30px;
}

.details-poster {
  flex: 0 0 300px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.details-poster img {
  width: 100%;
  height: auto;
  display: block;
}

.details-info {
  flex: 1;
}


.details-info h2 {
  font-size: 28px;
  margin-bottom: 10px;
  color: #4C4D8F;
}

.details-meta {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  color: #666;
  font-size: 14px;
}

.details-rating {
  display: flex;
  align-items: center;
  color: #f5b301;
  font-weight: bold;
}


.details-rating i {
  margin-right: 5px;
}

.details-plot {
  margin: 20px 0;
  line-height: 1.6;
}

.details-extra {
  margin-top: 20px;
}

.details-extra p {
  margin-bottom: 8px;
  font-size: 14px;
}

.details-extra strong {
  color: #4C4D8F;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  transition: color 0.3s;
}

.close-btn:hover {
  color: #333;
}

.error-message {
  text-align: center;
  padding: 30px;
  color: #d32f2f;
  font-weight: 500;
}

.loading-spinner {
  display: flex;
  justify-content: center;
  gap: 8px;
  height: 50px;
  align-items: center;
}

.loading-spinner div {
  width: 12px;
  height: 12px;
  background-color: #4C4D8F;
  border-radius: 50%;
  animation: wave 1.2s ease-in-out infinite;
}

.loading-spinner div:nth-child(1) {
  animation-delay: 0s;
}

.loading-spinner div:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-spinner div:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes wave {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-15px);
  }
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #666;
}

.empty-state i {
  font-size: 50px;
  color: #ddd;
  margin-bottom: 15px;
}

@media (max-width: 768px) {
  .app-container {
    padding: 20px;
  }

  .input {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
  }

  #search-btn {
    width: 100%;
  }

  .movie-list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .details-content {
    flex-direction: column;
  }

  .details-poster {
    flex: 0 0 auto;
    margin-bottom: 20px;
  }
}