/* =========================================================
 * live-list.css  —  慢直播列表页样式
 * 作用域：.live-grid 内部，不污染 DedeCMS 默认模板
 * ========================================================= */

.live-grid {
  --lg-card:      #1b2029;
  --lg-card-hover:#1f2530;
  --lg-border:    #262c38;
  --lg-border-hover:#3a4761;
  --lg-text:      #e7eaf0;
  --lg-sub:       #8b93a7;
  --lg-accent:    #4f8cff;
  --lg-ok:        #22c55e;
  --lg-err:       #ef4444;
  --lg-radius:    12px;
}

/* =========================================================
 * 1. 网格容器
 * ========================================================= */
.live-grid {
  box-sizing: border-box;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  color: var(--lg-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               sans-serif;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}

.live-grid *,
.live-grid *::before,
.live-grid *::after {
  box-sizing: border-box;
}

/* =========================================================
 * 2. 卡片
 * ========================================================= */
.live-grid .card {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  background: var(--lg-card);
  border: 1px solid var(--lg-border);
  border-radius: var(--lg-radius);
  overflow: hidden;
  cursor: pointer;
  outline: none;
  user-select: none;
  transition: transform .18s ease,
              background .18s ease,
              border-color .18s ease,
              box-shadow .18s ease;
}

.live-grid .card:hover {
  transform: translateY(-3px);
  background: var(--lg-card-hover);
  border-color: var(--lg-border-hover);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .42);
}

.live-grid .card:focus-visible {
  border-color: var(--lg-accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .28);
}

.live-grid .card:active {
  transform: translateY(-1px);
}

/* =========================================================
 * 3. 缩略图区域
 * ========================================================= */
.live-grid .thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0c10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 兼容旧浏览器 */
@supports not (aspect-ratio: 16 / 9) {
  .live-grid .thumb {
    height: 0;
    padding-bottom: 56.25%;
  }
  .live-grid .thumb > * {
    position: absolute;
    inset: 0;
  }
}

/* 缩略图 */
.live-grid .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: lg-fade .4s ease;
}

@keyframes lg-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* 加载 / 失败提示 */
.live-grid .thumb .hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 12px;
  color: var(--lg-sub);
  text-align: center;
  pointer-events: none;
  background: linear-gradient(135deg, #10141b 0%, #0a0c10 100%);
}

/* 转圈 */
.live-grid .spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #2b3342;
  border-top-color: var(--lg-accent);
  border-radius: 50%;
  animation: lg-spin .8s linear infinite;
}

@keyframes lg-spin {
  to { transform: rotate(360deg); }
}

/* =========================================================
 * 4. 徽标
 * ========================================================= */
.live-grid .thumb .badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  line-height: 1.2;
  border-radius: 5px;
  background: rgba(0, 0, 0, .65);
  color: #cfd6e4;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

.live-grid .thumb .badge.hls { color: #7fb2ff; }
.live-grid .thumb .badge.flv { color: #ffb37f; }
.live-grid .thumb .badge.unknown { color: #cfd6e4; }

/* =========================================================
 * 5. 重新截图按钮
 * ========================================================= */
.live-grid .snap-btn {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 3;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: rgba(0, 0, 0, .65);
  color: #cfd6e4;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .18s ease,
              transform .18s ease,
              background .18s ease,
              color .18s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.live-grid .card:hover .snap-btn {
  opacity: 1;
  transform: scale(1);
}

.live-grid .snap-btn:hover {
  background: var(--lg-accent);
  color: #fff;
}

.live-grid .snap-btn:active {
  transform: rotate(180deg) scale(1);
}

/* 触摸设备直接显示 */
@media (hover: none) {
  .live-grid .snap-btn {
    opacity: 1;
    transform: scale(1);
  }
}

/* =========================================================
 * 6. 悬停播放图标
 * ========================================================= */
.live-grid .play-hint {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .32);
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}

.live-grid .card:hover .play-hint {
  opacity: 1;
}

.live-grid .play-hint svg {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .65));
  transform: scale(.92);
  transition: transform .2s ease;
}

.live-grid .card:hover .play-hint svg {
  transform: scale(1);
}

/* =========================================================
 * 7. 信息区
 * ========================================================= */
.live-grid .card .body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-grid .card .name {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--lg-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-grid .card .sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--lg-sub);
}

.live-grid .card .sub .hint-play {
  opacity: 0;
  transition: opacity .18s ease;
}

.live-grid .card:hover .sub .hint-play {
  opacity: 1;
}

/* 状态圆点 */
.live-grid .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--lg-sub);
  vertical-align: 1px;
  transition: background .2s ease;
}

.live-grid .dot.run {
  background: var(--lg-accent);
  animation: lg-pulse 1.1s ease-in-out infinite;
}

.live-grid .dot.ok  { background: var(--lg-ok); }
.live-grid .dot.err { background: var(--lg-err); }

@keyframes lg-pulse {
  50% { opacity: .3; }
}

/* 流地址 */
.live-grid .card .url {
  font-size: 10.5px;
  line-height: 1.4;
  color: #525b6e;
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .18s ease;
}

.live-grid .card:hover .url {
  color: #6b7488;
}

/* =========================================================
 * 8. 空列表
 * ========================================================= */
.live-grid .empty-tip,
.live-grid:empty::after {
  grid-column: 1 / -1;
  padding: 80px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--lg-sub);
}

.live-grid:empty::after {
  content: "暂无直播源";
  display: block;
}

/* =========================================================
 * 9. 响应式
 * ========================================================= */
@media (max-width: 1100px) {
  .live-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
}

@media (max-width: 760px) {
  .live-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 14px;
  }
  .live-grid .card .body {
    padding: 10px 12px 12px;
    gap: 6px;
  }
  .live-grid .card .name {
    font-size: 13px;
  }
  .live-grid .card .sub,
  .live-grid .card .url {
    font-size: 10.5px;
  }
}

@media (max-width: 480px) {
  .live-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .live-grid .card .name {
    font-size: 14px;
  }
}

/* =========================================================
 * 10. DedeCMS 默认模板兜底覆盖
 * ========================================================= */
.live-grid .card::before,
.live-grid .card::after {
  display: none;
}

.live-grid .card h3,
.live-grid .card p,
.live-grid .card div {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
}

.live-grid .snap-btn:focus { outline: none; }

/* =========================================================
 * 11. 浅色主题（可选）
 *     容器加 class="live-grid theme-light"
 * ========================================================= */
.live-grid.theme-light {
  --lg-card:       #ffffff;
  --lg-card-hover: #fafbfd;
  --lg-border:     #e5e9f0;
  --lg-border-hover:#c8d0de;
  --lg-text:       #1a1f2b;
  --lg-sub:        #6b7487;
  --lg-accent:     #2f6fe4;
  --lg-ok:         #16a34a;
  --lg-err:        #dc2626;
}

.live-grid.theme-light .thumb {
  background: #f0f2f6;
}

.live-grid.theme-light .thumb .hint {
  background: linear-gradient(135deg, #f5f7fa 0%, #eef1f6 100%);
}

.live-grid.theme-light .spinner {
  border-color: #d6dce8;
  border-top-color: var(--lg-accent);
}

.live-grid.theme-light .thumb .badge {
  background: rgba(0, 0, 0, .55);
}

.live-grid.theme-light .snap-btn {
  background: rgba(0, 0, 0, .55);
}

.live-grid.theme-light .play-hint {
  background: rgba(0, 0, 0, .25);
}

.live-grid.theme-light .card .url {
  color: #9aa2b1;
}

.live-grid.theme-light .card:hover .url {
  color: #7a829a;
}
/* =========================================================
 * 截图失败 / 离线提示
 * ========================================================= */
.live-grid .thumb .hint-fail {
  gap: 6px;
  padding: 0 16px;
  color: var(--c-text-sub);
}

/* 图标 */
.live-grid .hint-fail .hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(239, 68, 68, .12);
  color: var(--c-err);
  margin-bottom: 2px;
}

.live-grid .hint-fail .hint-icon svg {
  width: 22px;
  height: 22px;
}

/* 主文案 */
.live-grid .hint-fail .hint-text {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--c-text);
  line-height: 1.4;
}

/* 副文案 */
.live-grid .hint-fail .hint-sub {
  font-size: 11px;
  color: var(--c-text-mute);
  line-height: 1.4;
  opacity: .85;
}

/* 浅色主题微调 */
html[data-theme="light"] .live-grid .hint-fail .hint-icon {
  background: rgba(220, 38, 38, .1);
}
/* =========================================================
 * 分页 pagination
 * ========================================================= */

/* ---------- 容器 ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 32px auto 40px;
  padding: 0 20px;
  max-width: 1400px;
  font-size: 13px;
  line-height: 1;
}

/* ---------- DedeCMS pagelist 输出的元素 ---------- */
.pagination a,
.pagination span,
.pagination li,
.pagination .thisclass,
.pagination .disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease,
              border-color .15s ease,
              color .15s ease,
              transform .15s ease;
  user-select: none;
}

/* 去掉 ul/li 默认样式 */
.pagination ul,
.pagination ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pagination li {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: auto;
  height: auto;
  background: none;
  border: none;
}

/* ---------- 普通链接 ---------- */
.pagination a {
  color: #b9c0cf;
  background: #1b2029;
  border: 1px solid #262c38;
}

.pagination a:hover {
  background: #232b38;
  border-color: #3a4761;
  color: #e7eaf0;
  transform: translateY(-1px);
}

.pagination a:active {
  transform: translateY(0);
}

/* ---------- 当前页 ---------- */
.pagination .thisclass,
.pagination span.thisclass,
.pagination a.thisclass,
.pagination .current {
  background: #4f8cff;
  border: 1px solid #4f8cff;
  color: #fff;
  font-weight: 600;
  cursor: default;
}
.pagination .thisclass:hover,
.pagination .current:hover {
  background: #4f8cff;
  border-color: #4f8cff;
  transform: none;
}

/* ---------- 禁用状态（首页/末页/上一页/下一页不可用时） ---------- */
.pagination .disabled,
.pagination span.disabled {
  color: #4a5266;
  background: #161a22;
  border: 1px solid #1f2530;
  cursor: not-allowed;
}
.pagination .disabled:hover {
  background: #161a22;
  border-color: #1f2530;
  transform: none;
}

/* ---------- 统计信息（共 x 页 x 条） ---------- */
.pagination .info,
.pagination span.info {
  background: none;
  border: none;
  color: #6b7488;
  font-size: 12.5px;
  padding: 0 8px;
  min-width: auto;
  cursor: default;
}
.pagination .info:hover {
  background: none;
  color: #6b7488;
}

/* ---------- 跳转下拉框 / 输入框（如果 pagelist 输出 option） ---------- */
.pagination select,
.pagination input[type="text"] {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  color: #b9c0cf;
  background: #1b2029;
  border: 1px solid #262c38;
  border-radius: 8px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}
.pagination select:focus,
.pagination input[type="text"]:focus {
  border-color: #4f8cff;
}
.pagination button {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  color: #fff;
  background: #4f8cff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter .15s;
  font-family: inherit;
}
.pagination button:hover {
  filter: brightness(1.1);
}

/* ---------- 首尾「上一页」「下一页」加宽 ---------- */
.pagination a:first-child,
.pagination a:last-child {
  padding: 0 14px;
}

/* =========================================================
 * 响应式
 * ========================================================= */
@media (max-width: 640px) {
  .pagination {
    gap: 5px;
    margin: 24px auto 32px;
    padding: 0 12px;
  }
  .pagination a,
  .pagination span,
  .pagination .thisclass,
  .pagination .disabled {
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
    border-radius: 7px;
  }
  .pagination .info,
  .pagination span.info {
    width: 100%;
    text-align: center;
    margin-bottom: 6px;
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .pagination a,
  .pagination span {
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    font-size: 11.5px;
  }
}

/* =========================================================
 * 浅色主题
 * ========================================================= */
html[data-theme="light"] .pagination a {
  color: #4a5365;
  background: #ffffff;
  border-color: #e5e9f0;
}
html[data-theme="light"] .pagination a:hover {
  background: #f5f7fa;
  border-color: #c8d0de;
  color: #1a1f2b;
}
html[data-theme="light"] .pagination .thisclass,
html[data-theme="light"] .pagination .current {
  background: #2f6fe4;
  border-color: #2f6fe4;
  color: #fff;
}
html[data-theme="light"] .pagination .disabled,
html[data-theme="light"] .pagination span.disabled {
  color: #c8d0de;
  background: #f5f7fa;
  border-color: #e5e9f0;
}
html[data-theme="light"] .pagination .info,
html[data-theme="light"] .pagination span.info {
  color: #9aa2b1;
}
html[data-theme="light"] .pagination select,
html[data-theme="light"] .pagination input[type="text"] {
  color: #4a5365;
  background: #ffffff;
  border-color: #e5e9f0;
}