/* ============================================================
   NETFLIX CLONE — CSS MOBILE-FIRST
   Fonte: Bebas Neue (títulos) + Barlow (corpo)
   ============================================================ */

:root {
  --red: #e50914;
  --red-dark: #b20710;
  --black: #0d0d0d;
  --surface: #141414;
  --surface2: #1f1f1f;
  --text: #e5e5e5;
  --text-muted: #a0a0a0;
  --navbar-h: 56px;
  --radius: 4px;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--black);
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 15px;
  overflow-x: hidden;
  min-height: 100vh;
}

img {
  display: block;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 2px;
}

/* ============================================================
   NAVBAR
   ============================================================ */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--navbar-h);
  padding: 0 4%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent);
  transition: background 0.4s;
  z-index: 900;
}

header.scrolled {
  background: var(--surface);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
}

.logo {
  width: 80px;
  flex-shrink: 0;
  cursor: pointer;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Nav desktop */
.nav-desktop {
  display: none;
}

.nav-desktop ul {
  display: flex;
  list-style: none;
  gap: 22px;
}

.nav-desktop ul li {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-desktop ul li:hover,
.nav-desktop ul li.active {
  color: #fff;
}

.nav-desktop ul li.active {
  border-bottom: 2px solid var(--red);
  padding-bottom: 2px;
}

/* Hamburger mobile */
.nav-mobile-menu {
  display: flex;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Search */
.search-container {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  height: 32px;
  padding: 0 8px;
  gap: 6px;
  transition: all 0.3s;
  cursor: pointer;
}

.search-container.open {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.6);
}

.search-icon {
  color: #fff;
  font-size: 0.85rem;
}

#movie-search {
  background: transparent;
  border: none;
  color: #fff;
  outline: none;
  width: 0;
  font-size: 0.82rem;
  font-family: 'Barlow', sans-serif;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-container.open #movie-search {
  width: 160px;
}

.icon {
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
  transition: color 0.2s;
}

.icon:hover {
  color: #fff;
}

/* User menu */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.user-menu>img {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  object-fit: cover;
}

.user-menu .fa-caret-down {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.user-menu:hover .fa-caret-down {
  transform: rotate(180deg);
}

.dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: rgba(10, 10, 10, 0.97);
  border: 1px solid #2a2a2a;
  width: 190px;
  display: none;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
}

.user-menu:hover .dropdown {
  display: block;
}

.dropdown-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
}

.dropdown-user img {
  width: 36px;
  border-radius: var(--radius);
}

.dropdown-user span {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

.dropdown hr {
  border: none;
  border-top: 1px solid #2a2a2a;
}

.dropdown p {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  padding: 11px 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.dropdown p:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.dropdown p.logout:hover {
  color: var(--red);
}

.dropdown p i {
  width: 14px;
  text-align: center;
}

/* ===== MOBILE DRAWER ===== */
.mobile-drawer {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  width: 260px;
  height: calc(100vh - var(--navbar-h));
  background: rgba(10, 10, 10, 0.98);
  border-right: 1px solid #222;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 800;
  overflow-y: auto;
  padding: 20px 0;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer ul {
  list-style: none;
}

.mobile-drawer ul li {
  font-size: 1rem;
  font-weight: 500;
  padding: 14px 24px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.mobile-drawer ul li:hover,
.mobile-drawer ul li.active {
  color: #fff;
  border-left-color: var(--red);
  background: rgba(255, 255, 255, 0.04);
}

.drawer-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 16px 0;
  background: var(--surface2);
  border: 1px solid #333;
  border-radius: var(--radius);
  padding: 8px 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-search i {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.drawer-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.85rem;
  font-family: 'Barlow', sans-serif;
  min-width: 80px;
}

.drawer-search select {
  width: 100%;
  background: transparent;
  border: none;
  border-top: 1px solid #333;
  padding-top: 8px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.drawer-search select option {
  background: #1a1a1a;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 799;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ============================================================
   BANNER
   ============================================================ */
.banner {
  position: relative;
  width: 100%;
  /* Mobile: altura compacta */
  height: 56vw;
  min-height: 260px;
  max-height: 380px;
  background-size: cover;
  background-position: center 20%;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-end;
}

/* Gradiente do banner */
.banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.1) 60%),
    linear-gradient(to top, var(--black) 0%, rgba(0, 0, 0, 0.3) 40%, transparent 100%);
}

.banner-fade {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--black));
  pointer-events: none;
}

.banner-content {
  position: relative;
  z-index: 2;
  padding: 0 4% 28px;
  max-width: 100%;
}

.banner-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.banner-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.8rem, 6vw, 4.5rem);
  line-height: 1;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
}

.banner-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.match {
  color: #46d369;
  font-size: 0.78rem;
  font-weight: 600;
}

.year {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.badge {
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  letter-spacing: 0.05em;
}

.banner-description {
  display: none;
  /* oculto no mobile */
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text);
  max-width: 380px;
  margin-bottom: 14px;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.banner-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-play,
.btn-info {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Barlow', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-play {
  background: #fff;
  color: #000;
}

.btn-play:hover {
  background: rgba(255, 255, 255, 0.8);
}

.btn-info {
  background: rgba(109, 109, 110, 0.65);
  color: #fff;
  backdrop-filter: blur(4px);
}

.btn-info:hover {
  background: rgba(109, 109, 110, 0.4);
}

.btn-mute {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  margin-left: auto;
}

.btn-mute:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ============================================================
   CONTAINER + FILEIRAS
   ============================================================ */
.container {
  padding: 0 0 48px;
  position: relative;
  z-index: 2;
  margin-top: -10px;
}

.row {
  margin-bottom: 8px;
  padding: 0 4%;
}

.row h2 {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 10px;
  transition: color 0.3s;
  cursor: default;
}

.row:hover h2 {
  color: #fff;
}

.row-label-netflix {
  color: var(--red);
}

.row-wrapper {
  position: relative;
  /* Overflow nos lados para setas ficarem dentro */
  overflow: hidden;
}

.row-posters {
  display: flex;
  gap: 6px;
  padding: 4px 0 8px;
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

/* POSTER PADRÃO (backdrop 16:9) */
.poster {
  flex-shrink: 0;
  width: 140px;
  height: 79px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 350ms ease, box-shadow 350ms ease;
  background: var(--surface2);
}

.poster:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

/* POSTER GRANDE (vertical 2:3 — Originais) */
.poster-large {
  width: 110px;
  height: 165px;
}

/* Setas do carrossel */
.handle {
  position: absolute;
  top: 4px;
  height: calc(100% - 12px);
  width: 36px;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  color: #fff;
  font-size: 1rem;
  z-index: 10;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.25s;
  backdrop-filter: blur(4px);
}

.handle i {
  pointer-events: none;
}

.row-wrapper:hover .handle {
  opacity: 1;
}

.handle:hover {
  background: rgba(0, 0, 0, 0.85);
  font-size: 1.1rem;
}

.handle-left {
  left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.handle-right {
  right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

/* Classes de filtro */
.hidden-movie {
  display: none !important;
}

.hidden-row {
  display: none !important;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: 8px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  overflow-y: auto;
  transform: scale(0.92);
  transition: transform 0.3s;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
}

.modal-overlay.open .modal {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(30, 30, 30, 0.85);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(60, 60, 60, 0.95);
}

.modal-backdrop {
  width: 100%;
  height: 200px;
  background-size: cover;
  background-position: center 20%;
}

.modal-body {
  padding: 18px 20px 24px;
}

.modal-body h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.modal-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.modal-body p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   TABLET — 600px+
   ============================================================ */
@media (min-width: 600px) {
  :root {
    --navbar-h: 60px;
  }

  .logo {
    width: 88px;
  }

  /* Banner maior */
  .banner {
    height: 50vw;
    max-height: 480px;
    background-position: center 25%;
  }

  .banner-description {
    display: block;
  }

  .banner-title {
    font-size: clamp(2.2rem, 5vw, 4rem);
  }

  .btn-play,
  .btn-info {
    padding: 10px 24px;
    font-size: 0.95rem;
  }

  /* Posters maiores */
  .poster {
    width: 180px;
    height: 101px;
  }

  .poster-large {
    width: 130px;
    height: 195px;
  }

  .row-posters {
    gap: 8px;
  }

  .row h2 {
    font-size: 1rem;
  }

  .handle {
    width: 44px;
    font-size: 1.1rem;
  }
}

/* ============================================================
   DESKTOP — 900px+
   ============================================================ */
@media (min-width: 900px) {
  :root {
    --navbar-h: 68px;
  }

  .logo {
    width: 100px;
  }

  /* Mostra nav desktop, esconde hamburger */
  .nav-desktop {
    display: flex;
  }

  .nav-mobile-menu {
    display: none;
  }

  /* Busca desktop expande no hover */
  #movie-search {
    width: 0;
  }

  .search-container:hover #movie-search,
  .search-container.open #movie-search {
    width: 180px;
  }

  /* Banner full */
  .banner {
    height: 82vh;
    min-height: 480px;
    max-height: 780px;
    background-position: center center;
    align-items: center;
  }

  .banner::before {
    background:
      linear-gradient(to right, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.2) 55%, transparent 100%),
      linear-gradient(to top, var(--black) 0%, transparent 40%);
  }

  .banner-content {
    padding: 0 5% 0;
    max-width: 560px;
  }

  .banner-label {
    font-size: 0.75rem;
  }

  .banner-description {
    display: block;
    font-size: 1rem;
    max-width: 440px;
    margin-bottom: 20px;
  }

  .banner-buttons {
    gap: 12px;
  }

  .btn-play,
  .btn-info {
    padding: 11px 28px;
    font-size: 1rem;
  }

  /* Posters desktop */
  .poster {
    width: 220px;
    height: 124px;
  }

  .poster-large {
    width: 160px;
    height: 240px;
  }

  .row-posters {
    gap: 10px;
  }

  .row h2 {
    font-size: 1.2rem;
  }

  .row {
    margin-bottom: 12px;
  }

  /* Handle aparece só no hover */
  .handle {
    opacity: 0;
    width: 52px;
    font-size: 1.3rem;
  }

  .row-wrapper:hover .handle {
    opacity: 1;
  }

  .container {
    margin-top: -60px;
  }
}

/* ============================================================
   TRAILER PLAYER — TELA CHEIA
   Adicionar ao final do style.css
   ============================================================ */

#trailer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

#trailer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.trailer-wrapper {
  position: relative;
  width: 100%;
  max-width: 1100px;
  padding: 0 16px;
}

.trailer-close {
  position: absolute;
  top: -44px;
  right: 16px;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  z-index: 10;
}

.trailer-close:hover {
  background: var(--red);
  border-color: var(--red);
  transform: rotate(90deg);
}

.trailer-iframe-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.9);
}

.trailer-iframe-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Loading */
.trailer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 56.25vw;
  max-height: 620px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.trailer-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Sem trailer */
.trailer-no-video {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 300px;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: var(--surface2);
  border-radius: 6px;
}

.trailer-no-video i {
  font-size: 3rem;
  color: #333;
}

/* Animação de entrada do wrapper */
#trailer-overlay .trailer-wrapper {
  transform: scale(0.94) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#trailer-overlay.open .trailer-wrapper {
  transform: scale(1) translateY(0);
}

/* ============================================================
   WIDE — 1280px+
   ============================================================ */
@media (min-width: 1280px) {
  .poster {
    width: 240px;
    height: 135px;
  }

  .poster-large {
    width: 180px;
    height: 270px;
  }

  .banner {
    height: 85vh;
  }

  .banner-content {
    max-width: 620px;
  }

  .banner-description {
    font-size: 1.05rem;
    max-width: 480px;
  }
}