/* 播放頁版面（video.js、sideTabs.js）：.video-page、.video-main、上方列、分頁；分隔線欄的內容是時間軸（video/timeline.css）。 */

/* ── 04 播放頁 ──────────────────────────────────────── */
.video-page { display: flex; height: calc(100vh - var(--header-h) - 1px); height: calc(100dvh - var(--header-h) - 1px); min-height: 0; }
.video-topbar { display: none; }
.video-main { flex: 1; min-width: 0; overflow: auto; padding: var(--sp-20) var(--sp-32) var(--sp-32); display: flex; flex-direction: column; gap: var(--sp-16); }
/* 播放頁與分享頁的上方列（refresh-video-page-ui、unify-share-page-player）：桌機橫跨播放欄與筆記面板；手機隱藏（改用 .video-topbar） */
.video-header { display: none; }
/* 返回連結＝daisyUI btn-ghost：只設尺寸、字色與 hover 底色變數（Swing 的半透明底改設 --btn-bg，見 themes/swing.css） */
.video-header__back { flex: none; --size: 32px; --btn-p: var(--sp-8); --radius-field: var(--r-8); --btn-rest-fg: var(--c-text-2); --btn-fg: var(--c-text-2); --fontsize: var(--fs-14); padding-inline-end: var(--sp-12); gap: var(--sp-8); font-weight: 500; }
.video-header__back:hover { --btn-bg: var(--c-page); --btn-fg: var(--c-text); --btn-rest-fg: var(--c-text); }
/* R10：視覺維持 32px 高，以 ::before 把可點範圍擴到 44px 高（手機已是 44px，兩者相同） */
.video-header__back { position: relative; }
.video-header__back::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.video-header__title { flex: 1; min-width: 0; margin: 0; font-size: var(--fs-18); font-weight: 600; line-height: 1.4; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-header__context { flex: none; display: inline-flex; align-items: baseline; gap: var(--sp-8); max-width: 40%; font-size: var(--fs-14); font-weight: 500; color: var(--c-text-2); white-space: nowrap; }
.video-header__group { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.video-header__actions { flex: none; display: flex; align-items: center; gap: var(--sp-8); }
/* 分享鈕＝daisyUI btn-outline＋btn-sm＋btn-bordered：只設變數 */
.video-header__share { --btn-p: var(--sp-12); --radius-field: var(--r-8); --btn-color: var(--c-float-bg); --fontsize: var(--fs-14); gap: var(--sp-8); }
/* 桌機：章節／循環分頁面板（播放器以下剩餘高度、最小 160px，只捲動內容；播放器位置不變） */
.side-tabs { flex: 1 1 0; min-height: 160px; display: flex; flex-direction: column; background: var(--c-panel); border: 1px solid var(--c-border); border-radius: var(--r-8); overflow: hidden; }
/* 分頁＝daisyUI tabs＋tabs-border／tab：選取態底線由 daisyUI 以 currentColor 畫，專案只設分頁高度、內距、字色與字級變數 */
.side-tabs__list { --tab-height: 40px; height: 40px; flex: none; flex-wrap: nowrap; align-items: stretch; gap: var(--sp-4); padding: 0 var(--sp-8); border-bottom: 1px solid var(--c-border); }
.side-tabs__tab { --tab-p: 0px; padding-inline: var(--sp-12); flex-wrap: nowrap; gap: var(--sp-8); margin-bottom: -1px; font-weight: 500; color: var(--c-text-2); }
.side-tabs__tab:hover { color: var(--c-text); }
.side-tabs__tab.is-active { color: var(--c-brand); }
.side-tabs__tab:focus-visible { outline-offset: -2px; }
.side-tabs__actions { margin-left: auto; align-self: center; display: flex; align-items: center; }
.side-tabs__actions > [hidden] { display: none; }
.side-tabs__count { font-size: var(--fs-12); font-weight: 400; color: var(--c-text-3); }
.side-tabs__body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }

@media (min-width: 900px) {
  .member-video-page { display: grid; grid-template-columns: minmax(0, 1fr) 48px var(--notes-width, 40%); grid-template-rows: auto minmax(0, 1fr); }
  .member-video-page > .video-header, .share-video-page > .video-header { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; gap: var(--sp-16); min-height: 48px; padding: var(--sp-8) var(--sp-32); border-bottom: 1px solid var(--c-border); background: var(--c-panel); min-width: 0; }
  .member-video-page > .video-main { grid-column: 1; grid-row: 2; }
  .member-video-page > .timeline { grid-column: 2; grid-row: 2; }
  .share-video-page > .video-main { grid-column: 1; grid-row: 2; }
  /* 左欄：名稱列、播放器 flex: none，分頁面板 flex: 1 填滿剩餘高度，所以左欄平常不會捲動；
  * 視窗太矮、面板只剩最小 160px 時，.video-main 原本的 overflow: auto 讓整欄退回捲動 */
  .member-video-page .video-main, .share-video-page .video-main { padding-bottom: var(--sp-20); }

  /* 劇場模式（add-theater-mode，僅成員頁桌機）：隱藏影片頁首列與播放器下方分頁面板，筆記區固定窄欄，播放器占滿欄高。
   * 保留全站頁首、時間軸分隔線與 .annotation-bar（在 .player-stage 內）。
   * 切換模式是使用者明確操作造成的版面切換，不是 R2 所指的 hover／載入跳動 */
  .member-video-page.is-theater { grid-template-columns: minmax(0, 1fr) 48px var(--notes-theater-w); }
  .member-video-page.is-theater > .video-header { display: none; }
  .member-video-page.is-theater > .video-main { grid-row: 1 / -1; padding: var(--sp-12) var(--sp-16); }
  .member-video-page.is-theater > .timeline { grid-row: 1 / -1; }
  .member-video-page.is-theater > .notes-panel { grid-row: 1 / -1; width: auto; }
  .member-video-page.is-theater .video-main > :not(.player-stage) { display: none; }
  .member-video-page.is-theater .player-stage { flex: 1; min-height: 0; }
  .member-video-page.is-theater .player-stage .player { flex: 1; min-height: 0; aspect-ratio: auto; }
}

@media (max-width: 899.98px) {
  .video-page {
    position: fixed; left: 0; right: 0; top: var(--vv-top, 0px);
    height: var(--vv-height, 100dvh);
    flex-direction: column; background: var(--c-panel);
  }
  .video-topbar { height: 48px; flex: none; display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-12) 0 var(--sp-4); border-bottom: 1px solid var(--c-border); background: var(--c-panel); }
  .video-topbar__back { --size: 44px; --fontsize: var(--fs-20); font-weight: 400; flex: none; }
  .video-topbar__title { flex: 1; min-width: 0; font-size: var(--fs-15); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .video-topbar__actions { display: flex; flex: none; }
  .video-main { width: 100%; flex: none; overflow: visible; padding: 0; gap: 0; position: sticky; top: 0; }
  .chapter-tabs:not([hidden]) { height: 44px; flex: none; display: flex; border-bottom: 1px solid var(--c-border); background: var(--c-panel); }
  /* 手機章節分頁＝daisyUI tabs-border／tab：平分寬度，選取態底線取字色（--c-chapter-tab-active） */
  .chapter-tabs { --tab-height: 44px; flex-wrap: nowrap; }
  .chapter-tabs__tab { --tab-p: 0px; flex: 1; flex-wrap: nowrap; gap: var(--sp-8); font-size: var(--fs-15); font-weight: 500; color: var(--c-text-2); }
  .chapter-tabs__tab.is-active { font-weight: 700; color: var(--c-chapter-tab-active); }
  .chapter-tabs__count { font-size: var(--fs-13); font-weight: 400; color: var(--c-text-2); }
  .chapter-tabs__tab[hidden] { display: none; }
}
