/* ================================================================
   LISTA CAPÍTULOS — Layout Full-Width + Sidebar Ranking Sticky
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --card-primary: #7c3aed;
  --card-primary-dark: #6d28d9;
  --text-light: #f3f4f6;
  --text-muted: #9ca3af;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================================
   LAYOUT RAÍZ — Full-width, dos columnas
   ================================================================ */

.page-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  min-height: 100vh;
}

/* Columna principal */
.page-main {
  min-width: 0;
  padding: 0 1.5rem 3rem 2rem;
}

/* Sidebar derecho (Integrada y Fija) */
.page-sidebar {
  position: sticky;
  top: 64px;
  /* altura navbar */
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 1.5rem 1.5rem 1.5rem 1rem;
  border-left: 1px solid rgba(124, 58, 237, 0.12);
  background: rgba(10, 14, 20, 0.3);
  /* Más sutil para integración */
  backdrop-filter: blur(10px);
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 58, 237, 0.3) transparent;
}

.page-sidebar::-webkit-scrollbar {
  width: 4px;
}

.page-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.page-sidebar::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 4px;
}

/* ================================================================
   ENCABEZADOS DE SECCIÓN
   ================================================================ */

.section-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.2rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: -0.01em;
}

.section-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

/* ================================================================
   SECCIÓN NOVEDADES — Grid de portadas full-width
   ================================================================ */

#novedades {
  margin-bottom: 2.5rem;
}

.novedades-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.7rem;
}

.novedad-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 2/3;
  display: block;
  text-decoration: none;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition);
}

.novedad-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 16px 32px -8px rgba(124, 58, 237, 0.5);
  border-color: rgba(124, 58, 237, 0.5);
  z-index: 2;
}

.novedad-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.novedad-card:hover img {
  transform: scale(1.07);
}

.novedad-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(5, 8, 14, 0.9) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0.6rem 0.5rem 0.5rem;
}

.novedad-card__title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f3f4f6;
  line-height: 1.2;
  margin: 0 0 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.novedad-card__badge {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(124, 58, 237, 0.8);
  color: #ede9fe;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
}

.novedad-card__new-badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  background: #10b981;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.18rem 0.4rem;
  border-radius: 5px;
  letter-spacing: 0.06em;
  z-index: 1;
}

/* ================================================================
   SECCIÓN CATÁLOGO — Grid de tarjetas premium
   ================================================================ */

.episode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  align-items: stretch;
  /* Asegura que todas las cards en una fila estiren su altura */
}

/* ── Tarjeta individual ── */
.episode-card {
  background: linear-gradient(155deg, #0c1524, #101827);
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, 0.12);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Para que todas midan lo mismo en la grid */
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.episode-card:hover {
  transform: translateY(-6px);
  border-color: rgba(124, 58, 237, 0.5);
  box-shadow: 0 20px 40px -10px rgba(124, 58, 237, 0.3);
}

/* Thumbnail */
.episode-card .thumb {
  width: 100%;
  aspect-ratio: 2/3;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.episode-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.episode-card:hover .thumb img {
  transform: scale(1.06);
}

.thumb-badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  background: rgba(124, 58, 237, 0.85);
  backdrop-filter: blur(4px);
  color: #ede9fe;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.45rem;
  border-radius: 5px;
  z-index: 1;
}

.thumb-rating {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #FFB83B;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.18rem 0.4rem;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  z-index: 1;
}

/* Overlay en la portada con el título */
.thumb-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, transparent, rgba(5, 8, 14, 0.92));
  padding: 2rem 0.6rem 0.6rem;
  opacity: 0;
  transition: opacity 0.25s;
}

.episode-card:hover .thumb-info {
  opacity: 1;
}

/* Contenido debajo de la imagen */
.card-content {
  padding: 0.6rem 0.7rem 0.5rem;
  flex-grow: 1;
  /* Empuja el footer hacia abajo */
}

.episode-card h3 {
  margin: 0 0 0.2rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f3f4f6;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.episode-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* Footer de la tarjeta */
.card-footer {
  margin-top: auto;
  padding: 0 0.7rem 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.duration {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.duration i {
  color: #a78bfa;
}

.button-ver {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: 7px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.72rem;
  transition: var(--transition);
  box-shadow: 0 3px 10px -3px rgba(124, 58, 237, 0.55);
  white-space: nowrap;
}

.button-ver:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(124, 58, 237, 0.65);
}

/* ================================================================
   SIDEBAR — RANKING TOP 10
   ================================================================ */

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: linear-gradient(135deg, #0d1220, #111827);
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  text-decoration: none;
  color: var(--text-light);
  transition: var(--transition);
  position: relative;
}

.ranking-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 10px 0 0 10px;
  background: var(--card-primary);
  opacity: 0;
  transition: opacity 0.2s;
}

.ranking-item:hover {
  border-color: rgba(124, 58, 237, 0.35);
  transform: translateX(3px);
  background: linear-gradient(135deg, #10192b, #141e30);
}

.ranking-item:hover::before {
  opacity: 1;
}

.rank-num {
  font-size: 1.1rem;
  font-weight: 900;
  min-width: 22px;
  text-align: center;
  line-height: 1;
  flex-shrink: 0;
}

.rank-num.rank-1 {
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.rank-num.rank-2 {
  color: #C0C0C0;
}

.rank-num.rank-3 {
  color: #CD7F32;
}

.rank-num {
  color: #4b5563;
}

.rank-thumb {
  width: 36px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(124, 58, 237, 0.18);
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-title {
  font-weight: 700;
  font-size: 0.8rem;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.rank-rating {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  flex-shrink: 0;
}

.rank-score {
  font-size: 0.88rem;
  font-weight: 800;
  color: #FFB83B;
}

.rank-score .material-icons {
  font-size: 0.75rem;
  margin-right: 0.15rem;
  color: #FFB83B;
}

.rank-trend {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.rank-trend.up {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.rank-trend.down {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

.rank-trend.same {
  background: rgba(156, 163, 175, 0.1);
  color: #9ca3af;
}

/* Ranking Footer & Button */
.ranking-footer {
  margin-top: 1.5rem;
  padding: 0 0.5rem;
}

.button-ranking {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(139, 92, 246, 0.05));
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 8px;
  color: #c4b5fd;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.button-ranking:hover {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(139, 92, 246, 0.15));
  border-color: rgba(124, 58, 237, 0.6);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.button-ranking .material-icons {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.button-ranking:hover .material-icons {
  transform: translateX(4px);
}

/* ================================================================
   RESPONSIVE — tablet 1024px
   ================================================================ */
@media (max-width: 1024px) {
  .page-layout {
    grid-template-columns: 1fr 280px;
  }

  .page-main {
    padding: 0 1rem 3rem 1.5rem;
  }

  .novedades-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .episode-list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ================================================================
   RESPONSIVE — tablet 768px: sidebar pasa abajo
   ================================================================ */
@media (max-width: 768px) {
  .page-layout {
    display: block;
    /* O flex-direction: column */
  }

  .page-main {
    padding: 1rem 1rem 1.5rem;
    order: 1;
  }

  /* Simplificación de Cards en móvil: Solo Nombre, Tags y Estrellas */
  .episode-desc,
  .duration,
  .button-ver {
    display: none !important;
  }

  .card-footer {
    display: none !important;
    /* El footer ya no tiene contenido útil en móvil */
  }

  .card-content {
    padding-bottom: 0.8rem;
  }

  .page-sidebar {
    position: static;
    width: 100%;
    height: auto;
    overflow-y: visible;
    border-left: none;
    border-top: 1px solid rgba(124, 58, 237, 0.12);
    padding: 1.5rem 1rem;
    order: 2;
    background: rgba(10, 14, 20, 0.95);
    backdrop-filter: none;
  }

  .novedades-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }

  .episode-list {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
  }
}

/* ================================================================
   RESPONSIVE — móvil 480px
   ================================================================ */
@media (max-width: 480px) {
  .page-main {
    padding: 0.75rem 0.75rem 1.5rem;
  }

  .novedades-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }

  .episode-list {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.6rem;
  }
}

/* ================================================================
   RESPONSIVE — móvil pequeño 360px
   ================================================================ */
@media (max-width: 360px) {
  .novedades-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .episode-list {
    grid-template-columns: repeat(2, 1fr);
  }
}