/* ==========================================
   VOD Detail Page — flat dsn2 layout
   ========================================== */

.page-content {
  flex: 1;
  background: var(--bg-base);
}

/* ===== Shared Wrapper ===== */
.detail-wrap {
  max-width: 1760px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  padding: 16px;
}
@media (min-width: 1600px) { .detail-wrap { max-width: 1540px; } }

/* ===== Hero 區域：模糊背景圖 ===== */
.detail-hero {
  position: relative;
  overflow: hidden;
  min-height: 320px;
}
.detail-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.detail-hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: blur(1px);
  transform: scale(1.08);
}
.detail-hero-bg-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(10,15,12,0.6) 0%, var(--bg-base) 100%);
}

/* ===== Top Section: Poster + Info ===== */
.detail-top {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 32px;
  align-items: flex-start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 24px;
}

.detail-poster {
  flex-shrink: 0;
  width: 250px;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.detail-poster img {
  width: 100%;
  display: block;
  aspect-ratio: 2/3;
  object-fit: cover;
}
.poster-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.detail-info {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.detail-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 4px;
  line-height: 1.3;
}
.detail-title-en {
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 12px;
}

/* 徽章列：排行/熱播榜/狀態 */
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.dbadge {
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-2);
}
.dbadge--rank {
  background: linear-gradient(120deg, #FFD98A 0%, #E8A93B 100%);
  color: #2A1B00;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.dtag {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--bg-card);
}

.detail-score-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}
.score-num {
  font-size: 30px;
  font-weight: 700;
  color: var(--score-hi);
  line-height: 1;
}
.score-count {
  font-size: 12px;
  color: var(--text-3);
}

.detail-meta {
  margin: 0 0 18px;
}
.dm-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.dm-row:last-child { border-bottom: none; }
.dm-row dt {
  color: var(--text-3);
  flex-shrink: 0;
  width: 38px;
  font-weight: 500;
}
.dm-row dd {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.dm-row dd a {
  color: var(--text-2);
  text-decoration: none;
  margin-right: 4px;
}
.dm-row dd a:hover { color: var(--accent); }
.dm-badge {
  display: inline-block;
  background: var(--bg-elevated);
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 4px;
}
.dm-actors a { display: inline; }

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: opacity 0.2s;
}
.detail-btn:hover { opacity: 0.85; }
.detail-btn--play {
  background: var(--accent);
  color: #fff;
}
.detail-btn--dl {
  background: var(--accent-light);
  border: 1px solid var(--accent-dim);
  color: var(--accent-hover);
}
.detail-btn--share {
  background: var(--bg-elevated);
  border: 1px solid var(--border-2);
  color: var(--text-1);
}

/* ===== Tabs Section ===== */
.detail-wrap--tabs {
  padding-top: 0;
}

/* ===== 剧集列表（独立区块） ===== */
.detail-wrap--playlist {
  padding-bottom: 0;
}
.detail-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.dtab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s;
}
.dtab:hover { color: var(--text-1); }
.dtab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
#detailDesc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.75;
}
#detailDesc.desc-collapsed {
  max-height: 4.8em;
  overflow: hidden;
  position: relative;
}
#detailDesc.desc-collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.4em;
  background: linear-gradient(transparent, var(--bg-base));
}
.desc-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

/* ===== Cast List ===== */
.detail-cast-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding-bottom: 8px;
}
.detail-cast-list.cast-list-collapsed {
  max-height: calc(2 * (32px + 8px));
  overflow: hidden;
}
.cast-item {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 3px;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.cast-item > a { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cast-item:hover {
  border-color: var(--accent-dim);
  background: var(--bg-elevated);
}
.cast-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-3);
  flex-shrink: 0;
}
.cast-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cast-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cast-role {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--accent);
  line-height: 1.3;
  white-space: nowrap;
}
.cast-item.is-director .cast-role {
  color: var(--score-hi);
}
.cast-more-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 5px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.cast-more-trigger:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Rate Block ===== */
.rate-block {
  padding: 8px 0 16px;
}
.rate-label {
  font-size: 14px;
  color: var(--text-2);
  margin: 0 0 12px;
}
.rate-stars {
  display: flex;
  gap: 8px;
  font-size: 30px;
  color: #3a3a3a;
}
.rs {
  cursor: pointer;
  transition: color 0.15s;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  line-height: 1;
}
.rs:hover,
.rs.rs-on { color: #f0b429; }

/* ===== Bottom Layout: Main + Sidebar ===== */
.detail-bottom-layout {
  display: flex;
  gap: 32px;
  max-width: 1760px;
  margin: 0 auto;
  padding: 24px;
  align-items: flex-start;
}
@media (min-width: 1600px) { .detail-bottom-layout { max-width: 1540px; } }
.detail-bottom-main {
  flex: 1;
  min-width: 0;
}
.detail-sidebar {
  width: 260px;
  flex-shrink: 0;
}

.detail-section {
  margin-bottom: 46px;
}
.detail-section-hd {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.detail-vod-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

/* ===== Plot List ===== */
.plot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.plot-item {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.plot-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.plot-ep {
  font-weight: 600;
  color: var(--text-1);
  margin-right: 6px;
}
.plot-link {
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s;
}
.plot-link:hover { color: var(--accent); }
.plot-more-btn {
  display: block;
  text-align: center;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
}
.plot-more-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Share Modal ===== */
.share-modal { display: none; }
.share-modal.is-open { display: block; }
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1400;
}
.share-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1401;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 24px;
  width: min(380px, 92vw);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.share-popup-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
}
.share-popup-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 16px;
}
.share-popup-icons {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.spi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
}
.spi-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-1);
  border: 1px solid var(--border);
}
.share-popup-hint {
  font-size: 12px;
  color: var(--text-3);
  margin: 0 0 8px;
}
.share-popup-link {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-2);
  resize: none;
  height: 52px;
  box-sizing: border-box;
  display: block;
  margin-bottom: 10px;
}
.share-popup-copy {
  width: 100%;
  padding: 9px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.share-popup-copy:hover { opacity: 0.88; }

/* ===== Playlist Widget ===== */
.playlist-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.playlist-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}
.pl-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.pl-sort-btn:hover { color: var(--accent); border-color: var(--accent); }

.playlist-sources {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.pl-source-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pl-source-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.playlist-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.playlist-panel { display: none; }
.playlist-panel.is-active { display: block; }

.playlist-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 10px;
  padding: 7px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
}

.playlist-episodes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 4px;
}
.playlist-episodes.episodes-collapsed {
  max-height: 124px;
  overflow: hidden;
}

.episode-btn {
  display: inline-block;
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.episode-btn:hover { border-color: var(--accent); color: var(--accent); }
.episode-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.episode-more-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 5px 12px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.episode-more-trigger:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Comment Section ===== */
.cmt-total-label { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 6px; }
.cmt-total-label em { color: var(--accent); font-style: normal; }

.mac_comment.cmt-ajax-wrap {
  background: transparent;
  border: none;
  min-height: 60px;
}
.cmt-loading {
  font-size: 13px;
  color: var(--text-3);
  padding: 24px 0;
  text-align: center;
}
.cmt-empty {
  padding: 32px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.cmt-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}
.cmt-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.cmt-textarea:focus { border-color: var(--accent); }
.cmt-textarea::placeholder { color: var(--text-3); }

.cmt-form-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.cmt-verify-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.cmt-verify-input {
  width: 90px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: 12px;
  outline: none;
}
.cmt-captcha-img { height: 30px; border-radius: 3px; cursor: pointer; flex-shrink: 0; }
.cmt-form-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.cmt-remaining { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.cmt-remaining em { color: var(--accent); font-style: normal; }
.cmt-submit-btn {
  padding: 7px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.cmt-submit-btn:hover { opacity: 0.85; }

.cmt-list { display: flex; flex-direction: column; gap: 0; }
.cmt-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.cmt-item:last-child { border-bottom: none; }
.cmt-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.cmt-body { flex: 1; min-width: 0; }
.cmt-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cmt-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.cmt-time { font-size: 11px; color: var(--text-3); }
.cmt-content { font-size: 13px; color: var(--text-2); line-height: 1.6; margin: 0 0 6px; }

.cmt-child-item {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border-left: 2px solid var(--border);
}
.cmt-child-name { font-size: 12px; font-weight: 600; color: var(--text-1); margin-right: 6px; }

.cmt-actions { display: flex; gap: 12px; margin-top: 4px; }
.cmt-action-link {
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s;
}
.cmt-action-link:hover { color: var(--accent); }

.cmt-paging {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 16px 0 4px;
}
.cmt-paging ul { display: contents; }
.cmt-page-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.cmt-page-btn:hover { border-color: var(--accent); color: var(--accent); }
.cmt-page-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cmt-page-btn.is-disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .detail-sidebar { display: none; }
}
@media (max-width: 1023px) {
  .detail-vod-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 767px) {
  .detail-vod-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }

  /* 手机版：角色信息固定一排 3 个 */
  .detail-cast-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 手机 + 平板：年份/地区/语言 合并一行、主演限制单行 */
@media (max-width: 1023px) {
  /* 年份/地区/语言 合并一行，用分隔线隔开 */
  .dm-row-group {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
  }
  .dm-row-group .dm-row {
    display: flex;
    align-items: baseline;
    width: auto;
    padding: 0;
    border-bottom: none;
    position: relative;
  }
  .dm-row-group .dm-row + .dm-row {
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid var(--border);
  }
  .dm-row-group .dm-row dd { flex: none; }

  /* 主演限制单行，超出省略 */
  .dm-actors {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .dm-actors a { display: inline; }
}
@media (max-width: 640px) {
  .detail-top { flex-direction: column; align-items: center; padding: 28px 16px 20px; }
  .detail-poster { width: 230px; }
  .detail-info { width: 100%; }
  .detail-bottom-layout { flex-direction: column; padding: 16px; }
  /* .detail-tabs { overflow-x: auto; } */
  .cmt-form-footer { flex-direction: column; align-items: stretch; }
  .cmt-form-right { margin-left: 0; justify-content: space-between; }

  /* 操作按钮：1个满版 / 2个平分 / 3个播放独占一行、下载+分享平分第二行 */
  .detail-actions { flex-wrap: wrap; }
  .detail-actions .detail-btn {
    flex: 1;
    justify-content: center;
  }
  /* 恰好 3 个按钮时，第一个（播放）独占整行，其余两个换到下一行平分 */
  .detail-actions .detail-btn:first-child:nth-last-child(3) {
    flex-basis: 100%;
  }
}
