/* ---------------------------------
   DETAIL PAGE
--------------------------------- */
.detail-page {
  position: relative;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
  padding-bottom: 0;
}

.detail-hero-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: min(76vh, 720px);
  min-height: 520px;
  background-size: cover;
  background-position: center 24%;
  pointer-events: none;
  z-index: 1;
}

.detail-hero-backdrop::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(to right, rgba(4, 4, 6, 0.98) 0%, rgba(4, 4, 6, 0.78) 38%, rgba(4, 4, 6, 0.28) 100%),
    linear-gradient(to top, var(--bg-primary) 0%, rgba(4, 4, 6, 0.72) 18%, rgba(4, 4, 6, 0.2) 72%, rgba(4, 4, 6, 0) 100%);
  z-index: 2;
}

.detail-content {
  position: relative;
  z-index: 3;
  width: min(100%, 1480px);
  max-width: 100%;
  margin: 0 auto;
  padding: clamp(78px, 9vh, 116px) clamp(20px, 5vw, 64px) clamp(16px, 2.5vw, 28px);
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.5vw, 32px);
  min-width: 0;
}

.detail-hero-main {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(36px, 5vw, 72px);
  min-height: clamp(430px, 54vh, 620px);
  min-width: 0;
}

.detail-poster {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 2/3;
  justify-self: start;
  align-self: center;
  margin-top: clamp(12px, 2vh, 28px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background-color: #0c0c10; /* Dark premium background for letterboxing/pillarboxing */
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-poster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  width: 100%;
  max-width: 860px;
  min-width: 0;
}

.detail-title {
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  max-width: 900px;
}

.detail-original-title {
  display: block;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 1.15rem;
  font-weight: 400;
}

.detail-episode-title {
  color: var(--text-secondary);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.35;
  max-width: 780px;
}

.detail-tagline {
  margin: 2px 0;
  color: var(--text-primary);
  opacity: 0.86;
  font-size: 1.08rem;
  font-style: italic;
}

.detail-metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-md);
  color: var(--text-secondary);
  font-size: 1rem;
}

.metadata-item {
  display: flex;
  align-items: center;
}

.metadata-item:not(:last-child)::after {
  content: '•';
  margin-left: var(--spacing-md);
}

.detail-genres {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.genre-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.detail-overview {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 780px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.detail-crew {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.detail-actions {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: nowrap;
  margin: 2px 0 4px;
}

@media (max-width: 992px) {
  .detail-hero-backdrop {
    height: 58vh;
    min-height: 480px;
    background-position: center top;
  }

  .detail-content {
    padding: 42px var(--spacing-md) 20px;
    gap: var(--spacing-lg);
  }

  .detail-hero-main {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: var(--spacing-lg);
  }

  .detail-poster {
    width: min(54vw, 210px);
    margin: 0 auto;
    justify-self: center;
  }

  .detail-info {
    align-items: center;
    max-width: 760px;
    margin: 0 auto;
  }

  .detail-title {
    font-size: 2.2rem;
    text-align: center;
  }

  .detail-original-title {
    font-size: 1rem;
  }

  .detail-episode-title {
    font-size: 1rem;
    text-align: center;
  }

  .detail-metadata, .detail-genres, .detail-actions {
    justify-content: center;
  }

  .detail-overview {
    text-align: center;
  }
}

@media (max-width: 600px) {
  .detail-content {
    padding-top: 30px;
  }

  .detail-poster {
    width: min(62vw, 190px);
  }

  .detail-title {
    font-size: 1.9rem;
  }
}

/* ---------------------------------
   EXTENDED DETAILS (CAST, SEASONS)
--------------------------------- */
.detail-cast-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  padding-top: 2px;
}

.detail-cast-section .carousel-header,
.cast-carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: 12px;
}

.carousel-arrows {
  display: flex;
  gap: var(--spacing-sm);
}

.carousel-arrow {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.carousel-arrow svg {
  fill: currentColor;
}

.carousel-arrow:hover:not(.disabled) {
  background: var(--text-primary);
  color: var(--bg-primary);
  transform: scale(1.05);
}

.carousel-arrow.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.cast-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cast-list {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-lg);
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  scroll-behavior: smooth;
  scroll-padding-inline: 4px;
  padding: 8px 4px 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  touch-action: pan-x pan-y;
}

.cast-list::-webkit-scrollbar {
  display: none;
}

.cast-card {
  flex: 0 0 112px;
  width: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.cast-card:hover {
  transform: translateY(-3px) scale(1.03);
  opacity: 0.95;
}

.cast-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--bg-tertiary);
  margin-bottom: var(--spacing-xs);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-sm);
}

.cast-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.cast-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

@media (max-width: 768px) {
  .detail-hero-backdrop {
    height: 64vh;
    min-height: 420px;
  }
  .detail-content {
    padding: 28px var(--spacing-md) 16px;
    gap: 18px;
  }
  .detail-hero-main {
    gap: 18px;
  }
  .detail-info {
    align-items: flex-start;
    text-align: left;
  }
  .detail-title {
    font-size: 2rem;
    text-align: left;
  }
  .detail-original-title,
  .detail-episode-title {
    text-align: left;
  }
  .detail-metadata,
  .detail-genres,
  .detail-actions {
    justify-content: flex-start;
  }
  .detail-metadata {
    gap: 8px 12px;
    font-size: 0.9rem;
  }
  .detail-overview {
    font-size: 0.98rem;
    line-height: 1.5;
    text-align: left;
  }
  .cast-title {
    font-size: 1.15rem;
  }
  .cast-card {
    flex-basis: 96px;
    width: 96px;
  }
  .cast-avatar {
    width: 70px;
    height: 70px;
  }
  .episodes-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
