/*
 * [站点注释 Site Note]
 * 文件: D:\Documents\GitHub\whwdzg.github.io\css\video-archive.css
 * 作用: 页面样式与布局规则，按模块拆分维护。
 * English: Module-level styles for layout and presentation.
 */
/* 视频归档列表布局重构：仅支持 grid/list 两种布局 */
.video-grid.grid-view {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  grid-auto-flow: row;
  grid-auto-rows: 8px;
  align-items: start;
  width: 100%;
}
@media (max-width: 900px) {
  .video-grid.grid-view {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .video-grid.grid-view {
    grid-template-columns: minmax(0, 1fr);
  }
}
.video-grid.grid-view .video-card {
  display: block;
  width: 100%;
  margin: 0;
  align-self: start;
}
@media (max-width: 900px) {
  .video-grid.grid-view .video-card {
    width: calc(100% - 40px);
  }
}
@media (min-width: 900px) {
  .video-grid.grid-view .video-card {
    width: calc(100% - 30px);
  }
}
.video-grid.list-view {
  display: flex !important;
  flex-direction: column;
  gap: 0.1rem;
}

.video-grid.list-view .video-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  column-gap: 1.2rem;
  row-gap: 0.3rem;
  align-items: start;
  min-height: 120px;
}
.video-grid.list-view .video-thumb {
  grid-column: 1;
  grid-row: 1 / -1;
  width: 180px;
  max-width: 180px;
  margin-right: 0;
  align-self: center;
}
.video-grid.list-view .video-card h3 {
  grid-column: 2;
  grid-row: 1;
  margin-bottom: 0.15rem;
}
.video-grid.list-view .video-card .video-pill-row {
  grid-column: 2;
  grid-row: 3;
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
  align-items: center;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.video-grid.list-view .video-card .video-pill-row .pill {
  white-space: nowrap;
  flex: 0 0 auto;
}
.video-grid.list-view .video-card .video-desc {
  grid-column: 2;
  grid-row: 2;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-grid.list-view .video-actions {
  grid-column: 3;
  grid-row: 1 / -1;
  justify-self: end;
  align-self: center;
}
.video-grid.list-view .video-thumb img {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
}
.video-grid.list-view .video-desc {
  max-width: none;
}

/* Module: Video archive listing for 2.0 layout. */
.video-grid {
  width: 100%;
}


.video-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 26px var(--shadow-color);
    padding: 0.75rem;
    display: block;
    margin-bottom: 1.2rem;
    color: var(--text-color);
    overflow: hidden; /* 防止内部元素外溢 */
}

  .video-grid.grid-view .video-card {
    margin-bottom: 0;
  }

.video-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  aspect-ratio: 16 / 9;
}

.video-thumb .video-badge { z-index: 3; }

.video-card .pill {
  width: fit-content;
  max-width: 50%;
}
.video-card .pill.collection {
  color: var(--text-color);
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0; /* 覆盖 main img 的默认外边距，避免撑出容器 */
}

.video-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1.1;
    backdrop-filter: blur(4px);
}

.video-badge.offline {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.video-badge.collection {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
}

.video-badge.private {
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
  color: #0f172a;
}

.video-badge.muted {
    background: rgba(15, 23, 42, 0.6);
}

.video-card h3 {
    margin: 0;
    font-size: 1.05rem;
    word-break: break-word;
}

.video-desc {
    margin: 0;
    color: rgba(100, 116, 139, 0.96);
    line-height: 1.55;
    word-break: break-word;
}

.video-meta-line {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
    color: rgba(100, 116, 139, 0.96);
    font-size: 0.95rem;
}

.video-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.video-actions a[aria-disabled="true"] {
    opacity: 0.6;
    pointer-events: none;
}
.video-actions a.stale-link {
  opacity: 0.7;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  justify-content: center;
}

.pagination .current {
  background: var(--primary-color, #2563eb);
  border-color: var(--primary-color, #2563eb);
  color: #fff;
}

@media (max-width: 640px) {
    .video-card { padding: 0.7rem; }
}

/* 视图切换按钮样式（正方形+居中图标） */
.settings-action-btn {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--secondary-bg);
  color: var(--text-color);
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease, opacity 120ms ease;
}
.settings-action-btn i {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 仅限视频归档页面的视图切换按钮组 segment 样式，避免全局冲突 */
.video-archive-view-switch {
  display: inline-flex;
  background: var(--view-switch-bg, #f4f7fa);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  padding: 2px;
}
.video-archive-view-switch .settings-action-btn {
  border: none;
  background: transparent;
  box-shadow: none;
  margin: 0 1px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.video-archive-view-switch .settings-action-btn.active,
.video-archive-view-switch .settings-action-btn:focus {
  background: var(--view-switch-active-bg, #fff);
  color: var(--primary-color, #2563eb);
  box-shadow: 0 0 0 2px var(--primary-color, #2563eb) inset;
}
.video-archive-view-switch .settings-action-btn:not(.active):hover {
  background: var(--view-switch-hover-bg, #e5eaf1);
}

/* 修正 grid masonry 下 .video-card 宽度自适应 */
.video-grid.grid-view .video-card {
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 1200px) {
  .video-grid.grid-view .video-card {
    max-width: 410px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 720px) {
  .video-grid.list-view .video-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(5, auto);
  }
  .video-grid.list-view .video-thumb {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    max-width: 100%;
  }
  .video-grid.list-view .video-card h3 {
    grid-column: 1;
    grid-row: 2;
  }
  .video-grid.list-view .video-card .video-desc {
    grid-column: 1;
    grid-row: 3;
  }
  .video-grid.list-view .video-card .video-pill-row {
    grid-column: 1;
    grid-row: 4;
  }
  .video-grid.list-view .video-actions {
    grid-column: 1;
    grid-row: 5;
    justify-self: start;
    align-self: start;
  }
}
