/* 碑文人物关系排版系统 - 现代金石古风专业工作台样式规范 */
:root {
    --bg-page: #f2ece1;
    --bg-panel: #fcf9f2;
    --border-color: #d6c8b4;
    --border-focus: #8b261e;
    --text-primary: #2a241e;
    --text-muted: #6e6153;
    --primary-color: #8b261e; /* 经典朱砂红 */
    --accent-dark: #231f1c;   /* 玄黑石刻色 */
    --deceased-color: #1f1f1f;
    --alive-color: #b71c1c;
    --highlight-color: #df9e38;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部工作栏 */
.top-navbar {
    background-color: #2b2421;
    color: #e5ded2;
    height: 52px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #5a483a;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: bold;
    letter-spacing: 1px;
}

.archive-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
}

.select-archive {
    background: #413732;
    color: #f5eee4;
    border: 1px solid #63534a;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    max-width: 220px;
}

.nav-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 按钮通用 */
.btn {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    user-select: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.btn-primary:hover {
    background-color: #6f1912;
}

.btn-outline {
    background: transparent;
    color: #e2d9cd;
    border-color: #5d4d42;
}
.btn-outline:hover {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
}

.btn-secondary {
    background-color: #e7dfd3;
    color: #3b3229;
    border-color: #cbbeab;
}
.btn-secondary:hover {
    background-color: #dbd0c0;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-danger {
    background-color: #c0392b;
    color: #fff;
}
.btn-danger:hover {
    background-color: #962d22;
}

/* 主三栏工作台布局 */
.workbench-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* 左侧栏：资料树 */
.sidebar-left {
    width: 290px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
}

/* 右侧栏：属性与版面设置面板 */
.sidebar-right {
    width: 330px;
    background-color: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 10;
}

.panel-header {
    padding: 12px 16px;
    background: #eae2d3;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #4a3a2a;
}

.panel-body {
    padding: 14px;
    overflow-y: auto;
    flex: 1;
}

/* 亲属树形卡片列表 */
.tree-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tree-node-item {
    background: #fff;
    border: 1px solid #dfd3c0;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tree-node-item:hover {
    border-color: #b59e81;
    background: #fffaf0;
}
.tree-node-item.active {
    border-color: var(--primary-color);
    background: #fdf5f4;
    box-shadow: 0 0 0 1px var(--primary-color);
}

.tree-node-title {
    font-weight: bold;
    font-size: 13px;
    color: #8b261e;
    margin-right: 6px;
}
.tree-node-names {
    font-size: 13px;
    color: #2b2b2b;
}

/* 中央画布区域 */
.canvas-center {
    flex: 1;
    background-color: #e5ded2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.canvas-toolbar {
    height: 42px;
    background: #f5efe4;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 5;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

/* 可视化画布外包装容器 */
.svg-viewport {
    flex: 1;
    overflow: auto;
    cursor: grab;
    position: relative;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px;
}
.svg-viewport:active {
    cursor: grabbing;
}

/* 实际渲染的 SVG 载体 */
.svg-stage {
    background: #faf6ee;
    box-shadow: 0 6px 24px rgba(40, 30, 20, 0.18);
    border: 1px solid #d4c5ae;
    transition: transform 0.05s ease-out;
    transform-origin: top center;
}

/* SVG 交互节点高亮与选中效果 */
.family-entry-group {
    cursor: pointer;
}
.family-entry-group:hover rect.deceased-border,
.family-entry-group:hover text {
    filter: drop-shadow(0 0 2px rgba(139, 38, 30, 0.4));
}
.family-entry-group.selected text.name-text {
    fill: #d35400 !important;
}

/* 表单组件 */
.form-group {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #554332;
}

.input-text, .select-ctrl {
    padding: 6px 10px;
    border: 1px solid #cbbeab;
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
    outline: none;
}
.input-text:focus, .select-ctrl:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(139, 38, 30, 0.15);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
    color: #554332;
}

/* 选项卡 Tab */
.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #eee5d7;
}

.tab-btn {
    flex: 1;
    padding: 9px 0;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #6d5b49;
    border-bottom: 2px solid transparent;
}
.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--bg-panel);
}

/* 模态弹窗 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 480px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(0,0,0,0.25);
    border: 1px solid #c9bea9;
}

.modal-header {
    background: #f2ebd9;
    padding: 12px 16px;
    font-weight: bold;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ded3c0;
}

.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-footer {
    padding: 12px 16px;
    background: #faf6ef;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #ebdcc8;
}

/* 常用关系快捷胶囊标签 */
.relation-presets-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
    max-height: 110px;
    overflow-y: auto;
    padding: 4px;
    background: #f7f1e6;
    border: 1px solid #e2d5c3;
    border-radius: 4px;
}

.rel-pill {
    padding: 2px 7px;
    background: #fff;
    border: 1px solid #cbbeab;
    border-radius: 12px;
    font-size: 11px;
    color: #4a3828;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}
.rel-pill:hover {
    background: #8b261e;
    color: #fff;
    border-color: #8b261e;
}

/* 顶部中间：逝者尊位与主持人核心铭牌 */
.deceased-center-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: linear-gradient(180deg, #fbf7ee 0%, #f4ebd8 100%);
    border-bottom: 1px solid #d4c5ae;
    padding: 6px 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    z-index: 8;
}

.deceased-monument-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
    color: #4a3424;
    background: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1.5px solid #8b261e;
    box-shadow: 0 1px 4px rgba(139, 38, 30, 0.1);
}

.deceased-gender-tag {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    color: #fff;
}
.gender-m { background-color: #1976d2; }
.gender-f { background-color: #d81b60; }

.host-badge-tag {
    font-size: 12px;
    color: #795548;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 移动端底部快捷导航栏 (默认在电脑端隐藏) */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: #2b2421;
    border-top: 1px solid #4a3a30;
    z-index: 1200;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #bfaea2;
    font-size: 11px;
    cursor: pointer;
    gap: 2px;
    flex: 1;
    height: 100%;
}
.mobile-nav-btn.active {
    color: #ffd54f;
}
.mobile-nav-btn-highlight {
    color: #fff;
    background: #8b261e;
    border-radius: 20px;
    margin: 4px 8px;
    height: 42px;
    font-weight: bold;
}

/* 手机端响应式适配 (<= 860px) */
@media (max-width: 860px) {
    body {
        padding-bottom: 52px; /* 给底部导航让位 */
    }

    .top-navbar {
        height: auto;
        padding: 6px 10px;
        flex-wrap: wrap;
        gap: 6px;
    }
    .nav-brand {
        font-size: 15px;
    }
    .archive-picker {
        margin-left: 0;
    }
    .select-archive {
        max-width: 140px;
    }
    .nav-tools {
        gap: 4px;
        width: 100%;
        justify-content: space-between;
    }

    .deceased-center-banner {
        flex-direction: column;
        gap: 4px;
        padding: 4px 8px;
    }

    .workbench-container {
        flex-direction: column;
    }

    /* 左右侧边栏在移动端变为抽屉遮罩 */
    .sidebar-left, .sidebar-right {
        position: fixed;
        bottom: 52px;
        top: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        background: #faf6ee;
        z-index: 1100;
        transform: translateY(100%);
        transition: transform 0.25s ease-out;
        display: flex;
    }

    .sidebar-left.mobile-open, .sidebar-right.mobile-open {
        transform: translateY(0);
    }

    .canvas-toolbar {
        padding: 0 8px;
        height: 38px;
    }

    .svg-viewport {
        padding: 15px 5px;
        touch-action: pan-x pan-y pinch-zoom;
    }

    .mobile-bottom-bar {
        display: flex;
    }
}


