/**
 * 图道视频 Pro · 列表页样式
 *
 * 1:1 对齐 examples/video-list-mockup.html
 *
 * 命名空间隔离原则：
 *   - 主站菜单接管：去掉 mockup 的 .mock-topbar / .mock-nav / .mock-theme-toggle
 *   - 全局样式（body / *）改成 .tdvp-exact-page（避免污染 WP 主题）
 *   - 暗色模式由 .tdvl-wrap[data-tdvl-theme="dark"] 控制（不再依赖 body.is-dark）
 */

/* ── box-sizing 命名空间隔离 ── */
.tdvp-exact-page,
.tdvp-exact-page *,
.tdvp-exact-page *::before,
.tdvp-exact-page *::after { box-sizing: border-box; }

/* ============================================================================
 * 主题反污染（dux/通用 WP 主题给 <a> 加 underline / border-bottom / box-shadow）
 * 必须放最前面，用 !important 覆盖主题的高优先级规则
 * ============================================================================ */
.tdvp-exact-page a,
.tdvp-exact-page a:link,
.tdvp-exact-page a:visited,
.tdvp-exact-page a:hover,
.tdvp-exact-page a:focus,
.tdvp-exact-page a:active {
    text-decoration: none !important;
    border-bottom: 0 !important;
    box-shadow: none !important;
    background-image: none !important;
}
/* 主题可能给 <button> 加 background/border/color，全部 reset */
.tdvp-exact-page button {
    font-family: inherit;
    line-height: inherit;
    color: inherit;
}
/* 主题对 .entry-content 内 h1~h6 的强样式（边框/背景/marigin），全 reset */
.tdvp-exact-page h1,
.tdvp-exact-page h2,
.tdvp-exact-page h3,
.tdvp-exact-page h4,
.tdvp-exact-page h5,
.tdvp-exact-page h6 {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font-weight: inherit;
}
/* 主题可能对 ul/ol/li 加默认 padding/list-style */
.tdvp-exact-page ul,
.tdvp-exact-page ol {
    margin: 0;
    padding: 0;
}
/* 主题对 .entry-content p 默认 margin-bottom，会破坏 flexbox gap 间距 */
.tdvp-exact-page p {
    margin: 0;
    padding: 0;
}
/* 主题对 img 的 max-width: 100% / margin 也要兜底 */
.tdvp-exact-page img {
    max-width: 100%;
    height: auto;
    margin: 0;
    border: 0;
    box-shadow: none;
}

/* ── 页面外壳（替代 mockup 的 body） ── */
.tdvp-exact-page {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f1f3f6;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
}

/* ── 主容器（白色卡片） ── */
.mock-container {
    max-width: 1200px;
    margin: 8px auto 72px;
    padding: 22px 44px 34px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

/* ============================================================================
 * 列表页核心样式（命名空间 .tdvl-*）— 与 mockup 1:1 一致
 * ============================================================================ */
.tdvl-wrap {
    --tdvl-accent: #3730a3;
    --tdvl-accent-hover: #4338ca;
    --tdvl-accent-soft: rgba(67, 56, 202, 0.08);

    --tdvl-bg: transparent;
    --tdvl-surface: #ffffff;
    --tdvl-surface-alt: #fafbfc;
    --tdvl-border: #eaecef;
    --tdvl-border-hi: #d5d9e0;

    --tdvl-text: #0f172a;
    --tdvl-text-muted: #64748b;
    --tdvl-text-dim: #94a3b8;

    --tdvl-pro-bg: #fff7ed;
    --tdvl-pro-text: #9a3412;
    --tdvl-pro-border: #fed7aa;
    --tdvl-free-bg: #f0fdf4;
    --tdvl-free-text: #166534;
    --tdvl-free-border: #bbf7d0;

    --tdvl-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --tdvl-shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08),
                      0 1px 3px rgba(15, 23, 42, 0.04);

    --tdvl-radius: 10px;
    --tdvl-radius-sm: 6px;
    --tdvl-ease: cubic-bezier(0.4, 0, 0.2, 1);

    width: 100%;
    color: var(--tdvl-text);
    line-height: 1.6;
}
.tdvl-wrap *,
.tdvl-wrap *::before,
.tdvl-wrap *::after { box-sizing: border-box; }

/* 暗色模式（data-tdvl-theme="dark"） */
.tdvl-wrap[data-tdvl-theme="dark"] {
    --tdvl-surface: #1e2128;
    --tdvl-surface-alt: #272b33;
    --tdvl-border: #2d3139;
    --tdvl-border-hi: #3d4250;
    --tdvl-text: #f3f4f6;
    --tdvl-text-muted: #9ca3af;
    --tdvl-text-dim: #6b7280;
    --tdvl-accent: #818cf8;
    --tdvl-accent-hover: #a5b4fc;
    --tdvl-accent-soft: rgba(129, 140, 248, 0.12);
    --tdvl-pro-bg: rgba(251, 146, 60, 0.12);
    --tdvl-pro-text: #fdba74;
    --tdvl-pro-border: rgba(251, 146, 60, 0.3);
    --tdvl-free-bg: rgba(34, 197, 94, 0.12);
    --tdvl-free-text: #86efac;
    --tdvl-free-border: rgba(34, 197, 94, 0.3);
    --tdvl-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --tdvl-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
}

/* ── 第 1 行：标题（show_title="1" 时启用） ── */
.tdvl-header {
    display: flex;
    align-items: center;
    margin: 0 0 14px;
}
.tdvl-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.tdvl-header-left::before {
    content: "";
    display: block;
    width: 3px;
    height: 18px;
    background: var(--tdvl-accent);
    border-radius: 2px;
}
.tdvl-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--tdvl-text);
}
.tdvl-count {
    font-size: 13px;
    color: var(--tdvl-text-dim);
}

/* ── 第 2 行：分类（左）+ 权限筛选（右） ── */
.tdvl-filters-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 18px;
    flex-wrap: wrap;
}

/* ── 第 3 行：搜索框工具条（show_search="1" 时启用） ── */
.tdvl-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 24px;
    flex-wrap: wrap;
}
.tdvl-search { position: relative; display: flex; align-items: center; }
.tdvl-search-input {
    appearance: none;
    min-width: 220px;
    height: 36px;
    padding: 0 34px 0 36px;
    border-radius: var(--tdvl-radius-sm);
    border: 1px solid var(--tdvl-border);
    background: var(--tdvl-surface);
    color: var(--tdvl-text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s var(--tdvl-ease), box-shadow 0.2s var(--tdvl-ease);
    font-family: inherit;
}
.tdvl-search-input::placeholder { color: var(--tdvl-text-dim); }
.tdvl-search-input:focus {
    border-color: var(--tdvl-accent);
    box-shadow: 0 0 0 3px var(--tdvl-accent-soft);
}
.tdvl-search-icon {
    position: absolute;
    left: 12px;
    display: flex;
    width: 14px;
    height: 14px;
    color: var(--tdvl-text-dim);
    pointer-events: none;
}
.tdvl-search-clear {
    position: absolute;
    right: 6px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--tdvl-text-dim);
    font-size: 16px;
    cursor: pointer;
    display: none;
    line-height: 1;
}
.tdvl-search-input:not(:placeholder-shown) ~ .tdvl-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tdvl-search-clear:hover { color: var(--tdvl-text); }

/* 权限筛选 chip（下划线风） */
.tdvl-filter {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tdvl-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--tdvl-text-muted);
    text-decoration: none;
    transition: color 0.15s var(--tdvl-ease);
    white-space: nowrap;
    cursor: pointer;
}
.tdvl-chip::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 2px;
    background: transparent;
    border-radius: 2px;
    transition: background 0.15s var(--tdvl-ease);
}
.tdvl-chip:hover { color: var(--tdvl-text); }
.tdvl-chip.is-active {
    color: var(--tdvl-accent);
    font-weight: 600;
}
.tdvl-chip.is-active::after { background: var(--tdvl-accent); }

/* 分类导航（胶囊式 — 与 mockup 一致） */
.tdvl-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 4px;
    background: var(--tdvl-surface-alt);
    border-radius: 10px;
    flex: 0 1 auto;
    min-width: 0;
}
.tdvl-cat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    color: var(--tdvl-text-muted);
    text-decoration: none;
    transition: color 0.15s var(--tdvl-ease), background 0.15s var(--tdvl-ease);
    white-space: nowrap;
    cursor: pointer;
}
.tdvl-cat-item:hover {
    color: var(--tdvl-text);
    background: var(--tdvl-surface);
}
.tdvl-cat-item.is-active {
    color: var(--tdvl-accent);
    background: var(--tdvl-surface);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.tdvl-cat-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    color: var(--tdvl-text-dim);
    background: var(--tdvl-border);
    line-height: 1;
}
.tdvl-cat-item.is-active .tdvl-cat-count {
    color: var(--tdvl-accent);
    background: var(--tdvl-accent-soft);
}
@media (max-width: 600px) {
    .tdvl-categories {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .tdvl-categories::-webkit-scrollbar { display: none; }
    .tdvl-cat-item { flex-shrink: 0; }
}

/* 卡片底部分类 chip */
.tdvl-card-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2px 0 0;
}
.tdvl-card-cat {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--tdvl-text-muted);
    background: var(--tdvl-surface-alt);
    border: 1px solid var(--tdvl-border);
}

/* 网格 */
.tdvl-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.tdvl-grid[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.tdvl-grid[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.tdvl-grid[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) {
    .tdvl-grid[data-cols="3"],
    .tdvl-grid[data-cols="4"] { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .tdvl-grid,
    .tdvl-grid[data-cols="2"],
    .tdvl-grid[data-cols="3"],
    .tdvl-grid[data-cols="4"] { grid-template-columns: 1fr; gap: 16px; }
    .tdvl-filters-row { flex-direction: column; align-items: stretch; gap: 12px; }
    .tdvl-filter { justify-content: flex-start; }
    .tdvl-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .tdvl-search-input { min-width: 0; width: 100%; }
    .tdvl-search { flex: 1 1 100%; }
}

/* 卡片 */
.tdvl-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-radius: var(--tdvl-radius);
    background: var(--tdvl-surface);
    border: 1px solid var(--tdvl-border);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--tdvl-shadow-sm);
    transition: transform 0.2s var(--tdvl-ease),
                box-shadow 0.2s var(--tdvl-ease),
                border-color 0.2s var(--tdvl-ease);
    cursor: pointer;
}
.tdvl-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tdvl-shadow-md);
    border-color: var(--tdvl-border-hi);
}
.tdvl-card:focus-visible {
    outline: 2px solid var(--tdvl-accent);
    outline-offset: 2px;
}

/* 封面 */
.tdvl-cover {
    position: relative;
    aspect-ratio: 16 / 8.7;
    overflow: hidden;
    background: var(--tdvl-surface-alt);
}
.tdvl-cover-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--tdvl-ease);
}
.tdvl-card:hover .tdvl-cover-img { transform: scale(1.03); }
.tdvl-cover-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tdvl-surface-alt);
    color: var(--tdvl-text-dim);
}
.tdvl-cover-placeholder svg { width: 40px; height: 40px; opacity: 0.6; }

/* 模拟封面（无特色图时的彩色海报兜底） */
.mock-poster {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: #fff;
    text-align: center;
    transition: transform 0.4s var(--tdvl-ease);
}
.tdvl-card:hover .mock-poster { transform: scale(1.03); }
.mock-poster-1 { background: linear-gradient(135deg, #4338ca 0%, #6366f1 50%, #8b5cf6 100%); }
.mock-poster-2 { background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%); }
.mock-poster-3 { background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%); }
.mock-poster-4 { background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%); }
.mock-poster-5 { background: linear-gradient(135deg, #7c2d12 0%, #ea580c 100%); }
.mock-poster-6 { background: linear-gradient(135deg, #4c1d95 0%, #ec4899 100%); }
.mock-poster-7 { background: linear-gradient(135deg, #164e63 0%, #0891b2 100%); }
.mock-poster-label {
    font-size: 11px;
    opacity: 0.85;
    letter-spacing: 0.15em;
    margin-bottom: 8px;
    text-transform: uppercase;
}
.mock-poster-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.mock-poster-sub {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 8px;
}

/* 徽章 */
.tdvl-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.02em;
}
.tdvl-badge-free {
    color: var(--tdvl-free-text);
    background: var(--tdvl-free-bg);
    border: 1px solid var(--tdvl-free-border);
}
.tdvl-badge-pro {
    color: var(--tdvl-pro-text);
    background: var(--tdvl-pro-bg);
    border: 1px solid var(--tdvl-pro-border);
}
.tdvl-badge-continue {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.tdvl-badge-continue svg { width: 10px; height: 10px; }

.tdvl-cover-stats {
    position: absolute;
    bottom: 8px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.tdvl-cover-stats svg { width: 11px; height: 11px; opacity: 0.9; }
.tdvl-cover-stats-sep { opacity: 0.5; margin: 0 -2px; }

/* 卡片正文 */
.tdvl-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px 16px 14px;
    min-width: 0;
}
.tdvl-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--tdvl-text);
    letter-spacing: -0.005em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
            line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s;
}
.tdvl-card:hover .tdvl-card-title { color: var(--tdvl-accent); }
.tdvl-card-desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--tdvl-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
            line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.5em * 2);
}
.tdvl-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    padding-top: 8px;
    border-top: 1px solid var(--tdvl-border);
    font-size: 12px;
    color: var(--tdvl-text-dim);
}
.tdvl-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tdvl-card-meta-item svg { width: 12px; height: 12px; }
.tdvl-card-meta-sep { opacity: 0.4; }

/* 进度条 */
.tdvl-card-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--tdvl-border);
    z-index: 4;
}
.tdvl-card-progress-bar {
    display: block;
    height: 100%;
    background: var(--tdvl-accent);
    transition: width 0.3s var(--tdvl-ease);
}

/* 分页（兼容 WP paginate_links 的 .page-numbers / .current / .dots） */
.tdvl-pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 32px 0 8px;
    flex-wrap: wrap;
}
.tdvl-pager a,
.tdvl-pager span,
.tdvl-pager .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: var(--tdvl-radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--tdvl-text-muted);
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    cursor: pointer;
}
.tdvl-pager a:hover {
    color: var(--tdvl-accent);
    background: var(--tdvl-accent-soft);
}
.tdvl-pager .is-current,
.tdvl-pager .page-numbers.current {
    color: #fff;
    background: var(--tdvl-accent);
    border-color: var(--tdvl-accent);
    cursor: default;
}
.tdvl-pager .page-numbers.dots {
    border: none;
    background: transparent;
    cursor: default;
}

/* 空状态 */
.tdvl-empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--tdvl-text-muted);
}
.tdvl-empty-icon {
    display: inline-flex;
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--tdvl-surface-alt);
    align-items: center;
    justify-content: center;
    color: var(--tdvl-text-dim);
}
.tdvl-empty-icon svg { width: 22px; height: 22px; }
.tdvl-empty-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--tdvl-text);
}
.tdvl-empty-desc {
    margin: 0;
    font-size: 13px;
    color: var(--tdvl-text-muted);
}

/* 加载态（搜索防抖时） */
.tdvl-grid.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s;
}
