/**
 * Similar movies / series row on single templates: spacing, minimal poster frame, owl chrome.
 */

body.single-tm_movie .SingleRowBox.relatedPost,
body.single-tm_series .SingleRowBox.relatedPost {
  --tm-related-poster-h: 280px;
  margin-top: 2.75rem;
  margin-bottom: 2.25rem;
}

body.single-tm_movie .SingleRowBox.commentsPost,
body.single-tm_series .SingleRowBox.commentsPost {
  margin-top: 0.25rem;
}

body.single-tm_movie .SingleRowBox.relatedPost .archive_owl_slider.owl-carousel,
body.single-tm_series .SingleRowBox.relatedPost .archive_owl_slider.owl-carousel {
  position: relative;
  width: 100%;
}

/* Hide raw stacked items until Owl initializes */
body.single-tm_movie .SingleRowBox.relatedPost .archive_owl_slider.owl-carousel:not(.owl-loaded),
body.single-tm_series .SingleRowBox.relatedPost .archive_owl_slider.owl-carousel:not(.owl-loaded) {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  opacity: 0;
  max-height: calc(var(--tm-related-poster-h) + 80px);
}

body.single-tm_movie .SingleRowBox.relatedPost .archive_owl_slider.owl-loaded,
body.single-tm_series .SingleRowBox.relatedPost .archive_owl_slider.owl-loaded {
  opacity: 1;
  transition: opacity 0.25s ease;
}

body.single-tm_movie .SingleRowBox.relatedPost .title,
body.single-tm_series .SingleRowBox.relatedPost .title {
  margin-bottom: 0.35rem;
}

body.single-tm_movie .SingleRowBox.relatedPost .body,
body.single-tm_series .SingleRowBox.relatedPost .body {
  margin: 0 !important;
  width: 100% !important;
  max-width: 100%;
  padding: 0.25rem 0 1.25rem;
  box-sizing: border-box;
  display: block !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post:hover,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post:hover {
  transform: none !important;
  box-shadow: none !important;
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-stage-outer,
body.single-tm_series .SingleRowBox.relatedPost .owl-stage-outer {
  padding: 4px 0 12px;
  margin: 0;
  overflow: hidden;
  width: 100%;
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-stage,
body.single-tm_series .SingleRowBox.relatedPost .owl-stage {
  display: flex;
}

/* Equal-width slides; cards fill each column */
body.single-tm_movie .SingleRowBox.relatedPost .owl-item,
body.single-tm_series .SingleRowBox.relatedPost .owl-item {
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
  float: none;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post {
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

body.single-tm_movie .SingleRowBox.relatedPost .cover_link_loop,
body.single-tm_series .SingleRowBox.relatedPost .cover_link_loop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  height: 100%;
  text-decoration: none;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post .bgcover,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .bgcover,
body.single-tm_movie .SingleRowBox.relatedPost .body .item_loop_post .bgcover,
body.single-tm_series .SingleRowBox.relatedPost .body .item_loop_post .bgcover {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  margin: 0;
  height: var(--tm-related-poster-h) !important;
  min-height: 0 !important;
  max-height: var(--tm-related-poster-h) !important;
  aspect-ratio: unset !important;
  background: rgba(0, 0, 0, 0.35) !important;
  background-image: none !important;
  border: 1px solid rgba(0, 0, 0, 0.88) !important;
  border-radius: 12px !important;
  box-sizing: border-box;
  overflow: hidden !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28) !important;
  isolation: isolate;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post .bgcover img,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .bgcover img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center top !important;
  display: block !important;
  position: absolute;
  inset: 0;
}

/* Lighter bottom gradient so badges/labels/IMDb read clearly */
body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post .bgcover::after,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .bgcover::after {
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.42) 38%,
    rgba(0, 0, 0, 0.12) 68%,
    rgba(0, 0, 0, 0) 100%
  ) !important;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post:hover .bgcover,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post:hover .bgcover {
  transform: translateY(-2px) scale(1.01) !important;
  border-color: rgba(0, 0, 0, 0.92) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4) !important;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post .wf-poster-imdb,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .wf-poster-imdb {
  top: 0 !important;
  right: 0 !important;
  width: auto !important;
  height: auto !important;
  min-height: 1.55rem !important;
  padding: 0.3rem 0.46rem 0.34rem 0.5rem !important;
  transform: none !important;
  border-radius: 0 10px 0 12px !important;
  background: linear-gradient(160deg, #f5ce24 0%, #f0b90b 48%, #dba508 100%) !important;
  z-index: 8 !important;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post .wf-poster-title,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .wf-poster-title {
  bottom: 0 !important;
  left: 50% !important;
  right: auto !important;
  width: auto !important;
  max-width: calc(100% - 0.75rem) !important;
  padding: 0.26rem 0.52rem 0.3rem !important;
  border-radius: 10px 10px 0 0 !important;
  transform: translateX(-50%) !important;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post .badge_quality,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .badge_quality {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  transform: none !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0.28rem 0.48rem !important;
  font-size: 0.64rem !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  border-radius: 8px !important;
  text-align: center !important;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45) !important;
}

/* Series: keep season/episode top-left so they never stack over IMDB */
body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post .label_series,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .label_series {
  position: absolute !important;
  top: 7px !important;
  left: 6px !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  max-width: 52% !important;
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
  gap: 3px !important;
  padding: 0 !important;
  margin: 0 !important;
  z-index: 7 !important;
  pointer-events: none !important;
}

body.single-tm_movie .SingleRowBox.relatedPost .item_loop_post .label_series .item_label,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .label_series .item_label {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 100% !important;
  padding: 2px 6px !important;
  font-size: 0.55rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  border-radius: 5px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Prevent single-style off-screen label offsets from widening series slides */
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .bgcover .label_series .item_label.part_item,
body.single-tm_series .SingleRowBox.relatedPost .item_loop_post .bgcover .label_series .item_label.season_item {
  left: auto !important;
}

/* Override single-style absolute bottom_cover_loop so title/year sit below poster, not over IMDb */
body.single-tm_movie .SingleRowBox.relatedPost .cover_link_loop .bottom_cover_loop,
body.single-tm_series .SingleRowBox.relatedPost .cover_link_loop .bottom_cover_loop {
  position: relative !important;
  bottom: auto !important;
  right: auto !important;
  left: auto !important;
  top: auto !important;
  z-index: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  padding: 0.45rem 0.15rem 0.35rem;
  text-align: center;
  background: transparent;
  direction: rtl;
  box-sizing: border-box;
}

body.single-tm_movie .SingleRowBox.relatedPost .bottom_cover_loop h2,
body.single-tm_series .SingleRowBox.relatedPost .bottom_cover_loop h2 {
  margin: 0 !important;
  margin-top: 0 !important;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap !important;
  text-align: center !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.single-tm_movie .SingleRowBox.relatedPost .meta_loop_row,
body.single-tm_series .SingleRowBox.relatedPost .meta_loop_row {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-nav,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav {
  position: absolute;
  top: 38%;
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  pointer-events: none;
  transform: translateY(-50%);
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-nav button.owl-prev,
body.single-tm_movie .SingleRowBox.relatedPost .owl-nav button.owl-next,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav button.owl-prev,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav button.owl-next {
  pointer-events: auto;
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 13, 16, 0.82);
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.35rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-nav button.owl-prev:hover,
body.single-tm_movie .SingleRowBox.relatedPost .owl-nav button.owl-next:hover,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav button.owl-prev:hover,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav button.owl-next:hover {
  background: rgba(245, 173, 17, 0.15);
  border-color: rgba(245, 173, 17, 0.35);
  color: #f5ad11;
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-nav button.owl-prev,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav button.owl-prev {
  right: auto;
  left: 4px;
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-nav button.owl-next,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav button.owl-next {
  left: auto;
  right: 4px;
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-nav .owl-prev span,
body.single-tm_movie .SingleRowBox.relatedPost .owl-nav .owl-next span,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav .owl-prev span,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav .owl-next span {
  display: block;
  line-height: 1;
  margin-top: -2px;
}

body.single-tm_movie .SingleRowBox.relatedPost .owl-nav.disabled,
body.single-tm_series .SingleRowBox.relatedPost .owl-nav.disabled {
  display: none;
}

/* Responsive poster heights — aligned with archive genre grid */
@media screen and (max-width: 1024px) {
  body.single-tm_movie .SingleRowBox.relatedPost,
  body.single-tm_series .SingleRowBox.relatedPost {
    --tm-related-poster-h: 250px;
  }
}

@media screen and (max-width: 768px) {
  body.single-tm_movie .SingleRowBox.relatedPost,
  body.single-tm_series .SingleRowBox.relatedPost {
    --tm-related-poster-h: 220px;
  }
}

@media screen and (max-width: 480px) {
  body.single-tm_movie .SingleRowBox.relatedPost,
  body.single-tm_series .SingleRowBox.relatedPost {
    --tm-related-poster-h: 200px;
  }
}
