:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --text: #ffffff;
  --text-muted: #b3b3b3;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --radius: 10px;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1200px, 92vw);
  margin-inline: auto;
}

.navbar {
  position: fixed;
  top: 0;
  z-index: 100;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 4vw;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.45) 65%, transparent);
  backdrop-filter: blur(4px);
}

.logo {
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.3px;
}

.search-wrap {
  justify-self: center;
  width: min(560px, 100%);
}

.search-input {
  width: 100%;
  background: rgba(22, 22, 22, 0.8);
  border: 1px solid #252525;
  color: var(--text);
  border-radius: 999px;
  padding: 0.72rem 1rem;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.search-input:focus {
  border-color: #3c3c3c;
  background: rgba(22, 22, 22, 0.95);
}

.type-switch {
  display: inline-flex;
  gap: 0.5rem;
}

.switch-btn {
  background: transparent;
  border: 1px solid #303030;
  color: #dedede;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.switch-btn:hover,
.switch-btn.active {
  background: #1d1d1d;
  border-color: #4e4e4e;
  color: #fff;
}

.hero {
  position: relative;
  min-height: min(90vh, 760px);
  display: grid;
  align-items: end;
  padding: 8rem 0 3.5rem;
  background-color: #111;
  background-size: cover;
  background-position: center 22%;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 25% 32%, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.7) 55%);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #0a0a0a 10%, rgba(10, 10, 10, 0.5) 45%, rgba(10, 10, 10, 0.4));
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  animation: fadeSlideIn 0.65s ease;
}

.hero-brand {
  color: #f2f2f2;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
  font-size: 0.85rem;
}

.hero h1 {
  font-size: clamp(2rem, 4.8vw, 3.8rem);
  line-height: 1.08;
  margin-bottom: 0.8rem;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.hero p {
  color: #e4e4e4;
  max-width: 60ch;
}

.hero-actions {
  margin-top: 1.35rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 6px;
  font-weight: 700;
  padding: 0.72rem 1.25rem;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: rgba(109, 109, 110, 0.7);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(109, 109, 110, 0.95);
}

.movies-section {
  padding: 2.4rem 0 4rem;
}

.section-head {
  margin-bottom: 1rem;
}

.section-head h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  margin-bottom: 0.25rem;
}

.section-head p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.status-message {
  color: var(--text-muted);
  margin: 0.35rem 0 1.25rem;
}

.movies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.1rem;
}

.movie-card {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: #151515;
  box-shadow: var(--shadow);
  transform-origin: center;
  opacity: 0;
  animation: cardIn 0.45s ease forwards;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.movie-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.52);
}

.movie-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #1f1f1f;
}

.movie-info {
  padding: 0.65rem 0.68rem 0.8rem;
}

.movie-title {
  font-size: 0.95rem;
  font-weight: 650;
  margin-bottom: 0.3rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.5em;
}

.rating {
  color: #e7e7e7;
  font-size: 0.87rem;
}

.details-page {
  min-height: 100vh;
  padding-bottom: 2.5rem;
}

.backdrop {
  position: relative;
  min-height: 58vh;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: end;
}

.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, #0a0a0a 12%, rgba(10, 10, 10, 0.45) 70%, rgba(10, 10, 10, 0.35));
}

.movie-detail {
  position: relative;
  z-index: 2;
  width: min(1200px, 92vw);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(210px, 280px) 1fr;
  gap: 1.5rem;
  align-items: end;
  padding-bottom: 1.8rem;
}

.poster-large {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.meta h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.08;
  margin-bottom: 0.55rem;
}

.meta .overview {
  max-width: 72ch;
  color: #e5e5e5;
  margin-bottom: 0.8rem;
}

.meta .rating {
  margin-bottom: 1rem;
  font-size: 0.98rem;
}

.player-shell {
  width: min(1200px, 92vw);
  margin: 1.6rem auto 0;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid #242424;
  border-radius: var(--radius);
}

.player-placeholder {
  min-height: 220px;
  border: 1px dashed #3a3a3a;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  .navbar {
    grid-template-columns: 1fr;
    gap: 0.7rem;
    padding: 0.9rem 4vw;
    background: rgba(0, 0, 0, 0.92);
  }

  .search-wrap {
    width: 100%;
    justify-self: stretch;
  }

  .type-switch {
    justify-content: start;
  }

  .hero {
    min-height: 75vh;
    padding-top: 9.8rem;
  }

  .movie-detail {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .poster-large {
    width: min(260px, 50vw);
  }
}

@media (max-width: 560px) {
  .movies-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
  }

  .hero-actions {
    width: 100%;
  }

  .btn {
    width: 100%;
    text-align: center;
  }
}