/* ============================================================
   Zibll 标签分类聚合 v2.0 - 前端样式
   设计语言参考 TDesign / Apple / Google / 字节跳动
   全部颜色、圆角、阴影复用子比主题 CSS 变量，自动适配明暗模式
   布局：卡片式、留白充足、多端响应式
   ============================================================ */

/* ---------- 页面骨架 ---------- */
.zth-hub {
    padding-bottom: 40px;
}

.zth-hub .content-layout {
    min-width: 0;
}

/* 屏幕阅读器专用标题（短代码等无可见标题场景保留） */
.zth-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- 页面头部（面包屑 + 标题 + 统计） ---------- */
.zth-head {
    padding-bottom: 22px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--main-border-color, rgba(50, 50, 50, 0.06));
}

.zth-crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted-3-color, #b1b1b1);
    margin-bottom: 10px;
}

.zth-crumb a {
    color: var(--muted-2-color, #999);
    text-decoration: none;
    transition: color 0.2s;
}

.zth-crumb a:hover {
    color: var(--key-color, #333);
}

.zth-crumb-sep {
    color: var(--muted-4-color, #d2d2d2);
    font-size: 12px;
}

.zth-crumb-current {
    color: var(--muted-color, #777);
}

.zth-head-title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--key-color, #333);
    margin: 0;
    letter-spacing: 0.5px;
}

.zth-head-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted-2-color, #999);
    margin: 8px 0 0;
}

/* ---------- 搜索框 ---------- */
.zth-search {
    position: relative;
    max-width: 620px;
    margin: 0 auto 28px;
    box-sizing: border-box;
}

.zth-search-input {
    width: 100%;
    height: 50px;
    padding: 0 52px 0 48px;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: calc(var(--main-radius, 8px) + 2px);
    background: var(--main-bg-color, #fff);
    box-shadow: 0 2px 12px var(--main-shadow, rgba(116, 116, 116, 0.08));
    color: var(--main-color, #4e5358);
    font-size: 15px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}

.zth-search-input::placeholder {
    color: var(--muted-3-color, #b1b1b1);
}

.zth-search-input:hover {
    border-color: var(--muted-border-color, rgba(0, 0, 0, 0.03));
}

.zth-search-input:focus {
    border-color: var(--theme-color, #f04494);
    box-shadow: 0 0 0 3px var(--focus-shadow-color, rgba(253, 83, 161, 0.4));
    background: var(--main-bg-color, #fff);
}

.zth-search-input::-webkit-search-cancel-button {
    display: none;
}

.zth-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 19px;
    height: 19px;
    color: var(--muted-3-color, #b1b1b1);
    pointer-events: none;
}

.zth-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--muted-bg-color, #eee);
    color: var(--muted-2-color, #999);
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}

.zth-clear.zth-show {
    display: flex;
}

.zth-clear:hover {
    background: var(--muted-4-color, #d2d2d2);
    color: var(--main-bg-color, #fff);
}

.zth-clear svg {
    width: 13px;
    height: 13px;
}

/* ---------- 内容卡片（复用主题原生卡片类） ---------- */
.zth-card {
    min-width: 0;
    box-sizing: border-box;
    transition: opacity 0.2s;
}

.zth-card.box-body {
    padding: 30px 30px 34px;
}

.zth-card.zth-loading {
    opacity: 0.55;
    pointer-events: none;
}

.zth-card .zth-total {
    font-size: 13px;
    color: var(--muted-2-color, #999);
    margin: 0 2px 20px;
    line-height: 1.6;
}

/* 短代码容器 */
.zth-card.zth-shortcode {
    margin-bottom: 20px;
}

/* ---------- 标签网格（统一宽度卡片） ---------- */
.zth-grid {
    display: grid;
    grid-template-columns: repeat(var(--zth-cols, 5), minmax(0, 1fr));
    gap: 16px;
    box-sizing: border-box;
}

@media (max-width: 1199.98px) {
    .zth-grid {
        --zth-cols: 4 !important;
    }
}

@media (max-width: 991.98px) {
    .zth-grid {
        --zth-cols: 3 !important;
    }
}

@media (max-width: 575.98px) {
    .zth-grid {
        --zth-cols: 2 !important;
    }
}

.zth-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 14px 16px;
    box-sizing: border-box;
    background: var(--muted-bg-2-color, #f6f7f8);
    border: 1px solid transparent;
    border-radius: calc(var(--main-radius, 8px) - 2px);
    color: var(--main-color, #4e5358);
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.2s, color 0.2s;
}

.zth-tag:hover {
    background: var(--main-bg-color, #fff);
    border-color: var(--muted-3-color, #b1b1b1);
    box-shadow: 0 6px 18px var(--main-shadow, rgba(116, 116, 116, 0.08));
    transform: translateY(-2px);
    color: var(--key-color, #333);
    text-decoration: none;
}

.zth-tag-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.zth-tag-count {
    flex: none;
    font-size: 12px;
    color: var(--muted-3-color, #b1b1b1);
    font-variant-numeric: tabular-nums;
    background: var(--main-bg-color, #fff);
    border-radius: 100px;
    padding: 2px 8px;
    line-height: 1.5;
    transition: color 0.2s;
}

.zth-tag:hover .zth-tag-count {
    color: var(--muted-2-color, #999);
    background: var(--muted-bg-2-color, #f6f7f8);
}

/* ---------- 分类索引（卡片式网格） ---------- */
.zth-cats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    box-sizing: border-box;
}

@media (max-width: 991.98px) {
    .zth-cats {
        grid-template-columns: minmax(0, 1fr);
    }
}

.zth-cat {
    min-width: 0;
    padding: 22px 22px 24px;
    box-sizing: border-box;
    background: var(--muted-bg-2-color, #f6f7f8);
    border: 1px solid transparent;
    border-radius: var(--main-radius, 8px);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.zth-cat:hover {
    border-color: var(--muted-3-color, #b1b1b1);
    box-shadow: 0 6px 18px var(--main-shadow, rgba(116, 116, 116, 0.08));
    transform: translateY(-2px);
}

.zth-cat-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--main-border-color, rgba(50, 50, 50, 0.06));
    text-decoration: none;
}

.zth-cat-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--key-color, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    transition: color 0.2s;
}

.zth-cat-head:hover .zth-cat-name {
    color: var(--theme-color, #f04494);
}

.zth-cat-count {
    flex: none;
    font-size: 12px;
    color: var(--muted-3-color, #b1b1b1);
    font-variant-numeric: tabular-nums;
    background: var(--main-bg-color, #fff);
    border-radius: 100px;
    padding: 3px 10px;
    line-height: 1.5;
}

.zth-cat-children {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.zth-cat-child {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px 12px;
    box-sizing: border-box;
    border-radius: 100px;
    background: var(--main-bg-color, #fff);
    border: 1px solid var(--muted-border-color, rgba(0, 0, 0, 0.03));
    color: var(--muted-color, #777);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.5;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.zth-cat-child:hover {
    color: var(--theme-color, #f04494);
    border-color: var(--theme-color, #f04494);
    background: var(--main-bg-color, #fff);
    text-decoration: none;
}

.zth-cat-child-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.zth-cat-child-count {
    flex: none;
    font-size: 12px;
    color: var(--muted-3-color, #b1b1b1);
    font-variant-numeric: tabular-nums;
}

/* ---------- 分页 ---------- */
.zth-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
    padding-top: 4px;
}

.zth-pg {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: calc(var(--main-radius, 8px) - 2px);
    font-size: 14px;
    line-height: 1;
    color: var(--muted-color, #777);
    text-decoration: none;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

a.zth-pg:hover {
    color: var(--key-color, #333);
    background: var(--muted-bg-2-color, #f6f7f8);
    text-decoration: none;
}

.zth-pg.zth-current {
    background: var(--key-color, #333);
    color: var(--main-bg-color, #fff);
    font-weight: 500;
}

.zth-pg.zth-current:hover {
    color: var(--main-bg-color, #fff);
    background: var(--key-color, #333);
}

.zth-pg.zth-disabled {
    opacity: 0.35;
    pointer-events: none;
}

.zth-pg.zth-ellipsis {
    color: var(--muted-3-color, #b1b1b1);
    pointer-events: none;
}

.zth-nav-text {
    font-size: 14px;
}

/* ---------- 空状态 ---------- */
.zth-empty {
    padding: 72px 16px;
    text-align: center;
    color: var(--muted-3-color, #b1b1b1);
}

.zth-empty svg {
    width: 38px;
    height: 38px;
    display: block;
    margin: 0 auto 16px;
    color: var(--muted-4-color, #d2d2d2);
}

.zth-empty p {
    font-size: 14px;
    margin: 0 0 6px;
    color: var(--muted-2-color, #999);
}

.zth-empty .zth-empty-sub {
    font-size: 13px;
    color: var(--muted-3-color, #b1b1b1);
    margin: 0;
}

/* ---------- 移动端微调 ---------- */
@media (max-width: 575.98px) {
    .zth-head {
        padding-bottom: 18px;
        margin-bottom: 22px;
    }

    .zth-head-title {
        font-size: 24px;
    }

    .zth-head-desc {
        font-size: 13px;
        margin-top: 6px;
    }

    .zth-card.box-body {
        padding: 22px 16px 26px;
    }

    .zth-search {
        margin-bottom: 20px;
    }

    .zth-search-input {
        height: 46px;
        font-size: 14px;
        padding: 0 46px 0 44px;
    }

    .zth-grid {
        gap: 10px;
    }

    .zth-tag {
        padding: 12px 12px;
    }

    .zth-cat {
        padding: 18px 16px 20px;
    }

    .zth-cat-name {
        font-size: 15px;
    }

    .zth-cats {
        gap: 12px;
    }
}

/* ---------- 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    .zth-tag,
    .zth-cat,
    .zth-cat-child,
    .zth-search-input,
    .zth-clear,
    .zth-card,
    .zth-pg {
        transition: none;
    }
}
