/**
 * Shared catalog / related video tiles (portrait poster + title + meta)
 * Used on watch page related row, home rows, browse grid/list, watchlist.
 */

/* SPA home (same shell as Browse: catalog cards + dark rail) */
.home-page--catalog {
  --home-header-height: var(--header-height, 68px);
  background: var(--color-background, #141414);
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.home-page--catalog .home-container {
  padding-bottom: 2.5rem;
}

/* Netflix-style full-viewport hero: image bleeds under fixed navbar */
.home-page--catalog .hero-section {
  position: relative;
  width: 100%;
  min-height: 100svh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  margin-top: calc(-1 * var(--home-header-height));
  padding-top: var(--home-header-height);
  box-sizing: border-box;
  transition: opacity 0.35s ease;
}

.home-page--catalog .hero-background {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.home-page--catalog .hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}

.home-page--catalog .hero-gradient {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      77deg,
      rgba(0, 0, 0, 0.82) 0%,
      rgba(0, 0, 0, 0.35) 45%,
      rgba(0, 0, 0, 0.15) 100%
    ),
    linear-gradient(to top, #141414 0%, rgba(20, 20, 20, 0) 50%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, transparent 40%);
}

.home-page--catalog .hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 0 0 clamp(3rem, 10vw, 5.5rem);
}

.home-page--catalog .hero-content .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-xl, 1.5rem);
}

.home-page--catalog .hero-info {
  max-width: 36rem;
}

.home-page--catalog .hero-title {
  margin: 0 0 0.85rem;
  font-size: clamp(2rem, 5.5vw, 3.75rem);
  font-weight: 800;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.85);
}

.home-page--catalog .hero-description {
  margin: 0 0 1.1rem;
  font-size: clamp(0.95rem, 1.9vw, 1.2rem);
  line-height: 1.55;
  color: #e5e5e5;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.75);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-page--catalog .hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.1rem;
  margin-bottom: 1.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

.home-page--catalog .hero-meta .hero-year {
  color: #46d369;
}

.home-page--catalog .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
}

.home-page--catalog .hero-actions .btn {
  min-height: 44px;
  padding: 0.65rem 1.35rem;
  font-weight: 700;
  border-radius: 4px;
}

.home-page--catalog .hero-actions .btn-play {
  gap: 0.5rem;
}

.home-page--catalog .hero-indicators {
  position: absolute;
  bottom: clamp(1rem, 3vw, 1.75rem);
  right: clamp(1rem, 4vw, 2.5rem);
  z-index: 3;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.home-page--catalog .hero-indicator {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.home-page--catalog .hero-indicator:hover {
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.6);
}

.home-page--catalog .hero-indicator.active {
  background: #fff;
  transform: scale(1.2);
}

.home-page--catalog .hero-placeholder {
  min-height: min(100svh, 100vh);
  margin-top: calc(-1 * var(--home-header-height));
  padding-top: var(--home-header-height);
  box-sizing: border-box;
  background: linear-gradient(165deg, #1f1f1f 0%, #0a0a0a 55%, #141414 100%);
}

@media (max-width: 640px) {
  .home-page--catalog .hero-section .hero-content .container {
    padding: 0 var(--spacing-md, 1rem);
  }

  .home-page--catalog .hero-indicators {
    right: 50%;
    transform: translateX(50%);
  }
}

/* Home: section chrome */
.category-row {
  padding: 1.25rem 0;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.category-link {
  font-size: 0.875rem;
  color: #b3b3b3;
  text-decoration: none;
  white-space: nowrap;
}

.category-link:hover {
  color: #fff;
}

.video-row-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.video-row-container .catalog-video-row {
  flex: 1;
  min-width: 0;
}

.scroll-button {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease;
}

.scroll-button:hover {
  background: rgba(0, 0, 0, 0.88);
}

@media (max-width: 640px) {
  .scroll-button {
    display: none;
  }
}

body.rtl .catalog-video-row.video-row {
  direction: rtl;
}

/* Section title — match watch “Related videos” */
.related-videos-title,
.category-row .category-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  color: #fff;
}

.related-videos-section {
  padding: 0 0 3rem;
  background: var(--color-background, #141414);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Horizontal rows (home category rails) */
.catalog-video-row.video-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0 0.75rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.catalog-video-row.video-row::-webkit-scrollbar {
  height: 6px;
}

.catalog-video-row.video-row::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.catalog-card-slot {
  position: relative;
  flex: 0 0 auto;
  width: min(160px, 44vw);
  outline: none;
}

.catalog-card-slot:focus-visible {
  outline: 2px solid var(--color-primary, #e50914);
  outline-offset: 4px;
  border-radius: 10px;
}

.catalog-card-watchlist {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.catalog-card-watchlist:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.08);
}

.catalog-card-watchlist.in-watchlist {
  background: rgba(229, 9, 20, 0.9);
}

.catalog-card-watchlist .icon {
  pointer-events: none;
}

body.rtl .catalog-card-watchlist {
  right: auto;
  left: 6px;
}

.catalog-card-featured {
  position: absolute;
  bottom: 6px;
  left: 6px;
  z-index: 2;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: var(--color-primary, #e50914);
  color: #fff;
}

/* Poster card (same as watch page related) */
.related-videos-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

@media (min-width: 768px) {
  .related-videos-row {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.related-video-card {
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  overflow: hidden;
  background: #1f1f1f;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: block;
  height: 100%;
}

.related-video-card:hover {
  transform: scale(1.04);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.related-video-thumb-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background: #2a2a2a;
  overflow: hidden;
}

.related-video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-video-info {
  padding: 0.65rem 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.related-video-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-video-meta {
  font-size: 0.75rem;
  color: #888;
}

/* Continue watching: progress on thumb */
.catalog-continue-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.5);
}

.catalog-continue-progress .progress-bar {
  height: 100%;
  background: var(--color-primary, #e50914);
  transition: width 0.3s ease;
}

/* Browse: grid uses same tile density as related */
.videos-grid.catalog-browse-grid.related-videos-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: var(--spacing-2xl, 2rem);
}

@media (min-width: 768px) {
  .videos-grid.catalog-browse-grid.related-videos-row {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* Browse: list mode — horizontal strip per title */
.videos-list.catalog-browse-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.videos-list.catalog-browse-list .catalog-card-slot {
  width: 100%;
  max-width: 100%;
}

.videos-list.catalog-browse-list .related-video-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  transform: none;
}

.videos-list.catalog-browse-list .related-video-card:hover {
  transform: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.videos-list.catalog-browse-list .related-video-thumb-wrap {
  width: 100px;
  min-width: 100px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
}

.videos-list.catalog-browse-list .related-video-info {
  flex: 1;
  justify-content: center;
  min-width: 0;
}

@media (min-width: 768px) {
  .videos-list.catalog-browse-list .related-video-thumb-wrap {
    width: 120px;
    min-width: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .related-video-card,
  .related-video-card:hover,
  .catalog-card-watchlist:hover {
    transition: none;
    transform: none;
  }
}
