@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@400;700;900&display=swap");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", sans-serif;
  background: #0c0c1e;
  color: #ffffff;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* Кнопка назад */
.back-button {
  top: 10px;
  position: fixed;
  z-index: 10;
  background: rgba(15, 15, 35, 0.8);
  backdrop-filter: blur(3px);
  border: 2px solid rgba(100, 200, 255, 0.3);
  color: white;
  padding: 15px 25px;
  border-radius: 15px;
  cursor: pointer;
  margin-bottom: 30px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: none;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.back-button:hover {
  background: rgba(100, 200, 255, 0.1);
  border-color: rgba(100, 200, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(100, 200, 255, 0.3);
}

/* Контейнер поиска */
.search-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px;
  background: rgba(15, 15, 35, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(100, 200, 255, 0.2);
  border-radius: 25px 25px 0px 0px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  animation: slideInUp 0.8s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-container h1 {
  font-family: "Orbitron", monospace;
  text-align: center;
  margin-bottom: 30px;
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #64c8ff 0%, #9d80ff 50%, #ff9dd8 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(100, 200, 255, 0.5);
  position: relative;
}

.search-container h1::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 3px;
  background: linear-gradient(90deg, #64c8ff, #9d80ff);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
}

/* Поисковая строка */
.search-box {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  flex-direction: row;
  justify-content: center;
}

.search-input {
  flex: 1;
  min-width: 300px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(100, 200, 255, 0.3);
  border-radius: 15px;
  padding: 18px 25px;
  color: white;
  font-size: 16px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  font-weight: 400;
}

.search-input:focus {
  outline: none;
  border-color: #64c8ff;
  box-shadow: 0 0 25px rgba(100, 200, 255, 0.4);
  transform: scale(1.02);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.search-button {
  background: linear-gradient(135deg, #ff6b9d 0%, #c471f5 50%, #12c2e9 100%);
  border: none;
  border-radius: 15px;
  padding: 18px 35px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  box-shadow: 0 5px 15px rgba(255, 107, 157, 0.4);
  white-space: nowrap;
}

.search-button:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 107, 157, 0.6);
}

/* Фильтры */
.filters {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-select {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(100, 200, 255, 0.3);
  border-radius: 12px;
  padding: 12px 20px;
  color: white;
  font-size: 14px;
  min-width: 140px;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  font-weight: 500;
}

.filter-select:focus {
  outline: none;
  border-color: #64c8ff;
  box-shadow: 0 0 15px rgba(100, 200, 255, 0.3);
}

.filter-select option {
  background: #1a1a3a;
  color: white;
  padding: 10px;
}

/* Результаты поиска */
#search-results {
  animation: fadeIn 0.5s ease-out 0.3s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#search-results h3 {
  font-family: "Orbitron", monospace;
  font-size: 1.6rem;
  margin-top: 15px;
  margin-bottom: 25px;
  text-align: center;
  color: #64c8ff;
  font-weight: 600;
}

/* Сетка фильмов */
.movies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 25px;
  margin-top: 25px;
}

.movie-card {
  background: rgba(15, 15, 35, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(100, 200, 255, 0.2);
  border-radius: 15px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  height: 420px;
  display: flex;
  flex-direction: column;
}

/* Эффект градиентного свечения при наведении */
.movie-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(100, 200, 255, 0.1) 0%,
    rgba(157, 128, 255, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 15px;
  z-index: 1;
}

.movie-card:hover::before {
  opacity: 1;
}

.movie-card:hover {
  transform: translateY(-15px) scale(1.03);
  border-color: rgba(100, 200, 255, 0.5);
  box-shadow: 0 20px 50px rgba(100, 200, 255, 0.3),
    0 0 30px rgba(157, 128, 255, 0.2);
}

.movie-card img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  transition: transform 0.4s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.movie-card:hover img {
  transform: scale(1.1);
}

.movie-info {
  padding: 10px 12px;
  position: relative;
  z-index: 3; /* Повышаем z-index чтобы текст был поверх градиента */
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(15, 15, 35, 0.9); /* Легкий фон для лучшей читаемости */
}

.movie-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 15px;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.2;
  min-height: 36px;
  transition: color 0.3s ease;
}

.movie-card:hover .movie-title {
  color: #64c8ff; /* Изменение цвета при наведении */
}

.movie-year {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 400;
  margin-top: 2px;
  transition: color 0.3s ease;
}

.movie-card:hover .movie-year {
  color: #9d80ff; /* Изменение цвета при наведении */
}

/* Загрузка и состояния */
.loading {
  text-align: center;
  padding: 60px;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(15, 15, 35, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(100, 200, 255, 0.2);
  border-radius: 20px;
  animation: pulse 2s ease-in-out infinite;
}

.error {
  color: #ff6b9d;
  text-align: center;
  padding: 40px;
  background: rgba(255, 107, 157, 0.1);
  border: 1px solid rgba(255, 107, 157, 0.3);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  font-size: 1.1rem;
}

/* Пустое состояние */
#search-results > div:not(.movies-grid):not(h3) {
  text-align: center;
  padding: 80px 20px;
  background: rgba(15, 15, 35, 0.6);
  backdrop-filter: blur(20px);
  border: 2px dashed rgba(100, 200, 255, 0.3);
  border-radius: 0px 0px 20px 20px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  position: relative;
  overflow: hidden;
}

#search-results > div:not(.movies-grid):not(h3)::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(100, 200, 255, 0.1),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .back-button {
    top: 15px;
    left: 15px;
  }
  .container {
    padding: 0px;
  }
  .search-container {
    padding: 10px;
    padding-top: 70px;
    position: fixed;
    z-index: 5;
    width: 100%;
    top: 0;
    border-radius: 0px;
  }

  .search-container h1 {
    font-size: 23px;
  }

  .search-box {
    flex-direction: row;
    gap: 0;
    margin: 0px;
  }

  .search-input {
    border-radius: 20px 0px 0px 20px;
    min-width: 50px;
  }
  .search-button {
    border-radius: 0px 20px 20px 0px;
    padding: 18px 15px;
  }

  .filters {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0px;
    height: 50px;
  }

  .filter-select {
    width: 33%;
    padding: 12px 0px;
    min-width: 40px;
  }

  #search-results {
    margin-top: 252px;
    width: 95%;
    margin-left: auto;
    margin-right: auto;
  }

  .movies-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .movies-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }

  .movie-card img {
    height: 280px;
  }

  .filters {
    flex-direction: column;
  }
}
