/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin-block-end: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
}

/* Set shorter line heights on headings and interactive elements */
h1,
h2,
h3,
h4,
button,
input,
label {
  line-height: 1.1;
}

/* Balance text wrapping on headings */
h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

body {
  background-color: black;
  font-family: "Outfit", sans-serif;
  line-height: 1.6;
  color: #94a3b8;
  min-height: 100vh;
  margin: 0;
}

header {
  background: rgba(8, 8, 10, 0.9);
  backdrop-filter: blur(20px);
  padding: 1rem 5%;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.2rem, 5vw, 1.8rem);
  color: white;
  letter-spacing: -1px;
  margin: 0;
}

h1::after {
  content: "•";
  color: #a855f7;
  margin-left: 5px;
}

.header-bar nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
}

.header-bar nav ul li a {
  text-decoration: none;
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-bar nav ul li a:hover {
  color: #a855f7;
}

.search-bar {
  background: #1a1a1e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  border-radius: 8px;
  color: white;
  outline: none;
  font-size: 0.85rem;
  width: 100%;
  max-width: 200px;
}

@media (max-width: 500px) {
  header {
    flex-direction: column;
    align-items: center;
  }
  h1 {
    text-align: center;
    align-items: center;

    font-size: 1.6rem;
    font-weight: 800;
    padding: 0.8rem 0 0.5rem;
    margin: 0;
  }

  .header-bar nav ul {
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    align-items: center;
  }
}

#Movies {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: white;
}

@media (max-width: 600px) {
  h2 {
    display: flex;
    flex-direction: column;
    font-size: f.4rem;
    gap: 0.4rem;
    text-align: center;
  }
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.8rem;
  justify-items: center;
}

.movie-card {
  background: #121214;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  width: 100%;
  max-width: 360px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s;
  cursor: pointer;
}

.movie-card:hover {
  transform: translateY(-8px) scale(1.01);
  border-color: #a855f7;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.6),
    0 0 0 1px #18181b;
  background: #18181b;
}

.movie-img {
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  position: relative;
}

.movie-img img {
  width: 100%;
  height: 100%;
  object-fit: auto;
  display: block;
  transition: transform 0.4s ease;
}

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

.movie-img::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(to top, var(--bg-card) 0%, transparent 100%);
  pointer-events: none;
}

.movie-info {
  padding: 1.3rem 1.3rem 1.5rem;
  position: relative;
}

h3 {
  font-family: "Space Grotesk", sans-serif;
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rating {
  color: #fbbf24;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
  letter-spacing: 1px;
}

.genre {
  color: #a855f7;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

.describe {
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.55;
  overflow: hidden;
}

@media (max-width: 900px) {
  .movie-grid {
    grid-template-columns: repeat(2, 1fr);
    align-items: center;
  }
}

@media (max-width: 560px) {
  .movie-grid {
    grid-template-columns: 1fr;

    nav ul .search-bar {
      width: 100%;
      margin-left: 0;
      margin-top: 0.4rem;
    }

    #Movies {
      max-width: 100%;
      padding: 2rem 1rem 3rem;
    }
  }
}

footer {
  background: linear-gradient(180deg, #0d0d0d 0%, #050505 100%);
  padding: 2.5rem 2rem;
  margin-top: 4rem;
  position: relative;
  overflow: hidden;
}

footer p {
  text-align: center;
  color: #e7e9ec;
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  letter-spacing: 0.3px;
}

.next-page {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.next-page button img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: brightness(0.8) grayscale(0.3);
  transition: all 0.3s ease;
}
.next-page button:hover img {
  filter: brightness(1.2) grayscale(0);
  transform: scale(1.1);
}

.next-page button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.end {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.end a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  height: 45px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.end a:hover::before {
  opacity: 1;
}

.end a:hover {
  transform: translateY(-5px) scale(1.08);
}

.end a img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: brightness(0.8) grayscale(0.3);
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.end a:hover img {
  filter: brightness(1.2) grayscale(0);
  transform: scale(1.1);
}

.end a:hover {
  border-color: #6e5494;
  box-shadow: 0 8px 24px rgba(175, 29, 15, 0.3);
  background: rgba(234, 223, 222, 0.1);
}

#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: black;
  backdrop-filter: blur(12px);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1.5rem;
}

#loading-overlay.active {
  display: flex;
  animation: fadeInOverlay 0.3s ease forwards;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.loader-content {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  margin-top: 50px;
}

.spinner {
  align-items: center;
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #a855f7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loader-text {
  font-family: "Space Grotesk", sans-serif;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin: 0;
  min-width: 260px;
  text-align: center;
}

.dots {
  display: inline-block;
  width: 24px;
  text-align: left;
}

.loader-sub {
  color: #a855f7;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0;
  opacity: 0.75;
  text-align: center;
}
