* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  min-height: 100vh;
  color: white;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #050505;
  overflow-x: hidden;
  position: relative;
  padding: 80px 0;
}

.poster-wall {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: 240px;
  gap: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0.85;
}

.poster-wall img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 2 / 3;
  border-radius: 0;
  filter: brightness(0.5) contrast(1.05);
}

.dark-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.app {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 850px;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 35px;
  border-radius: 20px;
  text-align: center;
}

h1 {
  margin-bottom: 8px;
}

.subtitle {
  color: #d6d6e8;
}

.search-box {
  margin: 25px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
}

input {
  width: 60%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
}

select {
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
}

button {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  background-color: #ff4c60;
  color: white;
  font-size: 16px;
  cursor: pointer;
}

button:hover {
  background-color: #ff2f49;
}

#message {
  color: #ffd166;
}

.hidden {
  display: none !important;
}

.loader {
  border: 6px solid rgba(255, 255, 255, 0.2);
  border-top: 6px solid #ff4c60;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  margin: 20px auto;
  animation: spin 1s linear infinite;
}

.movie-card {
  margin-top: 25px;
  gap: 18px;
  background: rgba(5, 5, 8, 0.94);
  padding: 25px;
  border-radius: 22px;
  animation: fadeIn 0.4s ease;
}

.movie-card:not(.hidden) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.result-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(18, 18, 24, 0.96);
  padding: 14px;
  border-radius: 18px;
  cursor: pointer;
  transition: 0.25s ease;
  min-width: 0;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.35);
}

.result-item:hover {
  transform: translateY(-6px) scale(1.02);
  background: rgba(28, 28, 38, 0.98);
}

.result-item img {
  width: 80px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
}

.result-item h3 {
  margin: 0;
}

.result-item p {
  margin: 6px 0 0;
  color: #d6d6e8;
}

.detail-card {
  grid-column: 1 / -1;
  display: flex;
  gap: 30px;
  text-align: left;
  background: rgba(10, 10, 16, 0.96);
  padding: 25px;
  border-radius: 22px;
}

.detail-card > img {
  width: 220px;
  max-height: 380px;
  align-self: flex-start;
  object-fit: cover;
  border-radius: 12px;
}

.movie-info h2 {
  margin-top: 0;
}

.movie-info p {
  line-height: 1.5;
}

.similar-section {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  margin-top: 30px;
}

.similar-section h3 {
  font-size: 24px;
  margin-bottom: 15px;
  color: #ffd166;
}

.similar-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
}

.similar-item {
  width: 100%;
  min-width: 0;
}

.similar-item:hover {
  transform: translateY(-6px) scale(1.04);
  background: rgba(255, 255, 255, 0.18);
}

.similar-item img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 12px;
}

.similar-item p {
  font-size: 14px;
  font-weight: bold;
  margin-top: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  body {
    padding: 40px 0;
  }

  .poster-wall {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 180px;
  }

  .app {
    width: 92%;
    padding: 20px;
    margin-top: 40px;
    margin-bottom: 40px;
  }

  h1 {
    font-size: 24px;
  }

  .search-box {
    flex-direction: column;
  }

  input,
  select,
  button {
    width: 100%;
  }

  .detail-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .detail-card > img {
    width: 70%;
  }

  .similar-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
