/* ================================================================
 * 鲁氏族谱系统 · 牒记式世系瀑布流
 * 版权：指尖网络（贵州指尖网络科技有限公司）
 *
 * 设计语言：中国风行传族谱 · 子在父下 · 垂直自动向下展开
 *  - 深度优先逐行排列：先父后子、长子在前，每行缩进一级，父子关系一目了然
 *  - 世系竖线：每级一条贯穿竖线 + 每行一个连接横钩（金铜色），标准牒记式世系表
 *  - 颜色语义：男子 = 黑色；家族女子（鲁姓） = 红色；嫁入媳妇 = 粉色（丈夫行内"配XX氏"标签）
 *  - 筛选：隐藏女子 / 隐藏媳妇 两个开关，前端 class 切换，无请求无闪烁
 *  - 点击行 → 进入族人详情页（?c=member&a=detail&id=）
 *  - 数据由 PHP 服务端全量直出 + 文件缓存，进入页面即完整显示，无任何渲染加载
 * ================================================================ */

/* ---- 容器与工具栏 ---- */
.ftree-svg-container {
    background:
        radial-gradient(ellipse at 15% 0%, rgba(216,181,106,.14) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 100%, rgba(184,37,42,.06) 0%, transparent 50%),
        linear-gradient(180deg, #FBF6EA 0%, #F6EEDC 100%);
    border: 1px solid #E3D5B5;
    border-radius: 10px;
    min-height: 420px;
    position: relative;
}

.gw-toolbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(255,252,245,.97), rgba(255,252,245,.9));
    border-bottom: 1px solid #E8DCBE;
    backdrop-filter: blur(4px);
}
.gw-stats {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6B5A3E;
    letter-spacing: .5px;
}
.gw-stats b { color: #8B0000; font-size: 16px; }
.gw-stats-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #C8102E, #8B0000);
    color: #F6EEDC;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(139,0,0,.35);
}

/* ---- 筛选开关 ---- */
.gw-filters { display: inline-flex; gap: 14px; align-items: center; }
.gw-filter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #5A4428;
    cursor: pointer;
    user-select: none;
}
.gw-filter input {
    width: 16px;
    height: 16px;
    accent-color: #8B0000;
    cursor: pointer;
}

/* ---- 世系主体（牒记式瀑布流） ---- */
.gw-scroll {
    padding: 10px 16px 40px 8px;
    max-height: 74vh;
    overflow-y: auto;
}
.pd-wall {
    max-width: 1240px;
    margin: 0 auto;
    padding: 10px 0 24px;
}

/* ================================================================
 * v2.4.47 树形图重构：世代泳道谱牒墙
 * 每世一条泳道带（金铜徽标+人数），泳道内谱牒卡片网格；
 * 男子黑 / 女子红 / 媳妇粉；无连线无重叠，同代一目了然
 * ================================================================ */
.ped-gen-band {
    margin: 0 0 18px;
    padding: 0 14px 14px;
    background: linear-gradient(180deg, rgba(255,253,246,.55), rgba(255,255,255,0));
    border-left: 3px solid #D4AF37;
    border-radius: 4px 12px 12px 4px;
}
.ped-gen-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 6px 0 2px;
}
.ped-gen-badge {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    background: linear-gradient(135deg, #C8102E, #8B0000);
    padding: 3px 14px;
    border-radius: 16px;
    box-shadow: 0 2px 6px rgba(139,0,0,.2);
}
.ped-gen-count {
    font-size: 12px;
    color: #A08A5E;
    background: #F4EBD6;
    padding: 2px 10px;
    border-radius: 12px;
}
.ped-gen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 10px;
}

/* ---- 谱牒卡片 ---- */
.ped-card {
    background: #fff;
    border: 1px solid #EFE6D6;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.ped-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(139,0,0,.12);
    border-color: #D4AF37;
}
.ped-card-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px 10px;
    text-decoration: none;
}
.ped-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: #2B2620;   /* 男子：深黑 */
}
.ped-card.female .ped-avatar { background: #C8102E; }   /* 女子：红 */
.ped-card.wife .ped-avatar { background: #E0709F; }     /* 媳妇：粉 */
.ped-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #2B2620;         /* 男子：黑 */
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ped-card.female .ped-name { color: #C8102E; }   /* 女子：红 */
.ped-card.wife .ped-name { color: #D6538A; }     /* 媳妇：粉 */
.ped-sub {
    font-size: 11px;
    color: #8A8177;
    line-height: 1.5;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ped-card.wife .ped-sub { color: #B0779A; }

/* ---- 隐藏筛选（前端 class 切换） ---- */
.gw-scroll.hide-female .ped-card.female { display: none; }
.gw-scroll.hide-wife .ped-card.wife { display: none; }

/* ---- 移动端适配 ---- */
@media (max-width: 640px) {
    .gw-toolbar { flex-direction: column; align-items: flex-start; }
    .ped-gen-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
    .ped-name { font-size: 14px; }
    .ped-gen-band { padding: 0 10px 12px; }
}

/* ================================================================
 * 综合优化扩展：内容为主 · 三视图统一 · 牒记式美观大气
 * ================================================================ */

/* ---- 顶部压缩：工具栏 / 筛选栏 / 按钮为辅 ---- */
.ftree-toolbar { padding: 8px 14px !important; min-height: 44px !important; }
.ftree-title { font-size: 16px !important; letter-spacing: 1px !important; }
.ftree-btn { padding: 3px 11px !important; font-size: 12px !important; border-radius: 6px !important; }
.ftree-view-tab { padding: 3px 12px !important; font-size: 12px !important; }
.ftree-filters { padding: 7px 14px !important; }
.ftree-filter-label { font-size: 12px !important; }
.ftree-select { padding: 4px 10px !important; font-size: 12px !important; border-radius: 6px !important; }
.ftree-filter-group .ftree-btn { padding: 3px 10px !important; font-size: 12px !important; }
.ftree-hint { font-size: 11px !important; color: #A08A5E !important; }

/* ---- 紧凑统计条（信息一行，置于顶部） ---- */
.ftree-stats-bar {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px 18px !important;
    margin: 0 14px 8px !important;
    padding: 6px 14px !important;
    background: linear-gradient(90deg, rgba(139,0,0,.06), rgba(255,253,246,.4)) !important;
    border: 1px solid #E8DCBE !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    color: #6B5A3E !important;
    box-shadow: 0 1px 4px rgba(90,68,40,.06) !important;
}
.ftree-stat-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ftree-stat-value { color: #8B0000; font-weight: 600; }

/* ---- 内容为主：树容器加大，按钮为辅 ---- */
.ftree-container-wrapper {
    padding: 0 14px 10px !important;
    min-height: calc(100vh - 210px) !important;
}
.ftree-container { min-height: calc(100vh - 210px) !important; }
.ftree-content {
    height: calc(100vh - 210px) !important;
    min-height: 420px !important;
    overflow: auto !important;
}
.gw-scroll {
    max-height: calc(100vh - 180px) !important;
    min-height: 420px !important;
}

/* 图例 */
.pd-legend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6B5A3E;
}
.pd-legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.pd-legend .lg-male { background: #3A342C; }
.pd-legend .lg-female { background: #C8102E; }
.pd-legend .lg-wife { background: #E0709F; }

/* ---- 吊线图 / 列表视图：内容为主，风格与树状图统一 ---- */
.hanging-v3 {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px;
}
.hanging-v3-gen { margin-bottom: 18px; }
.hanging-v3-gen-label { margin-bottom: 10px; }
.hanging-v3-gen-badge {
    display: inline-block;
    padding: 3px 16px;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #FFF6E3;
    background: linear-gradient(135deg, #C8102E, #8B0000);
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(139,0,0,.22);
}
.hanging-v3-member {
    background: #FFFDF6;
    border: 1px solid #E3D5B5;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(90,68,40,.08);
    transition: all .18s ease;
}
.hanging-v3-member:hover { border-color: #D4AF37; box-shadow: 0 4px 14px rgba(139,0,0,.16); transform: translateY(-2px); }
.hanging-v3-member-name { color: #2B2620; font-weight: 600; letter-spacing: 1px; }
.hanging-v3-member.male .hanging-v3-member-name { color: #2B2620; }
/* 吊线图女子名字改为黑色（与男子一致），配偶标签保留粉色 */
.hanging-v3-member.female .hanging-v3-member-name { color: #2B2620; }
.hanging-v3-spouse { color: #E0709F; }

/* 列表视图表格：内容为主、紧凑表头 */
.ftree-content table {
    max-width: 1280px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(90,68,40,.08);
}
.ftree-content th { padding: 9px 12px !important; font-size: 13px !important; letter-spacing: 1px !important; }
.ftree-content td { padding: 8px 12px !important; font-size: 13px !important; }
.ftree-content tr:hover td { background: #FBF6EA; }

/* 移动端：三视图统一收缩 */
@media (max-width: 640px) {
    .ftree-toolbar { flex-wrap: wrap; gap: 6px !important; }
    .ftree-actions { flex-wrap: wrap; }
    .ftree-stats-bar { margin: 0 10px 6px !important; font-size: 11px !important; }
    .ftree-container-wrapper, .ftree-container { min-height: 60vh !important; }
    .ftree-content { height: 62vh !important; }
    .gw-scroll { max-height: calc(100vh - 140px) !important; }
    .pd-legend { display: none; }
}