/* =========================
   RESET
========================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}


html {
  scroll-behavior: smooth;
}


body {
  font-family: Arial, Helvetica, sans-serif;

  background: #080808;

  color: white;
}


/* =========================
   HEADER
========================= */

.header {
  height: 70px;

  display: flex;

  align-items: center;

  padding: 0 5%;

  gap: 40px;

  background:
    rgba(8, 8, 8, 0.97);

  border-bottom:
    1px solid #222;

  position: sticky;

  top: 0;

  z-index: 1000;
}


/* =========================
   LOGO
========================= */

.logo {
  font-size: 24px;

  font-weight: 900;

  letter-spacing: 3px;

  white-space: nowrap;

  cursor: pointer;
}


/* =========================
   NAVEGACIÓN
========================= */

.nav {
  display: flex;

  gap: 25px;
}


.nav a {
  color: #bbb;

  text-decoration: none;

  transition:
    color 0.2s;
}


.nav a:hover {
  color: white;
}


/* =========================
   ACCIONES DEL HEADER
========================= */

.header-actions {
  margin-left: auto;

  display: flex;

  align-items: center;

  gap: 16px;
}


/* =========================
   BUSCADOR
========================= */

.search {
  margin-left: 0;
}


.search input {
  width: 230px;

  padding: 10px 14px;

  background: #151515;

  border:
    1px solid #333;

  border-radius: 8px;

  color: white;

  outline: none;

  transition:
    border-color 0.2s,
    background 0.2s;
}


.search input::placeholder {
  color: #777;
}


.search input:focus {
  border-color: #777;

  background: #1b1b1b;
}


/* =========================
   PERFIL
========================= */

.profile {
  position: relative;

  display: flex;

  align-items: center;

  cursor: pointer;
}


/* =========================
   IMAGEN DEL PERFIL
========================= */

.profile-avatar-img {
  width: 42px;

  height: 42px;

  border-radius: 50%;

  object-fit: cover;

  display: block;

  border:
    2px solid #333;

  transition:
    transform 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
}


.profile-avatar-img:hover {
  transform:
    scale(1.08);

  border-color: white;

  box-shadow:
    0 0 15px
    rgba(255,255,255,0.18);
}


/* =========================
   MENÚ DEL PERFIL
========================= */

.profile-menu {
  position: absolute;

  top: 54px;

  right: 0;

  width: 210px;

  display: none;

  flex-direction: column;

  gap: 5px;

  padding: 15px;

  background:
    rgba(15,15,15,0.98);

  border:
    1px solid #333;

  border-radius: 10px;

  box-shadow:
    0 15px 40px
    rgba(0,0,0,0.85);

  z-index: 2000;
}


.profile-menu strong {
  color: white;

  font-size: 15px;
}


.profile-menu span {
  color: #888;

  font-size: 13px;
}


.profile:hover .profile-menu {
  display: flex;
}


/* =========================
   CARRUSEL
========================= */

.hero-carousel {
  position: relative;

  width: 100%;

  height: 560px;

  overflow: hidden;
}


/* =========================
   SLIDES
========================= */

.hero-slide {
  position: absolute;

  inset: 0;

  display: flex;

  align-items: center;

  padding:
    60px 7%;

  background-size: cover;

  background-position: center;

  opacity: 0;

  visibility: hidden;

  transition:
    opacity 0.6s ease,
    visibility 0.6s ease;
}


.hero-slide.active {
  opacity: 1;

  visibility: visible;
}


/* =========================
   CONTENIDO DEL HERO
========================= */

.hero-content {
  max-width: 620px;

  z-index: 2;
}


.hero-content h1 {
  font-size: 58px;

  line-height: 1.05;

  margin-bottom: 18px;
}


.hero-content p {
  color: #ddd;

  font-size: 20px;

  line-height: 1.7;

  margin-bottom: 25px;
}


/* =========================
   BOTÓN VER AHORA
========================= */

.play-button {
  background: white;

  color: black;

  border: none;

  border-radius: 8px;

  padding:
    14px 22px;

  font-size: 16px;

  font-weight: bold;

  cursor: pointer;

  transition:
    transform 0.2s,
    background 0.2s;
}


.play-button:hover {
  transform:
    scale(1.05);

  background: #eaeaea;
}


/* =========================
   FLECHAS DEL CARRUSEL
========================= */

.carousel-btn {
  position: absolute;

  top: 50%;

  transform:
    translateY(-50%);

  width: 48px;

  height: 48px;

  border: none;

  border-radius: 50%;

  background:
    rgba(0,0,0,0.45);

  color: white;

  font-size: 28px;

  cursor: pointer;

  z-index: 5;

  transition:
    background 0.2s;
}


.carousel-btn:hover {
  background:
    rgba(0,0,0,0.78);
}


.carousel-btn.prev {
  left: 20px;
}


.carousel-btn.next {
  right: 20px;
}


/* =========================
   INDICADORES
========================= */

.carousel-indicators {
  position: absolute;

  left: 50%;

  bottom: 22px;

  transform:
    translateX(-50%);

  display: flex;

  gap: 10px;

  z-index: 5;
}


.indicator {
  width: 12px;

  height: 12px;

  border-radius: 50%;

  background:
    rgba(255,255,255,0.4);

  transition:
    background 0.2s,
    transform 0.2s;
}


.indicator.active {
  background: white;

  transform:
    scale(1.08);
}


/* =========================
   CONTENEDOR GENERAL
========================= */

.container {
  width: 90%;

  margin:
    50px auto;
}


.container h2 {
  font-size: 26px;

  margin-bottom: 25px;
}


/* =========================
   CATÁLOGO
========================= */

.movies {
  display: grid;

  grid-template-columns:
    repeat(
      auto-fill,
      minmax(180px,1fr)
    );

  gap: 25px;
}


/* =========================
   TARJETAS
========================= */

.movie-card {
  background: #121212;

  border-radius: 12px;

  overflow: hidden;

  cursor: pointer;

  transition:
    transform 0.25s,
    box-shadow 0.25s;
}


.movie-card:hover {
  transform:
    translateY(-8px)
    scale(1.02);

  box-shadow:
    0 15px 40px
    rgba(0,0,0,0.7);
}


/* =========================
   POSTERS
========================= */

.movie-card img {
  width: 100%;

  aspect-ratio:
    2 / 3;

  object-fit: cover;

  display: block;
}


/* =========================
   INFO DE PELÍCULA
========================= */

.movie-info {
  padding: 15px;
}


.movie-info h3 {
  font-size: 17px;

  margin-bottom: 6px;
}


.movie-info p {
  color: #888;

  font-size: 14px;
}


/* =========================
   DETALLE DE PELÍCULA
========================= */

.movie-detail {
  width: 90%;

  max-width: 1100px;

  margin:
    70px auto;

  display: flex;

  gap: 50px;

  align-items: flex-start;
}


.detail-poster {
  width: 300px;

  border-radius: 14px;
}


.detail-info {
  max-width: 650px;
}


.detail-info h1 {
  font-size: 48px;

  margin-bottom: 10px;
}


.detail-info > p:first-of-type {
  color: #888;

  margin-bottom: 30px;
}


.description {
  color: #ccc;

  line-height: 1.7;

  font-size: 18px;

  margin-bottom: 30px;
}


/* =========================
   REPRODUCTOR
========================= */

.player-container {
  display: none;

  margin-top: 30px;

  width: 100%;

  aspect-ratio:
    16 / 9;
}


.player-container iframe {
  width: 100%;

  height: 100%;

  border: none;

  border-radius: 12px;

  background: black;
}


/* =========================
   LOGIN
========================= */

.login-page {
  min-height: 100vh;

  display: flex;

  align-items: center;

  justify-content: center;

  background: #050505;
}


.login-box {
  width: 360px;

  background: #111;

  padding: 40px;

  border-radius: 14px;

  display: flex;

  flex-direction: column;

  gap: 18px;

  text-align: center;
}


.login-box h1 {
  letter-spacing: 4px;
}


.login-box p {
  color: #888;
}


.login-box input {
  padding: 14px;

  background: #191919;

  border:
    1px solid #333;

  border-radius: 8px;

  color: white;

  outline: none;
}


.login-box input:focus {
  border-color: #777;
}


.login-box button {
  padding: 14px;

  border: none;

  border-radius: 8px;

  background: white;

  color: black;

  font-weight: bold;

  cursor: pointer;
}


.login-box button:hover {
  background: #e6e6e6;
}


#errorMessage {
  color: #ff5b5b;
}


/* =========================
   FOOTER
========================= */

.footer {
  padding: 40px;

  text-align: center;

  color: #666;

  border-top:
    1px solid #1c1c1c;
}


/* =========================
   TABLET
========================= */

@media (max-width: 950px) {

  .header {
    gap: 22px;

    padding:
      0 3%;
  }


  .search input {
    width: 180px;
  }


  .hero-content {
    max-width: 550px;
  }


  .hero-content h1 {
    font-size: 48px;
  }


  .hero-content p {
    font-size: 18px;
  }

}


/* =========================
   MÓVIL
========================= */

@media (max-width: 700px) {

  .header {
    height: 64px;

    gap: 12px;

    padding:
      0 15px;
  }


  .logo {
    font-size: 19px;

    letter-spacing: 2px;
  }


  .nav {
    display: none;
  }


  .header-actions {
    gap: 8px;
  }


  .search input {
    width: 145px;

    padding:
      9px 11px;
  }


  .profile-avatar-img {
    width: 36px;

    height: 36px;
  }


  .profile-menu {
    top: 46px;

    width: 190px;
  }


  .hero-carousel {
    height: 460px;
  }


  .hero-slide {
    padding:
      50px 55px;
  }


  .hero-content h1 {
    font-size: 39px;
  }


  .hero-content p {
    font-size: 16px;

    line-height: 1.55;
  }


  .carousel-btn {
    width: 40px;

    height: 40px;

    font-size: 22px;
  }


  .carousel-btn.prev {
    left: 8px;
  }


  .carousel-btn.next {
    right: 8px;
  }


  .movies {
    grid-template-columns:
      repeat(2,1fr);

    gap: 15px;
  }


  .movie-detail {
    flex-direction: column;

    align-items: center;
  }


  .detail-info {
    text-align: center;
  }


  .detail-info h1 {
    font-size: 36px;
  }


  .detail-poster {
    width: 250px;
  }

}


/* =========================
   MÓVILES PEQUEÑOS
========================= */

@media (max-width: 430px) {

  .search input {
    width: 115px;
  }


  .logo {
    font-size: 17px;
  }


  .hero-content h1 {
    font-size: 33px;
  }


  .hero-slide {
    padding:
      45px;
  }


  .movies {
    grid-template-columns:
      repeat(
        2,
        minmax(0,1fr)
      );
  }

}

/* =========================
   TRAILER AUTOMÁTICO
========================= */

.hero-trailer {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.7s ease,
    visibility 0.7s ease;

  z-index: 0;

  background: black;
}


.hero-slide.trailer-playing .hero-trailer {
  opacity: 1;
  visibility: visible;
}


.hero-youtube {
  position: absolute;

  top: 50%;
  left: 50%;

  width: 155%;
  height: 120%;

  transform: translate(-50%, -50%);

  border: none;

  pointer-events: none;
}


.hero-content {
  position: relative;

  z-index: 3;
}


.hero-slide::after {
  content: "";

  position: absolute;

  inset: 0;

  background:
    linear-gradient(
      to right,
      rgba(0,0,0,0.88) 0%,
      rgba(0,0,0,0.55) 40%,
      rgba(0,0,0,0.15) 75%
    );

  z-index: 2;

  pointer-events: none;
}


.carousel-btn,
.carousel-indicators {
  z-index: 10;
}


@media (max-width: 700px) {

  .hero-youtube {
    width: 180%;
    height: 100%;
  }

}

.mute-button {
  position: absolute;

  right: 28px;
  bottom: 28px;

  width: 46px;
  height: 46px;

  border-radius: 50%;

  border: 1px solid rgba(255, 255, 255, 0.45);

  background: rgba(0, 0, 0, 0.48);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  z-index: 20;

  backdrop-filter: blur(6px);

  transition:
    background 0.2s,
    transform 0.2s,
    border-color 0.2s;
}

.mute-button:hover {
  background: rgba(0, 0, 0, 0.75);

  border-color: white;

  transform: scale(1.08);
}

.sound-icon {
  width: 22px;
  height: 22px;

  fill: white;
}

.hidden {
  display: none;
}

@media (max-width: 700px) {

  .mute-button {
    width: 40px;
    height: 40px;

    right: 14px;
    bottom: 18px;
  }

  .sound-icon {
    width: 19px;
    height: 19px;
  }

}

/* =========================
   OCULTAR INFO DEL HERO
   DURANTE EL TRAILER
========================= */

.hero-content {
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
}

.hero-slide.hide-info .hero-content {
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
}