/* ============================================================
   首页瀑布流模块 index_waterfall
   90% 容器 + 顶部大图幻灯片 + 吸顶分类导航 + 瀑布流（滚动加载）
   颜色/字号全部走 Ji_main.php 变量体系（亮暗自适应）
   ============================================================ */

/* B2 设了 body{overflow-x:hidden; overflow-y:auto}，会使 position:sticky 相对不滚动的 body 而失效，
   吸顶分类导航无法固定。同文档页方案将 body 两轴恢复 visible（瀑布流全宽 100vw 不产生横向滚动） */
body.home.jitheme-custom-nav {
    overflow: visible !important;
}

/* 首页：顶部导航固定吸顶（fixed 不受父级 overflow 影响），分类导航条吸在其正下方（.ji-wf-catnav top:60px） */
body.home.jitheme-custom-nav .top-style {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8;
}

/* ---- 模块外层：只保留背景颜色，宽度跟随 wrapper（100%），居中 ---- */
.ji-waterfall {
    background: var(--bg-body);
    margin-left: auto;
    margin-right: auto;
    width: 100% !important;
    max-width: none;
}
@media screen and (max-width: 768px) {
    .ji-waterfall {
        width: 100%;
    }
}
/* 内容容器：宽度跟随模块「宽度值」（--ji-module-w，与 wrapper 同源），居中 */
.ji-waterfall-inner,
.ji-wf-inner90 {
    width:100%;
    margin-left: auto;
    margin-right: auto;
    max-width: none;
}

/* ============================================================
   1. 顶部大图幻灯片（外围 ji-wf-hero-outer 伪元素全宽白底，内容按模块宽度值）
   ============================================================ */
/* 外围层：相对定位，伪元素铺满浏览器宽度做白色背景（无需负 margin） */
.ji-wf-hero-outer,
.ji-wf-catnav-outer {
    position: relative;
}
.ji-wf-hero-outer {
    margin-top: -20px;
}
.ji-wf-hero-outer::before,
.ji-wf-catnav-outer::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background: var(--bg-card);
    z-index: 0;
}
.ji-wf-hero-outer > *,
.ji-wf-catnav-outer > * {
    position: relative;
    z-index: 1;
}
.ji-wf-hero {
    width: 100%;
    height: 300px;
    position: relative;
    padding-top: 25px;
    overflow: hidden;
    background: var(--bg-card);
}
.ji-wf-inner90 {
    position: relative;
    height: 100%;
}
.ji-wf-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    cursor: pointer;
    pointer-events: none;
    border-radius: var(--b2radius);
}
.ji-wf-slide.active {
    opacity: 1;
    pointer-events: auto;
}
/* 后台未配图时：透明背景，露出 hero 全宽渐变 */
.ji-wf-slide-empty {
    background: transparent !important;
}
/* 文案层（居中） */
.ji-wf-hero-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 40px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.35) 100%);
}
.ji-wf-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: var(--fs-sm);
    color: #fff;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.ji-wf-badge span { margin-right: 6px; }
.ji-wf-hero-content h1 {
    font-size: var(--fs-lg);
    line-height: 1.3;
    font-weight: 700;
    color: #fff;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.ji-wf-hero-content p {
    font-size: var(--fs-base);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 25px;
    max-width: 700px;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}
.ji-wf-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    pointer-events: auto;
}
.ji-wf-btn {
    padding: 10px 26px;
    border-radius: 6px;
    font-size: var(--fs-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-decoration: none;
    display: inline-block;
}
.ji-wf-btn-primary {
    background: #fff;
    color: #111;
}
.ji-wf-btn-primary:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}
.ji-wf-btn-outline {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(4px);
}
.ji-wf-btn-outline:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}
/* 底部控制区 */
.ji-wf-slider-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    padding: 6px 18px;
    border-radius: 30px;
}
.ji-wf-arrow {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    padding: 0;
    line-height: 1;
}
.ji-wf-arrow:hover { color: #fff; }
.ji-wf-dots {
    display: flex;
    gap: 8px;
}
.ji-wf-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}
.ji-wf-dot.active {
    background: #fff;
    width: 24px;
    border-radius: 4px;
}

/* ============================================================
   2. 吸顶分类导航（外围 ji-wf-catnav-outer 吸顶 + 伪元素全宽白底，标签按模块宽度值）
   ============================================================ */
.ji-wf-catnav-outer {
    position: sticky;
    top: 60px;
    z-index: 3;
    box-shadow: none;
}
.ji-wf-catnav {
    width: 100%;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
}
.ji-wf-catnav .ji-wf-inner90 {
    position: relative;
    display: flex;
    gap: 15px;
    overflow-x: auto;
    white-space: nowrap;
    padding: 15px 0;
    padding-right: 380px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.ji-wf-catnav::-webkit-scrollbar { display: none; }
.ji-wf-cat {
    padding: 8px 18px;
    border-radius: 5px;
    font-size: var(--fs-base);
    color: var(--text-secondary);
    background: var(--bg-card);
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
}
.ji-wf-cat:hover,
.ji-wf-cat.active {
    background-color: var(--primary);
    color: #fff;
}
/* 「我的分类」标签与最右侧操作区（统计 + 我的分类 + 发布素材） */
.ji-wf-cat.ji-wf-my {
    color: var(--primary);
    background: var(--bg-card);
    border: none;
}
.ji-wf-cat.ji-wf-my.active {
    background-color: var(--primary);
    color: #fff;
}
.ji-wf-nav-right {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding-left: 14px;
    z-index: 1;
}
.ji-wf-total {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    white-space: nowrap;
}
.ji-wf-total b {
    color: var(--primary);
    font-weight: 600;
}
.ji-wf-mybtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: var(--fs-sm);
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    white-space: nowrap;
}
.ji-wf-mybtn .ji-wf-mybtn-ico {
    width: 15px;
    height: 15px;
    fill: currentColor;
    flex-shrink: 0;
    display: inline-block;
}
.ji-wf-mybtn .ji-wf-mybtn-refresh { display: none; }
.ji-wf-mybtn:hover {
    background: #eeeeee;
    border-color: var(--border-color);
    color: #111111;
}
.ji-wf-mybtn:hover .ji-wf-mybtn-edit { display: none; }
.ji-wf-mybtn:hover .ji-wf-mybtn-refresh { display: inline-block; }
/* 发布素材按钮（蓝色主按钮） */
.ji-wf-pub-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: var(--fs-sm);
    color: #fff;
    background: var(--primary);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
    white-space: nowrap;
    border: 1px solid var(--primary);
}
.ji-wf-pub-btn:hover {
    background: var(--primary);
    color: #fff;
    opacity: 0.9;
}

/* ============================================================
   3. 瀑布流文章（经典 Masonry：float 第一行 + 绝对定位补最短列，容器宽度由 JS 按列数计算）
   ============================================================ */
.ji-wf-grid {
    position: relative;
    margin: 30px auto 20px;
}
.ji-wf-item {
    float: left;
    /* 卡片宽度由 JS 按容器宽度弹性计算（grid 100% 撑满） */
    width: 280px;
    margin: 8px;
    position: relative;
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
    border: 1px solid var(--border-color);
}
.ji-wf-fav {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    opacity: 0; /* 默认隐藏，悬停文章卡片时显示 */
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    line-height: 1;
}
.ji-wf-item:hover .ji-wf-fav {
    opacity: 0.9;
}
.ji-wf-fav:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.06);
}
.ji-wf-fav.active {
    opacity: 1; /* 已收藏的按钮始终显示 */
    color: #ffd666;
    background: rgba(0, 0, 0, 0.55);
}
.ji-wf-item:hover {
    transform: translateY(-5px);
    box-shadow: none;
    border-color: var(--border-light);
}
.ji-wf-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.ji-wf-img {
    width: 100%;
    overflow: hidden;
    position: relative;
    background: var(--bg-input);
}
.ji-wf-img img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}
.ji-wf-item:hover .ji-wf-img img { transform: scale(1.05); }
.ji-wf-info {
    padding: 15px;
    background: var(--bg-card);
}
.ji-wf-info h3 {
    font-size: var(--fs-base);
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ji-wf-info span {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    display: block;
}
/* ================= 作者信息行（Meta Top） ================= */
.ji-wf-meta-top {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}
.ji-wf-meta-top .ji-wf-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
    display: inline-block;
    background: var(--bg-input);
}
.ji-wf-meta-top .ji-wf-author {
    color: var(--text-secondary);
    font-weight: 500;
    display: inline;
}
.ji-wf-meta-top .ji-wf-date {
    margin-left: auto;
    display: inline;
}
/* ================= 底部操作栏（Meta Bottom：喜欢/评论/收藏） ================= */
.ji-wf-actions {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    background: var(--bg-input);
    border-top: 1px solid var(--border-color);
}
.ji-wf-action {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    outline: none;
    line-height: 1;
}
.ji-wf-action:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
    color: var(--text-primary);
}
.ji-wf-action svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: fill 0.2s ease, transform 0.2s ease;
}
.ji-wf-action .count {
    font-size: var(--fs-xs);
}
/* 喜欢 */
.ji-wf-action.ji-wf-like:hover { color: #ff4757; background: rgba(255, 71, 87, 0.1); }
.ji-wf-action.ji-wf-like.active { color: #ff4757; }
.ji-wf-action.ji-wf-like.active svg { fill: #ff4757; transform: scale(1.1); }
/* 评论 */
.ji-wf-action.ji-wf-comment:hover { color: #1e90ff; background: rgba(30, 144, 255, 0.1); }
/* 收藏（与右上角 ji-wf-fav 同一收藏逻辑，favorites.js 自动联动） */
.ji-wf-action.ji-wf-fav2 { font-family: inherit; }
.ji-wf-action.ji-wf-fav2 i { font-size: 16px; font-style: normal; }
.ji-wf-action.ji-wf-fav2:hover { color: #ffa502; background: rgba(255, 165, 2, 0.12); }
.ji-wf-action.ji-wf-fav2.active { color: #ffa502; }
.ji-wf-action.ji-wf-fav2.active i { color: #ffa502; }
.ji-wf-empty {
    width: 100%;
    text-align: center;
    padding: 60px 0;
    font-size: var(--fs-base);
    color: var(--text-muted);
    background: var(--bg-card);
    border-radius: var(--b2radius);
}
/* 加载状态 */
.ji-wf-status {
    text-align: center;
    padding: 25px 0 10px;
    font-size: var(--fs-sm);
    color: var(--text-muted);
    min-height: 30px;
}
.ji-wf-status .ji-wf-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ji-wf-status .ji-wf-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 1px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: jiWfSpin 0.8s linear infinite;
}
@keyframes jiWfSpin {
    to { transform: rotate(360deg); }
}

/* 暗夜微调：吸顶导航阴影更轻 */
body.dark .ji-wf-catnav {
    box-shadow: none;
}
body.dark .ji-wf-cat,
body.dark .ji-wf-mybtn {
    background: var(--bg-card);
    border-color: var(--border-color);
}
body.dark .ji-wf-total {
    color: var(--text-muted);
}

/* 响应式 */
@media (max-width: 850px) {
    .ji-wf-hero {
        height: auto;
        min-height: 400px;
        padding: 0;
        width: 100%;
        margin-left: 0;
    }
    .ji-wf-catnav {
        width: 100%;
        margin-left: 0;
    }
    .ji-wf-inner90 {
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
    .ji-wf-hero-content { padding: 50px 24px; }
    .ji-wf-hero-content h1 { font-size: var(--fs-md); }
    .ji-wf-hero-content p { font-size: var(--fs-sm); }
    .ji-wf-slider-controls { bottom: 14px; }
    .ji-waterfall-inner {
        width: 94%;
        margin-left: auto;
        margin-right: auto;
    }
}
@media (max-width: 520px) {
    .ji-wf-buttons { flex-direction: column; width: 100%; max-width: 220px; }
    .ji-wf-grid { margin-top: 20px; }
    .ji-wf-catnav .ji-wf-inner90 { padding-right: 240px; }
    .ji-wf-nav-right { gap: 8px; }
    .ji-wf-total { display: none; }
    .ji-wf-pub-btn { padding: 8px 14px; }
}

/* ============================================================
   4. 我的分类弹窗
   ============================================================ */
.ji-wf-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
}
.ji-wf-modal {
    position: relative;
    background: var(--bg-card);
    width: 560px;
    max-width: 100%;
    height: auto;
    max-height: 72vh;
    border-radius: 16px;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: jiWfModalUp 0.3s ease-out;
}
@keyframes jiWfModalUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.ji-wf-modal-close {
    position: absolute;
    top: 20px;
    right: 22px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    font-weight: 200;
    line-height: 1;
    transition: color 0.2s;
    z-index: 20;
    background: none;
    border: none;
    padding: 0;
}
.ji-wf-modal-close:hover { color: var(--text-primary); }
.ji-wf-modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 6px 28px 120px;
}
.ji-wf-modal-scroll::-webkit-scrollbar { width: 6px; }
.ji-wf-modal-scroll::-webkit-scrollbar-track { background: transparent; }
.ji-wf-modal-scroll::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
.ji-wf-modal-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
.ji-wf-modal-header {
    flex-shrink: 0;
    padding: 26px 28px 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 0%, var(--bg-card) 100%),
        url('http://cadsee.cn/wp-content/themes/Jitheme/images/wdxqmodalbg.png') no-repeat center top / cover;
}
.ji-wf-modal-header h2 {
    font-size: 22px;
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 0;
    letter-spacing: 0.5px;
}
.ji-wf-modal-header p { color: rgba(31, 41, 55, 0.72); font-size: var(--fs-sm); flex-basis: 100%; margin-top: 8px; }
.ji-wf-modal-tip {
    display: inline-block;
    margin-top: 0;
    padding: 3px 10px;
    border-radius: 4px;
    background: rgba(31, 41, 55, 0.08);
    color: rgba(31, 41, 55, 0.62);
    font-size: var(--fs-xs);
}
.ji-wf-modal-section { margin-bottom: 22px; }
.ji-wf-modal-cat-title {
    font-size: var(--fs-sm);
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 500;
}
.ji-wf-modal-cat-title span { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: normal; margin-left: 4px; }
.ji-wf-modal-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.ji-wf-modal-tag {
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: var(--fs-xs);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background: var(--bg-input);
}
.ji-wf-modal-tag:hover { border-color: var(--text-secondary); background: var(--bg-hover, var(--bg-input)); }
.ji-wf-modal-tag.selected {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
}
.ji-wf-modal-foot {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 80px 28px 22px;
    display: flex;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(to top, var(--bg-card) 70%, rgba(255, 255, 255, 0));
    pointer-events: none;
}
.ji-wf-modal-clear {
    pointer-events: auto;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 11px 24px;
    border-radius: 50px;
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}
.ji-wf-modal-clear:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.ji-wf-modal-save {
    pointer-events: auto;
    background: #111111;
    color: #ffffff;
    border: none;
    padding: 11px 46px;
    border-radius: 50px;
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
}
.ji-wf-modal-save:hover { background: #333333; transform: translateY(-1px); }
.ji-wf-modal-save:active { transform: translateY(1px); }
.ji-wf-modal-empty {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 0;
    font-size: var(--fs-base);
}
@media (max-width: 720px) {
    .ji-wf-modal { max-height: 90vh; }
    .ji-wf-modal-scroll { padding: 6px 20px 80px; }
    .ji-wf-modal-foot { padding: 12px 20px 20px; }
    .ji-wf-modal-header { padding: 20px 20px 12px; }
}
