/* 分支信息（名称+描述）内联编辑样式 */
/* banner-info 添加相对定位，用于右下角按钮定位 */
.banner-info { position: relative; padding-bottom: 36px; }
.banner-info-edit-ctrl {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 2;
}
.banner-desc-edit-btn {
    display: inline-block;
    padding: 5px 16px;
    background: var(--primary);
    color: #FFFFFF !important;
    border: 1px solid var(--primary-dark);
    border-radius: 4px;
    font-size: 13px;
    font-weight: normal;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, box-shadow .15s ease;
    box-shadow: 0 2px 6px rgba(158, 32, 32, 0.25);
}
.banner-desc-edit-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 3px 10px rgba(158, 32, 32, 0.35);
}
.banner-title-editing { display: flex; align-items: center; flex-wrap: wrap; }

/* ============ 家族成员「世代垂直滚动」 ============ */
.member-group-wrap {
    position: relative;
    overflow: hidden;
    /* 兜底：在 JS 未执行前限制到 5 代高度（60px/代）防止闪白 */
    max-height: calc(60px * 5);
}
/* 静态（<=5 代）：高度根据实际代数自动收缩，不固定为 5 代高，允许完整显示 */
.member-group-wrap.mg-wrap-static {
    max-height: none;
    height: auto !important;
    overflow: visible;
}
/* 滚动（>5 代）：JS 精确设置 wrap.style.height=5*itemHeight，
   这里移除 max-height 兜底避免压掉实测高度（每代通常 > 60px） */
.member-group-wrap.mg-wrap-scroll {
    max-height: none;
}
/* 静态（<=5 代）：不做 transform，自然高度展开 */
.member-group-list.mg-static {
    display: block;
}
/* 滚动模式（>5 代）：双份拷贝 + translateY，will-change 提示浏览器加速 */
.member-group-list.mg-scroll {
    display: block;
    will-change: transform;
}
/* 双份拼接时第一份最后一块也要保留下虚线，避免衔接处断层 */
.member-group-list.mg-scroll .gen-block:last-child {
    border-bottom: 1px dashed var(--border);
}

/* ============ 成员生日预告 ============ */
.panel-birthday-tip .panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.bd-tip-wrap {
    position: relative;
    /* 7 行可见高度：由 CSS calc 兜底，若测量失败也能显示7行 */
    max-height: calc(44px * 7);
    overflow: hidden;
}

.bd-tip-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bd-tip-list.bd-scroll {
    will-change: transform;
}

.bd-tip-item {
    margin: 0;
    padding: 0;
}

.bd-tip-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-bottom: 1px dashed #ece3c8;
    text-decoration: none;
    color: inherit;
    transition: background .15s ease;
    min-height: 44px;
    box-sizing: border-box;
    flex-wrap: wrap;
}
.bd-tip-link:hover {
    background: #faf4dd;
    text-decoration: none;
}

.bd-tip-item:last-child .bd-tip-link {
    border-bottom: none;
}

.bd-gender {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}
.bd-gender-male {
    background: #e4ecf7;
    color: #2c5282;
}
.bd-gender-female {
    background: #fae2e2;
    color: #9E2020;
}

.bd-tip-name {
    font-weight: 600;
    color: #4c3d0f;
    font-size: 14px;
    flex-shrink: 0;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bd-tip-gen {
    background: #f5ecd0;
    color: #8b6914;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
    flex-shrink: 0;
}

.bd-tip-lunar {
    color: #a9975a;
    font-size: 12px;
    flex-shrink: 0;
}

/* 「还有 N 天」放在名字右侧，使用 margin-left:auto 推到最右 */
.bd-days {
    margin-left: auto;
    color: #8b7a3c;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f7efd5;
    white-space: nowrap;
    flex-shrink: 0;
}
.bd-days-soon {
    background: #fff3e0;
    color: #c05621;
}
.bd-days-today {
    background: linear-gradient(90deg,#fde2e2,#fff0d9);
    color: #9E2020;
    font-weight: 600;
}

/* 字辈布局和滚动说明公共样式（所有访客可见） */
.banner-generation { flex-wrap: wrap; row-gap: 10px; }
.banner-gen-chars { flex: 1 0 100%; min-width: 0; }
/* 滚动说明容器：标题和编辑按钮之间 */
.banner-gen-scroll-wrap {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    margin: 0 14px;
    height: 26px;
    line-height: 26px;
    position: relative;
    color: var(--text-light);
    font-size: 13px;
}
/* 仅在滚动时应用左右淡出遮罩 */
.banner-gen-scroll-wrap.is-scrolling {
    mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.banner-gen-scroll-inner {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
    padding-left: 100%;
    transform: translateX(0);
}
/* 文字能完全显示时：去掉 padding，正常左对齐 */
.banner-gen-scroll-inner.is-static {
    padding-left: 0;
    transform: none;
}
.banner-gen-scroll-inner.is-animating {
    animation: genScrollMarquee linear infinite;
}
.gen-scroll-item {
    display: inline-block;
    padding-right: 80px;
}
.banner-gen-scroll-wrap:hover .banner-gen-scroll-inner.is-animating {
    animation-play-state: paused;
}
@keyframes genScrollMarquee {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

/* 字辈编辑按钮和面板样式（分支管理员可见） */
/* 编辑按钮 */
.banner-gen-edit-ctrl {
    flex-shrink: 0;
}
.banner-gen-edit-btn {
    display: inline-block;
    padding: 5px 16px;
    background: var(--primary);
    color: #FFFFFF !important;
    border: 1px solid var(--primary-dark);
    border-radius: 4px;
    font-size: 13px;
    font-weight: normal;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, box-shadow .15s ease;
    box-shadow: 0 2px 6px rgba(158, 32, 32, 0.25);
    white-space: nowrap;
}
.banner-gen-edit-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 3px 10px rgba(158, 32, 32, 0.35);
}

/* 字辈编辑面板 */
.gen-edit-panel {
    background: #FFFFFF;
    border-radius: 8px;
    margin-top: 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.gen-edit-inner { padding: 18px 22px; }
.gen-edit-inner h4 { margin: 0 0 8px; color: var(--primary-dark); font-family: var(--serif); }
.gen-edit-tip { color: var(--text-light); font-size: 13px; margin: 0 0 14px; line-height: 1.7; }
.gen-edit-tip strong { color: var(--primary); }

/* 字辈列表：可拖拽排序 */
.gen-chars-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; min-height: 44px; }
.gen-char-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px 4px 8px;
    cursor: grab;
    transition: border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
    user-select: none;
}
.gen-char-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(158, 32, 32, 0.15);
}
.gen-char-item.dragging {
    opacity: 0.4;
    cursor: grabbing;
}
.gen-char-item.drag-over {
    border-color: var(--primary);
    border-style: dashed;
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(158, 32, 32, 0.1);
}
.gen-char-drag {
    color: var(--text-light);
    font-size: 14px;
    cursor: grab;
    padding: 0 2px;
    line-height: 1;
}
.gen-char-drag:active { cursor: grabbing; }
.gen-char-item input {
    width: 36px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 18px;
    font-family: var(--serif);
    color: var(--primary-dark);
    font-weight: bold;
    outline: none;
}
.gen-char-idx {
    font-size: 10px;
    color: var(--text-light);
    min-width: 16px;
    text-align: center;
}
.gen-char-item .gen-char-del {
    background: none;
    border: none;
    color: #C0392B;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
}
.gen-char-item .gen-char-del:hover { color: #E74C3C; }
.gen-edit-add { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.gen-edit-add input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 15px;
}
.gen-edit-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gen-edit-msg { font-size: 13px; color: var(--text-light); }
.gen-edit-msg.ok { color: #27AE60; }
.gen-edit-msg.err { color: #E74C3C; }

/* ============ 家族信息编辑模式（内联编辑） ============ */
.info-edit-mode {
    display: none;
}
.info-edit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.info-edit-label {
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
}
.info-edit-hint {
    font-size: 12px;
    color: #999;
}
.info-edit-surname-input {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 18px;
    font-family: inherit;
    font-weight: bold;
    width: 70px;
    text-align: center;
    outline: none;
}
.info-edit-familyname-input {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 18px;
    font-family: inherit;
    font-weight: bold;
    flex: 1;
    max-width: 220px;
    outline: none;
}
.info-edit-region-input {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    flex: 1;
    max-width: 300px;
    outline: none;
}
.banner-region {
    font-size: 13px;
    color: var(--text-light);
    margin: 4px 0;
}
.info-edit-name-input {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 22px;
    font-family: inherit;
    font-weight: bold;
    width: auto;
    display: inline-block;
    outline: none;
}
.info-edit-name-hint {
    font-size: 12px;
    color: #999;
    margin-left: 4px;
}
.info-edit-desc-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #FFFFFF;
    color: var(--text);
    font-size: 14px;
    resize: vertical;
    margin-top: 8px;
    outline: none;
}
.info-edit-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.info-edit-msg {
    font-size: 13px;
    color: var(--text-light);
}

/* ============ 加入家族按钮（访客/未加入用户） ============ */
.banner-info-join-ctrl {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 2;
}
.banner-join-btn {
    display: inline-block;
    padding: 6px 18px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
    border: 1px solid transparent;
    line-height: 1.5;
}
.banner-join-btn-apply {
    background: var(--primary);
    color: #FFFFFF !important;
    border-color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(158, 32, 32, 0.25);
}
.banner-join-btn-apply:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(158, 32, 32, 0.35);
    transform: translateY(-1px);
}
.banner-join-btn-guest {
    background: #FFFFFF;
    color: var(--primary) !important;
    border-color: var(--primary);
}
.banner-join-btn-guest:hover {
    background: var(--primary);
    color: #FFFFFF !important;
}
.banner-join-btn-done {
    background: #E8F5E9;
    color: #2E7D32 !important;
    border-color: #A5D6A7;
    cursor: default;
}
.banner-join-btn-pending {
    background: #FFF8E1;
    color: #F57F17 !important;
    border-color: #FFE082;
    cursor: default;
}
.banner-join-btn-disabled {
    background: #ECEFF1;
    color: #78909C !important;
    border-color: #CFD8DC;
    cursor: not-allowed;
}

/* ============ 加入家族弹窗（与个人中心一致） ============ */
.join-modal-card-wrap {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    align-items: center;
    justify-content: center;
}
.join-modal-card {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 28px;
    max-width: 460px;
    width: 90%;
    box-sizing: border-box;
}
.join-modal-title {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--text);
}
.join-modal-tip {
    color: var(--text-light);
    font-size: 14px;
    margin: 0 0 16px;
}
.join-modal-branch-name {
    color: var(--primary);
}
.join-modal-warn {
    color: var(--secondary);
    font-size: 13px;
    margin: 0 0 16px;
    line-height: 1.7;
}
.join-modal-form-row {
    margin-bottom: 16px;
}
.join-modal-label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
}
.join-modal-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
.join-modal-textarea:focus {
    border-color: var(--primary);
}
.join-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
.join-modal-msg {
    margin: 12px 0 0;
    font-size: 14px;
    text-align: center;
}

/* 手机端：弹窗适配 */
@media (max-width: 640px) {
    .banner-info-join-ctrl {
        position: static;
        margin-top: 12px;
    }
    .banner-join-btn {
        display: block;
        width: 100%;
        text-align: center;
        padding: 10px 16px;
        font-size: 15px;
    }
    .join-modal-card {
        padding: 20px 16px;
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        width: calc(100% - 24px);
        max-width: none;
    }
    .join-modal-textarea {
        font-size: 16px;
    }
    .join-modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }
    .join-modal-actions .btn {
        width: 100%;
        padding: 12px;
        font-size: 15px;
        text-align: center;
    }
}

