/* Khmer Insider — single episode watch page
   Ported from Figma export (D:\video page\style.css), scoped under
   .khmer-insider-watch-page so it can't leak into the rest of the site.
   Mirrors styles/template/unlock-the-life-template.css. */

.khmer-insider-watch-page * {
  box-sizing: border-box;
}

.khmer-insider-watch-page {
  background: #ffffff;
  font-family: 'Battambang', 'Khmer OS', 'Noto Sans Khmer', sans-serif;
  color: #303030;
}

.site-content__inner > .khmer-insider-watch-page {
  flex: 0 0 100%;
  max-width: 100%;
}

.khmer-insider-watch-page img {
  display: block;
  max-width: 100%;
}

.khmer-insider-watch-page button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.khmer-insider-watch-page a {
  text-decoration: none;
  color: inherit;
}

/* ---------- Container ---------- */
.khmer-insider-watch-page .container {
  /* max-width: 1252px; */
  margin: 0 auto;
  padding: 24px 24px 0;
}

.khmer-insider-watch-page .content-row {
  display: grid;
  grid-template-columns: 1fr 331px;
  column-gap: 12px;
  align-items: start;
}

.khmer-insider-watch-page .main-column {
  grid-column: 1;
  min-width: 0;
}

.khmer-insider-watch-page .video-block {
  padding-top: 0px;
}

.khmer-insider-watch-page .video-wrapper {
  width: 100%;
}

.khmer-insider-watch-page .video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 909 / 512.81;
  background: #000000;
  overflow: hidden;
}

.khmer-insider-watch-page .video-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Next-episode popup (shown when the player ends) ---------- */
.khmer-insider-watch-page .khi-next-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px;
  background: rgba(19, 23, 34, 0.92);
}

.khmer-insider-watch-page .khi-next-head {
  color: #ffffff;
  font-size: 22px;
  font-weight: 600;
}

.khmer-insider-watch-page .khi-next-grid {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 960px;
  justify-content: center;
}

.khmer-insider-watch-page .khi-next-item {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  max-width: 320px;
  color: #ffffff;
  text-decoration: none;
}

.khmer-insider-watch-page .khi-next-item .khi-next-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #000000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.khmer-insider-watch-page .khi-next-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.2s ease;
}

.khmer-insider-watch-page .khi-next-item:hover img {
  transform: scale(1.05);
}

.khmer-insider-watch-page .khi-next-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: rgba(0, 0, 0, 0.25);
}

.khmer-insider-watch-page .khi-next-item:hover .khi-next-play {
  opacity: 1;
}

.khmer-insider-watch-page .khi-next-play svg {
  width: 48px;
  height: 48px;
}

.khmer-insider-watch-page .khi-next-item p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.khmer-insider-watch-page .khi-next-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Desktop/tablet show 3 "next" episodes; phones show 2. */
@media (max-width: 768px) {
  .khmer-insider-watch-page .khi-next-overlay {
    padding: 20px;
    gap: 16px;
  }

  .khmer-insider-watch-page .khi-next-head {
    font-size: 16px;
  }

  .khmer-insider-watch-page .khi-next-item:nth-child(3) {
    display: none;
  }

  .khmer-insider-watch-page .khi-next-grid {
    gap: 12px;
  }

  .khmer-insider-watch-page .khi-next-item p {
    font-size: 12px;
    line-height: 16px;
  }
}

.khmer-insider-watch-page .video-meta {
  margin-top: 12px;
  max-width: 620px;
}

.khmer-insider-watch-page .video-title {
  margin: 0;
  font-weight: 400;
  font-size: 20px;
  line-height: 30px;
  color: #303030;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.khmer-insider-watch-page .video-sub {
  margin: 0;
  font-size: 12px;
  line-height: 30px;
  color: rgba(27, 31, 38, 0.72);
}

.khmer-insider-watch-page .box-title {
  margin: 0;
  font-weight: 400;
  font-size: 20px;
  line-height: 30px;
  color: #303030;
}

/* ---------- Description ---------- */
.khmer-insider-watch-page .description-box {
  margin-top: 10px;
  background: #efefef;
  padding: 24px 30px;
}

.khmer-insider-watch-page .description-text {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 22px;
  color: #303030;
}

/* ---------- About ---------- */
.khmer-insider-watch-page .about-box {
  margin-top: 15px;
  background: #efefef;
  padding: 34px 35px;
}

.khmer-insider-watch-page .about-inner {
  display: flex;
  gap: 31px;
  align-items: flex-start;
}

.khmer-insider-watch-page .about-thumb {
  flex: 0 0 139px;
  width: 139px;
  height: 244px;
  object-fit: cover;
}

.khmer-insider-watch-page .about-content {
  flex: 1;
  min-width: 0;
}

.khmer-insider-watch-page .about-schedule {
  margin: 0;
  font-size: 12px;
  line-height: 30px;
  color: rgba(27, 31, 38, 0.72);
}

.khmer-insider-watch-page .about-text {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.8;
  color: #303030;
  text-align: justify;
}

/* ---------- Sidebar ---------- */
.khmer-insider-watch-page .sidebar {
  grid-column: 2;
  width: 331px;
}

.khmer-insider-watch-page .season-select {
  position: relative;
}

.khmer-insider-watch-page .season-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
  background: #ffffff;
  border: 2px solid #bdc3c7;
  border-radius: 4px;
  padding: 10px 30px;
  color: #717171;
  font-size: 16px;
  line-height: 35px;
  cursor: pointer;
}

.khmer-insider-watch-page .chevron {
  width: 10px;
  height: 5px;
  transform: rotate(90deg);
  transition: transform 0.2s ease;
}

.khmer-insider-watch-page .season-select-btn.open .chevron {
  transform: rotate(-90deg);
}

.khmer-insider-watch-page .season-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  background: #ffffff;
  border: 2px solid #bdc3c7;
  border-radius: 4px;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  display: none;
  max-height: 240px;
  overflow-y: auto;
}

.khmer-insider-watch-page .season-select-btn.open + .season-dropdown {
  display: block;
}

.khmer-insider-watch-page .season-dropdown li {
  padding: 0;
}

.khmer-insider-watch-page .season-dropdown li a {
  display: block;
  padding: 8px 30px;
  font-size: 16px;
  color: #717171;
  cursor: pointer;
}

.khmer-insider-watch-page .season-dropdown li:hover a {
  background: #f0f2f4;
}

.khmer-insider-watch-page .season-dropdown li.active a {
  color: #1b1f26;
  font-weight: 600;
  background: #efefef;
}

.khmer-insider-watch-page .episode-panel {
  margin-top: 12px;
  background: #efefef;
  height: 724px;
  overflow-y: auto;
  scrollbar-width: auto;
  scrollbar-color: #b7bec7 #efefef;
}

.khmer-insider-watch-page .episode-panel::-webkit-scrollbar {
  width: 10px;
}

.khmer-insider-watch-page .episode-panel::-webkit-scrollbar-track {
  background: #efefef;
}

.khmer-insider-watch-page .episode-panel::-webkit-scrollbar-thumb {
  background-color: #b7bec7;
  border-radius: 6px;
  border: 2px solid #efefef;
}

.khmer-insider-watch-page .episode-panel::-webkit-scrollbar-thumb:hover {
  background-color: #97a1ad;
}

.khmer-insider-watch-page .episode-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 0;
}

.khmer-insider-watch-page .episode-panel-toggle {
  display: none;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
}

.khmer-insider-watch-page .episode-panel-toggle .chevron {
  width: 10px;
  height: 5px;
  transform: rotate(-90deg);
  transition: transform 0.2s ease;
}

.khmer-insider-watch-page .episode-panel-toggle.collapsed .chevron {
  transform: rotate(90deg);
}

.khmer-insider-watch-page .episode-panel.collapsed {
  height: auto;
  overflow: visible;
}

.khmer-insider-watch-page .episode-panel.collapsed .episode-list {
  display: none;
}

.khmer-insider-watch-page .episode-panel.collapsed .episode-panel-head {
  padding-bottom: 12px;
}

.khmer-insider-watch-page .show-title {
  margin: 0;
  font-size: 24px;
  line-height: 30px;
  color: rgba(27, 31, 38, 0.72);
}

.khmer-insider-watch-page .show-sub {
  margin: 0;
  font-size: 15px;
  line-height: 30px;
  color: rgba(27, 31, 38, 0.72);
}

.khmer-insider-watch-page .episode-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.khmer-insider-watch-page .episode-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #d1d9e2;
  cursor: pointer;
}

.khmer-insider-watch-page .episode-item:last-child {
  border-bottom: none;
}

.khmer-insider-watch-page .episode-item.active {
  background: #dadada;
}

.khmer-insider-watch-page .episode-item:hover {
  background: #e2e2e2;
}

.khmer-insider-watch-page .episode-thumb {
  flex: 0 0 92px;
  width: 92px;
  height: 52px;
  object-fit: contain;
  background: #000000;
}

.khmer-insider-watch-page .episode-info {
  flex: 1;
  min-width: 0;
}

.khmer-insider-watch-page .episode-title {
  margin: 0;
  font-size: 12px;
  line-height: 18px;
  color: #000000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.khmer-insider-watch-page .episode-meta {
  margin: 2px 0 0;
  font-size: 10px;
  line-height: 15px;
  color: #5a5d62;
}

/* ---------- Ads banner (full-bleed) ---------- */
.khmer-insider-watch-page .ads-banner {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  min-height: 250px;
  margin-top: 10px;
  background: #131722;
  display: flex;
  align-items: center;
  justify-content: center;
}

.khmer-insider-watch-page .ads-banner.no-ads {
  min-height: 0;
  height: 0;
  margin-top: 0;
  overflow: hidden;
}

.khmer-insider-watch-page .ads-inner {
  text-align: center;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 48px;
  line-height: 50px;
}

.khmer-insider-watch-page .ads-inner span {
  font-size: 36px;
  color: #9aa3b8;
}

/* =========================================================
   Dark mode — site-wide night toggle adds "night" to <body>
   (see vodi-child/darkmode.js). Palette matches the values
   vodi-child/style.css already uses for body.night elsewhere.
   ========================================================= */
body.night .khmer-insider-watch-page {
  background: #1f1f1f;
  color: #d3d3d3;
}

body.night .khmer-insider-watch-page .video-title,
body.night .khmer-insider-watch-page .box-title,
body.night .khmer-insider-watch-page .description-text,
body.night .khmer-insider-watch-page .about-text,
body.night .khmer-insider-watch-page .episode-title {
  color: #d3d3d3;
}

body.night .khmer-insider-watch-page .video-sub,
body.night .khmer-insider-watch-page .about-schedule,
body.night .khmer-insider-watch-page .show-title,
body.night .khmer-insider-watch-page .show-sub,
body.night .khmer-insider-watch-page .episode-meta {
  color: #bdc3c7;
}

body.night .khmer-insider-watch-page .description-box,
body.night .khmer-insider-watch-page .about-box,
body.night .khmer-insider-watch-page .episode-panel,
body.night .khmer-insider-watch-page .season-select-btn,
body.night .khmer-insider-watch-page .season-dropdown {
  background: #262626;
}

body.night .khmer-insider-watch-page .episode-panel {
  border-color: gray;
  scrollbar-color: #6b6b6b #262626;
}

body.night .khmer-insider-watch-page .episode-panel::-webkit-scrollbar-track {
  background: #262626;
}

body.night .khmer-insider-watch-page .episode-panel::-webkit-scrollbar-thumb {
  background-color: #6b6b6b;
  border-color: #262626;
}

body.night .khmer-insider-watch-page .episode-panel::-webkit-scrollbar-thumb:hover {
  background-color: #888888;
}

body.night .khmer-insider-watch-page .episode-item {
  border-bottom-color: gray;
}

body.night .khmer-insider-watch-page .episode-item.active {
  background: #333333;
}

body.night .khmer-insider-watch-page .episode-item:hover {
  background: #2c2c2c;
}

body.night .khmer-insider-watch-page .season-select-btn,
body.night .khmer-insider-watch-page .season-dropdown {
  border-color: gray;
  color: #bdc3c7;
}

body.night .khmer-insider-watch-page .season-dropdown li a {
  color: #bdc3c7;
}

body.night .khmer-insider-watch-page .season-dropdown li:hover a {
  background: #333333;
}

body.night .khmer-insider-watch-page .season-dropdown li.active a {
  color: #ffffff;
  background: #333333;
}

/* =========================================================
   Tablet breakpoint (769px–1024px)
   Keeps the desktop's 2-column (video + sidebar) layout — just
   narrower — instead of dropping straight to the mobile single
   -column stack. Only viewports at or below 768px (tablet
   portrait and phones) get the full stack below.
   ========================================================= */
@media (max-width: 1024px) {
  .khmer-insider-watch-page .container {
    padding: 20px 16px 0;
  }

  .khmer-insider-watch-page .content-row {
    grid-template-columns: 1fr 260px;
    column-gap: 12px;
  }

  .khmer-insider-watch-page .sidebar {
    width: 260px;
  }

  .khmer-insider-watch-page .video-meta {
    max-width: 100%;
  }

  .khmer-insider-watch-page .episode-panel {
    height: 560px;
  }

  .khmer-insider-watch-page .about-inner {
    gap: 20px;
  }

  .khmer-insider-watch-page .about-thumb {
    flex: 0 0 110px;
    width: 110px;
    height: 193px;
  }

  .khmer-insider-watch-page .about-box,
  .khmer-insider-watch-page .description-box {
    padding: 20px;
  }

  .khmer-insider-watch-page .ads-banner {
    min-height: 180px;
  }

  .khmer-insider-watch-page .ads-inner {
    font-size: 32px;
    line-height: 36px;
  }

  .khmer-insider-watch-page .ads-inner span {
    font-size: 24px;
  }
}

/* =========================================================
   Tablet-portrait / phone breakpoint (<=768px)
   The Figma file only defines a >1440px "Desktop" frame and a
   390px "Mobile" frame (no dedicated tablet frame). The Mobile
   frame's own stacking order — video, then episode list, then
   description/about — is reused here via grid-template-areas
   since it is the design's own intent for narrow viewports.
   ========================================================= */
@media (max-width: 768px) {
  .khmer-insider-watch-page .container {
    padding: 16px 16px 0;
  }

  .khmer-insider-watch-page .content-row {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "video"
      "sidebar"
      "lower";
    row-gap: 24px;
  }

  .khmer-insider-watch-page .main-column {
    display: contents;
  }

  .khmer-insider-watch-page .video-block {
    grid-area: video;
    padding-top: 0;
  }

  .khmer-insider-watch-page .lower-content {
    grid-area: lower;
  }

  .khmer-insider-watch-page .sidebar {
    grid-area: sidebar;
    width: 100%;
  }

  .khmer-insider-watch-page .episode-panel {
    height: auto;
    max-height: none;
    overflow-y: visible;
  }

  .khmer-insider-watch-page .episode-panel-toggle {
    display: flex;
  }

  .khmer-insider-watch-page .about-inner {
    flex-direction: column;
    align-items: center;
  }

  .khmer-insider-watch-page .about-thumb {
    flex: 0 0 auto;
    width: 160px;
    height: 280px;
  }

  .khmer-insider-watch-page .about-box,
  .khmer-insider-watch-page .description-box {
    padding: 20px;
  }

  .khmer-insider-watch-page .ads-banner {
    min-height: 150px;
  }

  .khmer-insider-watch-page .ads-inner {
    font-size: 28px;
    line-height: 32px;
  }

  .khmer-insider-watch-page .ads-inner span {
    font-size: 20px;
  }
}

/* ---------- Small phones (bonus, kept minimal) ---------- */
@media (max-width: 600px) {
  .khmer-insider-watch-page .video-title {
    white-space: normal;
  }

  .khmer-insider-watch-page .about-inner {
    align-items: stretch;
  }

  .khmer-insider-watch-page .about-thumb {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    aspect-ratio: 139 / 244;
  }
}
