/* ═══════════════════════════════════════════════════════════════════════
   STREAM WEB — Netflix-style CSS
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --bg:         #141414;
  --bg2:        #1f1f1f;
  --bg3:        #2a2a2a;
  --card-bg:    #222;
  --accent:     #e50914;
  --accent2:    #b00710;
  --text:       #fff;
  --text-muted: #aaa;
  --nav-h:      68px;
  --radius:     6px;
  --shadow:     0 4px 24px rgba(0,0,0,.7);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Netflix Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }
.flex   { display: flex; }
.center { align-items: center; justify-content: center; }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════════════════════ */
#screen-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.55)),
              url('../img/login-bg.jpg') center/cover no-repeat fixed;
  background-color: #111;
  padding: 1rem;
}

.login-box {
  background: rgba(0,0,0,.82);
  border-radius: 4px;
  padding: 2.5rem 3.5rem 3rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo img { height: 44px; }
.login-logo .login-brand {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}

.login-box h2 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .3rem; }
.form-group input {
  width: 100%;
  padding: .85rem 1rem;
  background: #333;
  border: 1px solid #555;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  transition: border-color .2s;
}
.form-group input:focus { outline: none; border-color: var(--accent); background: #3a3a3a; }

.btn-primary {
  display: block;
  width: 100%;
  padding: .9rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: background .2s, transform .1s;
}
.btn-primary:hover   { background: var(--accent2); }
.btn-primary:active  { transform: scale(.98); }

/* ── Remember me ─────────────────────────────────────────────────────────── */
.remember-row {
  margin-top: 1rem;
}
.remember-label {
  display: flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  font-size: .9rem;
  color: var(--text-muted);
  user-select: none;
  width: fit-content;
}
.remember-label:hover { color: var(--text); }

/* Hide default checkbox */
.remember-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Custom checkbox box */
.remember-checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 2px solid #666;
  border-radius: 3px;
  background: transparent;
  transition: background .15s, border-color .15s;
}
.remember-checkmark::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0;
  transition: opacity .1s;
}
.remember-label input:checked ~ .remember-checkmark {
  background: var(--accent);
  border-color: var(--accent);
}
.remember-label input:checked ~ .remember-checkmark::after { opacity: 1; }

.login-error {
  background: rgba(229,9,20,.15);
  border: 1px solid var(--accent);
  color: #ff6b6b;
  padding: .65rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
  display: none;
}
.login-error.show { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════════════════════════════════════ */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 4%;
  gap: 1.5rem;
  z-index: 100;
  transition: background .3s;
}
#navbar.scrolled     { background: var(--bg); box-shadow: 0 2px 12px rgba(0,0,0,.6); }
#navbar:not(.scrolled) { background: linear-gradient(to bottom, rgba(0,0,0,.65) 0%, transparent 100%); }

.nav-logo img  { height: 44px; }
.nav-logo .brand-text {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.nav-links { display: flex; gap: 1rem; }
.nav-links a {
  color: #e5e5e5;
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  padding: .3rem .2rem;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav-links a:hover,
.nav-links a.active { color: #fff; border-bottom-color: var(--accent); }

/* ── Dropdown Categorías ─────────────────────────────────────────────────── */
.nav-cat-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-cat-btn {
  background: none;
  border: none;
  color: #e5e5e5;
  font-size: .92rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: .3rem .2rem;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: .3rem;
  transition: color .2s, border-color .2s;
  white-space: nowrap;
}
.nav-cat-btn:hover,
.nav-cat-wrap.open .nav-cat-btn { color: #fff; }
.nav-cat-wrap.open .nav-cat-btn { border-bottom-color: var(--accent); }
.nav-chevron {
  font-size: .7rem;
  transition: transform .2s;
  display: inline-block;
}
.nav-cat-wrap.open .nav-chevron { transform: rotate(180deg); }

.nav-cat-dropdown {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,.97);
  border: 1px solid #333;
  border-radius: 6px;
  min-width: 200px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.85);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}
.nav-cat-wrap.open .nav-cat-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
/* Triángulo indicador */
.nav-cat-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top: none;
  border-bottom-color: #333;
}
.nav-cat-dropdown::after {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top: none;
  border-bottom-color: rgba(20,20,20,.97);
}
.nav-cat-item {
  padding: .55rem 1.1rem;
  cursor: pointer;
  font-size: .88rem;
  color: #ccc;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-cat-item:first-child { border-radius: 6px 6px 0 0; }
.nav-cat-item:last-child  { border-radius: 0 0 6px 6px; }
.nav-cat-item:hover       { background: #2d2d2d; color: #fff; }
.nav-cat-item.active      { color: var(--accent); font-weight: 600; }
.nav-cat-divider          { height: 1px; background: #333; margin: .3rem 0; }

.nav-right    { margin-left: auto; display: flex; align-items: center; gap: 1rem; }

/* ─── NAV SEARCH: solo lupa por defecto; se expande al hacer click ── */
.nav-search {
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: .25rem .3rem;
  transition: border-color .25s ease, background .25s ease;
  cursor: pointer;
}
.nav-search.open {
  border-color: #fff;
  background: rgba(0,0,0,.8);
  cursor: default;
}

/* Botón lupa */
.nav-search-btn {
  background: none;
  border: none;
  color: #e5e5e5;
  cursor: pointer;
  padding: .2rem .25rem;
  line-height: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: color .2s;
}
.nav-search-btn:hover          { color: #fff; }
.nav-search.open .nav-search-btn { pointer-events: none; }

/* Input colapsado */
.nav-search input {
  width: 0;
  min-width: 0;
  opacity: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: .9rem;
  padding: .3rem 0;
  transition: width .3s ease, opacity .2s ease, margin .3s ease;
  pointer-events: none;
}
.nav-search input:focus { outline: none; }

/* Input expandido */
.nav-search.open input {
  width: 220px;
  opacity: 1;
  margin-left: .5rem;
  pointer-events: auto;
}

.nav-user-name { font-size: .9rem; color: #e5e5e5; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── User dropdown menu ─────────────────────────────────────────────────── */
.user-menu { position: relative; }

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: 6px;
  transition: background .2s;
  color: #e5e5e5;
}
.user-menu-btn:hover { background: rgba(255,255,255,.08); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  flex-shrink: 0;
}
.user-avatar-lg {
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
}

.user-chevron {
  font-size: .7rem;
  color: var(--text-muted);
  transition: transform .2s;
}
.user-menu.open .user-chevron { transform: rotate(180deg); }

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  background: #1f1f1f;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.7);
  overflow: hidden;
  z-index: 200;
  animation: dropIn .15s ease;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-menu.open .user-dropdown { display: block; }

.user-dropdown-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
}
.user-dropdown-info span {
  font-size: .9rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-divider {
  border: none;
  border-top: 1px solid #333;
  margin: 0;
}

.user-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: #ccc;
  padding: .75rem 1rem;
  font-size: .9rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.user-dropdown-item:hover { background: rgba(229,9,20,.15); color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════════
   HERO BANNER
══════════════════════════════════════════════════════════════════════════ */
#hero {
  position: relative;
  isolation: isolate;   /* crea stacking context propio → z-index hijos evaluados aquí */
  height: 80vh;
  min-height: 520px;
  max-height: 780px;
  background-size: cover;
  background-position: center top;
  display: flex;
  align-items: flex-end;
  /* padding-bottom grande para que la info quede alta y deje espacio al listón MI LISTA */
  padding: 0 4% 18%;
}
/* Hero video trailer (autoplay muted background) */
.hero-video-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  opacity: 0;
  visibility: hidden;             /* + visibility para bloquear compositing por hardware */
  transition: opacity 1.2s ease;
}
.hero-video-wrap.playing {
  opacity: 1;
  visibility: visible;
}

/* Máscara exterior: cubre el iframe mientras YouTube muestra el overlay de pausa.
   transform:translateZ(0) sube la máscara a la misma capa GPU que el iframe de video,
   garantizando que quede ENCIMA incluso cuando el video usa hardware compositing.  */
#hero-cover {
  position: absolute;
  inset: 0;
  z-index: 9999;
  background: #141414;
  opacity: 0;                     /* transparente por defecto; JS lo gestiona */
  pointer-events: none;
  transform: translateZ(0);       /* fuerza la máscara a capa GPU propia */
  will-change: opacity;
}

.hero-video-wrap iframe {
  position: absolute;
  top: 50%;
  left: -9999px;                /* off-screen por defecto: clippeado por overflow:hidden */
  transform: translateY(-50%);  /* solo centrado vertical; JS pone left:50% cuando listo */
  width: 100vw;
  height: 56.25vw;   /* 16:9 */
  min-height: 100%;
  min-width: 177.78vh; /* 16:9 inverso */
  pointer-events: none;
}

/* Botón mute/unmute del hero */
.hero-sound-btn {
  position: absolute;
  bottom: 5%;
  right: 4%;
  z-index: 10001; /* encima del hero-cover (z:9999) */
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.6);
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, background .2s;
  backdrop-filter: blur(4px);
}
.hero-sound-btn:hover {
  border-color: #fff;
  background: rgba(0,0,0,.8);
}

#hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top,   #141414 0%, #141414 8%, rgba(20,20,20,.85) 28%, transparent 55%),
    linear-gradient(to right, rgba(0,0,0,.6) 20%, transparent 55%);
  z-index: 1;
}
.hero-info {
  position: relative;
  z-index: 10000; /* encima del hero-cover (z:9999) */
  max-width: 40%;
}
.hero-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 3px;
  letter-spacing: 1px;
  margin-bottom: .5rem;
  text-transform: uppercase;
}
.hero-title {
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: .75rem;
  text-shadow: 2px 2px 6px rgba(0,0,0,.7);
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
  color: #bbb;
  margin-bottom: .75rem;
}
.hero-meta .year  { color: #4caf50; font-weight: 600; }
.hero-meta .dur   { color: var(--text-muted); }

/* ── Clasificación (PG, R, TV-14…) y rating (★ 6.8/10) ─────────────────── */
.meta-rate {
  display: inline-block;
  background: #4a4a4a;
  color: #ddd;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: .4px;
  vertical-align: middle;
  line-height: 1.6;
}
.meta-star {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
}
.meta-star .star-icon  { color: #f5c518; font-size: 1rem; line-height: 1; }
.meta-star .star-denom { color: var(--text-muted); font-weight: 400; font-size: .78rem; }
/* Separador puntito entre campos del meta */
.meta-sep { color: #555; padding: 0 .2rem; }
.hero-synopsis {
  font-size: .95rem;
  color: #ccc;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.2rem;
}
.hero-buttons { display: flex; gap: .75rem; }
.btn-play {
  background: #fff;
  color: #000;
  border: none;
  padding: .65rem 1.8rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background .2s;
}
.btn-play:hover { background: rgba(255,255,255,.75); }
.btn-info {
  background: rgba(109,109,110,.7);
  color: #fff;
  border: none;
  padding: .65rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  transition: background .2s;
}
.btn-info:hover { background: rgba(109,109,110,.4); }

/* ══════════════════════════════════════════════════════════════════════════
   CONTENT ROWS
══════════════════════════════════════════════════════════════════════════ */
/* Sube los rows para solaparse con la parte baja del hero (efecto Netflix) */
#content-rows {
  padding: 0 4% 4rem;
  position: relative;
  z-index: 2;
  margin-top: -160px;
}

.content-row { margin-bottom: 2.5rem; }
.row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.row-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e5e5e5;
  cursor: pointer;
  transition: color .2s;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.row-title:hover { color: #fff; }
.row-title span { color: var(--accent); }
.row-more-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  color: #aaa;
  font-size: .8rem;
  font-weight: 600;
  padding: .3rem .85rem;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .3rem;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.row-more-btn:hover { border-color: #fff; color: #fff; }
.row-more-btn span { font-size: 1rem; }

/* Botón ← Volver en grid */
.grid-back-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.grid-back-btn:hover { background: rgba(255,255,255,.25); }
.grid-view-header {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.cards-strip {
  display: flex;
  gap: .5rem;
  overflow-x: auto;
  padding: 0 .75rem .5rem;
  scroll-padding-left: .75rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;          /* Firefox */
}
.cards-strip::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* CW cards más anchas por su ratio 16:9 */
.cw-strip .cw-card { flex: 0 0 300px; }

/* ── Flechas de navegación en listones ────────────────────────── */
.row-strip-wrap {
  position: relative;
}
.row-arrow {
  position: absolute;
  top: 0;
  bottom: .5rem;           /* mismo que el padding-bottom del strip */
  width: 56px;
  z-index: 10;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.row-arrow-left  { left: 0;
  background: linear-gradient(to right, rgba(20,20,20,.88) 10%, transparent 100%); }
.row-arrow-right { right: 0;
  background: linear-gradient(to left,  rgba(20,20,20,.88) 10%, transparent 100%); }

/* Mostrar al hacer hover en el row */
.content-row:hover .row-arrow:not(.row-arrow-off) {
  opacity: 1;
  pointer-events: auto;
}
.row-arrow:hover { opacity: 1 !important; }
.row-arrow.row-arrow-off {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Chevron SVG del botón */
.row-arrow-icon {
  width: 28px; height: 28px;
  stroke: #fff;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.9));
}

/* ── Barra de páginas (pager) ─────────────────────────────────── */
.strip-pager {
  display: flex;
  justify-content: flex-end;
  gap: 3px;
}
.strip-pager[hidden] { display: none; }
.strip-pager-seg {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.25);
  transition: background .3s, width .3s;
}
.strip-pager-seg.active {
  background: rgba(255,255,255,.85);
  width: 28px;
}

/* ── Content Card ─────────────────────────────────────────────────────── */
.card {
  flex: 0 0 200px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform .25s, box-shadow .25s, z-index 0s .25s;
  position: relative;
}
.card:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow);
  z-index: 10;
  transition: transform .25s, box-shadow .25s;
}

.card-thumb {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  object-position: top;
  display: block;
  background: var(--bg3);
}
/* Fallback placeholder */
.card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 2rem;
  gap: .5rem;
}
.card-thumb-placeholder small { font-size: .6rem; color: #444; text-align: center; padding: 0 .5rem; }

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.9) 0%, transparent 55%);
  opacity: 0;
  transition: opacity .25s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: .6rem;
}
.card:hover .card-overlay { opacity: 1; }

/* Fila de botones dentro del overlay */
.card-overlay-btns {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .35rem;
}

.card-title {
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  margin-bottom: .2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-year { font-size: .68rem; color: rgba(255,255,255,.55); }
.card-play-btn {
  background: #fff;
  border: none;
  color: #000;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: .45rem;
  transition: background .2s, transform .1s;
}
.card-play-btn:hover { background: rgba(255,255,255,.8); transform: scale(1.08); }

/* Cuando está dentro de card-overlay-btns, el margen lo maneja el contenedor */
.card-overlay-btns .card-play-btn { margin-bottom: 0; }

/* ── Backdrop image (landscape 16:9) para Continuar viendo ───────────── */
.card-backdrop {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  object-position: center;
  display: block;
  background: var(--bg3);
}
.card-backdrop-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 2rem;
  gap: .5rem;
}
.card-backdrop-placeholder small { font-size: .6rem; color: #444; text-align: center; padding: 0 .5rem; }

/* ── Continuar viendo: barra de progreso y botón quitar ──────────────── */
.cw-card { position: relative; }
.cw-progress-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.2);
  z-index: 2;
}
.cw-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  min-width: 4px;
  transition: width .3s;
}
.cw-remove-btn {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.7);
  color: #ccc;
  font-size: .65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  z-index: 5;
}
.cw-card:hover .cw-remove-btn { opacity: 1; }

/* Mi Lista — cards landscape más anchas (backdrop 16:9) */
.ml-card { flex: 0 0 280px; }

/* ── Botón Favoritos (❤) en cards ────────────────────────────────────── */
.fav-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.5);
  background: rgba(20,20,20,.55);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: border-color .2s, background .2s, transform .15s;
  line-height: 1;
}
.fav-btn:hover {
  border-color: rgba(255,255,255,.9);
  background: rgba(20,20,20,.75);
  transform: scale(1.08);
}
.fav-btn.fav-active {
  border-color: rgba(255,255,255,.5);
  background: rgba(20,20,20,.55);
  color: #fff;
}
.fav-btn.fav-active:hover {
  border-color: rgba(255,255,255,.9);
  background: rgba(20,20,20,.75);
}

/* ── Card info row (rating + year + dur) ──────────────────────────────── */
.card-info-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  margin-top: .1rem;
}
.card-star-rating {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: .68rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.4;
}
.card-star {
  color: #f5c518;
  font-size: .72rem;
  line-height: 1;
}
.card-star-denom {
  font-size: .58rem;
  color: rgba(255,255,255,.5);
  font-weight: 400;
}
.card-rate-badge {
  font-size: .62rem;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 3px;
  padding: 1px 4px;
  line-height: 1.4;
  letter-spacing: .02em;
}
.card-info-dot {
  font-size: .65rem;
  color: rgba(255,255,255,.65);
  line-height: 1.4;
}
.card-info-dot + .card-info-dot::before {
  content: '·';
  margin-right: .3rem;
  color: rgba(255,255,255,.35);
}

/* ── Botón "Mi Lista" en el modal ────────────────────────────────────── */
.modal-action-btns { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn-mylist {
  background: rgba(109,109,110,.7);
  color: #fff;
  border: none;
  padding: .65rem 1.4rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: .45rem;
  transition: background .2s, color .2s;
}
.btn-mylist:hover { background: rgba(109,109,110,.4); }
.btn-mylist.fav-active { color: #fff; }
.btn-mylist.fav-active:hover { color: var(--accent); }

/* ── Vista Mi Lista ──────────────────────────────────────────────────── */
.fav-heart-title { color: var(--accent); margin-left: .3rem; }

.favorites-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
  width: 100%;
  color: var(--text-muted);
}
.favorites-empty-icon {
  font-size: 3.5rem;
  color: var(--accent);
  opacity: .4;
  margin-bottom: 1rem;
}
.favorites-empty h3 { font-size: 1.4rem; color: #fff; margin-bottom: .5rem; font-weight: 600; }
.favorites-empty p  { font-size: .95rem; color: var(--text-muted); }

/* ── Favorites sections ───────────────────────────────────────────────── */
.favorites-section {
  margin-bottom: 2.5rem;
}
.favorites-section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 4% 1.2rem;
}
.favorites-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: .02em;
}
.favorites-section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(255,255,255,.25), transparent);
}

/* ── Live TV Cards (landscape) ────────────────────────────────────────── */
.card-live {
  flex: 0 0 240px;
  aspect-ratio: unset;
}
.card-live .card-thumb {
  aspect-ratio: 16/9;
}
.card-live-logo-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}
.card-live-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card-live-number {
  position: absolute;
  top: .4rem; left: .4rem;
  background: rgba(0,0,0,.7);
  color: var(--text-muted);
  font-size: .7rem;
  padding: .1rem .4rem;
  border-radius: 3px;
}
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 3px;
  letter-spacing: .5px;
}
.live-badge::before {
  content: '●';
  font-size: .5rem;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ══════════════════════════════════════════════════════════════════════════
   DETAIL MODAL
══════════════════════════════════════════════════════════════════════════ */
#detail-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
}
/* ── Modal box ─────────────────────────────────────────── */
.modal-box {
  position: relative;
  background: #141414;
  border-radius: 12px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.95);
}
.modal-close {
  position: absolute;
  top: .9rem; right: .9rem;
  z-index: 20;
  background: rgba(20,20,20,.85);
  border: 2px solid rgba(255,255,255,.15);
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #e50914; border-color: #e50914; }

/* ── Hero (fondo desenfocado + poster + info) ─────────── */
.modal-hero {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}
.modal-hero-bg {
  position: absolute;
  inset: -10px;           /* oversize para ocultar blur edges */
  background-size: cover;
  background-position: center top;
  filter: blur(18px) brightness(.28) saturate(1.4);
  z-index: 0;
}
.modal-hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.1) 0%, #141414 100%);
  z-index: 1;
}
.modal-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 1.75rem;
  align-items: flex-end;
  padding: 2rem 2rem 1.75rem;
}

/* ── Poster portrait ──────────────────────────────────── */
.modal-poster-wrap {
  flex: 0 0 160px;
  width: 160px;
}
.modal-poster-img {
  width: 160px;
  aspect-ratio: 2/3;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,.8);
  display: block;
}
.modal-poster-ph {
  width: 160px;
  aspect-ratio: 2/3;
  border-radius: 8px;
  background: linear-gradient(135deg,#1e1e1e,#2a2a2a);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: #555;
  box-shadow: 0 8px 30px rgba(0,0,0,.8);
}

/* ── Info al lado del poster ──────────────────────────── */
.modal-hero-info {
  flex: 1;
  padding-bottom: .25rem;
}
.modal-title {
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: .6rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.modal-meta {
  display: flex;
  gap: .6rem;
  font-size: .85rem;
  color: #aaa;
  margin-bottom: 1.25rem;
  align-items: center;
  flex-wrap: wrap;
}
.modal-meta .green { color: #4caf50; font-weight: 700; }

/* ── Body: sinopsis ───────────────────────────────────── */
.modal-body  { padding: 1.25rem 2rem 2rem; }
.modal-synopsis { font-size: .93rem; color: #ccc; line-height: 1.8; }

/* ── Botón Tráiler ────────────────────────────────────── */
.btn-trailer {
  background: rgba(220, 38, 38, .85);
  color: #fff;
  border: none;
  padding: .65rem 1.4rem;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .45rem;
  transition: background .2s;
}
.btn-trailer:hover { background: rgba(185, 28, 28, .95); }
.btn-trailer.loading { opacity: .6; pointer-events: none; }

/* ── Trailer Modal (YouTube lightbox) ─────────────────── */
#trailer-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.trailer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.88);
  backdrop-filter: blur(6px);
}
.trailer-box {
  position: relative;
  width: 100%;
  max-width: 900px;
  z-index: 1;
}
.trailer-close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.trailer-close:hover { background: var(--accent); }
.trailer-iframe-wrap {
  position: relative;
  padding-top: 56.25%; /* 16:9 */
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.9);
}
.trailer-iframe-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Cast / Reparto ───────────────────────────────────── */
.modal-cast {
  margin: .75rem 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.modal-cast-row {
  display: flex;
  gap: .6rem;
  font-size: .88rem;
  line-height: 1.5;
}
.modal-cast-label {
  color: #aaa;
  font-weight: 600;
  white-space: nowrap;
  min-width: 64px;
}
.modal-cast-val {
  color: #ddd;
}

/* Series episodes list */
.season-selector { margin-bottom: 1rem; }
.season-selector select {
  background: #333;
  color: #fff;
  border: 1px solid #555;
  padding: .4rem .8rem;
  border-radius: 4px;
  font-size: .9rem;
  cursor: pointer;
}
.episodes-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 2px;
}
.episode-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: .75rem .8rem;
  background: #1e1e1e;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s;
  border: 1px solid transparent;
}
.episode-item:hover         { background: #2a2a2a; border-color: #3a3a3a; }
.episode-item.ep-no-stream  { cursor: default; opacity: .5; }
.ep-num   {
  color: var(--text-muted);
  font-size: .85rem;
  min-width: 2rem;
  text-align: center;
  padding-top: .1rem;
  font-weight: 600;
}
.ep-info  { flex: 1; min-width: 0; }
.ep-title { font-size: .9rem; font-weight: 600; margin-bottom: .2rem; }
.ep-meta  {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.ep-meta .meta-rate  { font-size: .68rem; padding: 1px 6px; }
.ep-meta .meta-star  { font-size: .8rem; }
.ep-meta .meta-star .star-icon  { font-size: .85rem; }
.ep-meta .meta-star .star-denom { font-size: .72rem; }
.ep-syn   {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ep-play  {
  flex-shrink: 0;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .1rem;
  transition: background .2s, transform .15s;
}
.ep-play:hover { background: var(--accent2); transform: scale(1.1); }
.ep-no-url { color: #555; font-size: .8rem; }

/* ══════════════════════════════════════════════════════════════════════════
   VIDEO PLAYER MODAL
══════════════════════════════════════════════════════════════════════════ */
#player-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #000;
  display: flex;
  flex-direction: column;
}
.player-top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 1rem 1.5rem;
  background: linear-gradient(to bottom, rgba(0,0,0,.8) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 2;
}
.player-back-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .5rem;
  border-radius: 4px;
  transition: background .2s;
}
.player-back-btn:hover { background: rgba(255,255,255,.15); }
.player-title-bar { font-size: 1rem; font-weight: 600; }

#main-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: #ccc;
  text-align: center;
  padding: 2rem;
  display: none;
}
.player-error.show { display: flex; }
.player-error h3 { font-size: 1.5rem; color: var(--accent); }

/* ══════════════════════════════════════════════════════════════════════════
   LOADING / SPINNER
══════════════════════════════════════════════════════════════════════════ */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 500;
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid #333;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-muted); font-size: .95rem; }

/* ══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
══════════════════════════════════════════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: #fff;
  padding: .75rem 1.5rem;
  border-radius: 4px;
  font-size: .9rem;
  z-index: 600;
  transition: transform .35s cubic-bezier(.2,.8,.3,1);
  box-shadow: var(--shadow);
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════════════════════════════════════════
   VIEW CONTAINERS
══════════════════════════════════════════════════════════════════════════ */
/* Home: el hero se extiende bajo el navbar transparente (sin padding-top).
   El resto de las vistas compensan en su .grid-view-header. */
#screen-app { padding-top: 0; }

.view { display: none; }
.view.active { display: block; }

/* Vista dedicada de búsqueda — ocupa pantalla completa debajo del navbar fijo */
#view-search {
  padding: calc(var(--nav-h) + 1.5rem) 4% 4rem;
  min-height: 100vh;
}

/* Películas / Series / Mi Lista / TV En Vivo — vistas sin hero.
   El padding-top incluye la altura del navbar fijo + espacio visual. */
.grid-view-header {
  padding: calc(var(--nav-h) + 2rem) 4% 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.grid-view-header h2 { font-size: 1.8rem; font-weight: 800; }

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  padding: 0 4% 3rem;
}
.content-grid .card { flex: unset; width: 100%; }
/* Canal en grid (Mi Lista): mantiene ratio landscape y logo llena el card */
.content-grid .card-live { aspect-ratio: 16/9; }
.content-grid .card-live .card-live-logo-wrap {
  aspect-ratio: unset;
  height: 100%;
  width: 100%;
}

/* Live TV list view */
.livetv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  padding: 1.5rem 4% 3rem;
}
.livetv-grid .card-live { flex: unset; width: 100%; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .hero-info { max-width: 80%; }
  .hero-synopsis { display: none; }
  .nav-links { display: none; }
  .nav-search.open input { width: 150px; }
  .login-box { padding: 2rem 1.5rem; }
  .modal-box { max-height: 95vh; }
  .modal-hero-content { flex-direction: column; align-items: center; text-align: center; padding: 1.5rem 1.25rem 1.5rem; }
  .modal-poster-wrap { flex: unset; width: 130px; }
  .modal-poster-img  { width: 130px; }
  .modal-poster-ph   { width: 130px; }
  .modal-meta        { justify-content: center; }
  .modal-body        { padding: 1rem 1.25rem 1.5rem; }
  .card { flex: 0 0 140px; }
  .card-live { flex: 0 0 180px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESUME DIALOG
══════════════════════════════════════════════════════════════════════════ */
#resume-dialog {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#resume-dialog.hidden { display: none; }

.resume-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(4px);
}

.resume-box {
  position: relative;
  background: #1c1c1c;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  padding: 2rem 2rem 1.75rem;
  width: 90%;
  max-width: 400px;
  text-align: center;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: resume-in .22s ease;
}
@keyframes resume-in {
  from { opacity: 0; transform: scale(.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.resume-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 .4rem;
}

.resume-subtitle {
  color: #aaa;
  font-size: .9rem;
  margin: 0 0 1.6rem;
}

.resume-buttons {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.resume-btn-continue {
  width: 100%;
  padding: .8rem 1rem;
  font-size: 1rem;
}

.resume-btn-restart {
  width: 100%;
  padding: .75rem 1rem;
  font-size: .95rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .25);
  color: #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.resume-btn-restart:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

/* Grid full de Continuar Viendo — cards landscape en múltiples filas */
.cw-full-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 0 4% 4rem;
}
.cw-full-grid .cw-card {
  flex: unset;
  width: 100%;
}
