/* 全局样式 */
body {
    font-family: 'Microsoft YaHei', '方正书宋', sans-serif;
    background-color: #f5f1e6; /* 更柔和的古纸色背景 */
    background-image: url('../images/paper_texture.png');
    background-blend-mode: soft-light;
    color: #3a3a3a;
    background-attachment: fixed;
}

/* 自定义头部 */
.custom-header {
    position: relative;
    padding: 2rem 0;
    overflow: hidden;
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/chinese_pattern.png');
    opacity: 0.15;
    z-index: -1;
}

.title-font {
    font-family: '汉仪旗黑', 'Microsoft YaHei', sans-serif;
    color: #8C1C13; /* 宫廷红 */
    text-shadow: 1px 1px 3px rgba(140,28,19,0.15);
    letter-spacing: 3px;
}

.subtitle {
    color: #666;
    font-style: italic;
}

/* 卡片样式 */
.card {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(140, 28, 19, 0.05);
    background-color: rgba(255, 252, 245, 0.85);
    backdrop-filter: blur(5px);
}

.card-header {
    background-color: rgba(140, 28, 19, 0.05);
    border-bottom: 1px solid rgba(140, 28, 19, 0.1);
    font-weight: 600;
    color: #8C1C13;
}

/* 按钮样式 */
.btn-primary {
    background-color: #8C1C13;
    border-color: #8C1C13;
    box-shadow: 0 2px 4px rgba(140, 28, 19, 0.2);
}

.btn-primary:hover {
    background-color: #7a1811;
    border-color: #7a1811;
}

/* 自定义图例 */
.custom-legend {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 15px;
    border: 1px solid rgba(140, 28, 19, 0.1);
}

.legend-title {
    color: #8C1C13;
    font-weight: 600;
    border-bottom: 1px solid rgba(140, 28, 19, 0.2);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.legend-item {
    transition: all 0.3s ease;
    padding: 6px 10px;
}

.legend-item:hover {
    background-color: rgba(140, 28, 19, 0.05);
    transform: translateY(-2px);
}

/* 节点和连线样式 */
.node circle {
    stroke: #fff;
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.node:hover circle {
    stroke-width: 3px;
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.3));
}

.node text {
    font-family: '方正书宋', 'Microsoft YaHei', sans-serif;
    transition: all 0.3s ease;
}

.link {
    stroke-opacity: 0.6;
    transition: all 0.3s ease;
    stroke-width: 1px;
}

.link:hover {
    stroke-opacity: 1;
    stroke-width: 2px;
}
/* 3. 交互效果增强

### 节点与连线
- 为节点添加精美的人物头像或剪影
- 节点悬停时显示精致的人物卡片，包含简要信息
- 连线使用更有质感的样式，如渐变色或虚线效果

### 动画效果
- 添加优雅的过渡动画，如节点选中时的放大效果
- 图谱初始化时的展开动画
- 筛选时的平滑过渡

## 4. CSS样式示例
/* 全局样式 */
body {
    font-family: 'Microsoft YaHei', '方正书宋', sans-serif;
    background-color: #f5f1e6; /* 更柔和的古纸色背景 */
    background-image: url('../images/paper_texture.png');
    background-blend-mode: soft-light;
    color: #3a3a3a;
    background-attachment: fixed;
}

/* 自定义头部 */
.custom-header {
    position: relative;
    padding: 2rem 0;
    overflow: hidden;
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/chinese_pattern.png');
    opacity: 0.15;
    z-index: -1;
}

.title-font {
    font-family: '汉仪旗黑', 'Microsoft YaHei', sans-serif;
    color: #8C1C13; /* 宫廷红 */
    text-shadow: 1px 1px 3px rgba(140,28,19,0.15);
    letter-spacing: 3px;
}

.subtitle {
    color: #666;
    font-style: italic;
}

/* 卡片样式 */
.card {
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(140, 28, 19, 0.05);
    background-color: rgba(255, 252, 245, 0.85);
    backdrop-filter: blur(5px);
}

.card-header {
    background-color: rgba(140, 28, 19, 0.05);
    border-bottom: 1px solid rgba(140, 28, 19, 0.1);
    font-weight: 600;
    color: #8C1C13;
}

/* 按钮样式 */
.btn-primary {
    background-color: #8C1C13;
    border-color: #8C1C13;
    box-shadow: 0 2px 4px rgba(140, 28, 19, 0.2);
}

.btn-primary:hover {
    background-color: #7a1811;
    border-color: #7a1811;
}

/* 自定义图例 */
.custom-legend {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 15px;
    border: 1px solid rgba(140, 28, 19, 0.1);
}

.legend-title {
    color: #8C1C13;
    font-weight: 600;
    border-bottom: 1px solid rgba(140, 28, 19, 0.2);
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.legend-item {
    transition: all 0.3s ease;
    padding: 6px 10px;
}

.legend-item:hover {
    background-color: rgba(140, 28, 19, 0.05);
    transform: translateY(-2px);
}

/* 节点和连线样式 */
.node circle {
    stroke: #fff;
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.node:hover circle {
    stroke-width: 3px;
    filter: drop-shadow(0 0 3px rgba(0,0,0,0.3));
}

.node text {
    font-family: '方正书宋', 'Microsoft YaHei', sans-serif;
    transition: all 0.3s ease;
}

.link {
    stroke-opacity: 0.6;
    transition: all 0.3s ease;
    stroke-width: 1px;
}

.link:hover {
    stroke-opacity: 1;
    stroke-width: 2px;
}
/* 固定节点样式 */
.fixed-node {
    stroke: #ff0000 !important;
    stroke-width: 3px !important;
    stroke-dasharray: 5, 2;
}
/* 图形容器样式 */
#graph-container {
    width: 100%;
    height: 80vh;
    border: 1px solid rgba(140, 28, 19, 0.1);
    border-radius: 8px;
    background-color: rgba(255, 252, 245, 0.9);
    overflow: hidden;
    position: relative;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
}

#graph {
    width: 100%;
    height: 100%;
}

/* 控制面板样式 */
.control-panel {
    max-height: 80vh;
    overflow-y: auto;
    background-color: rgba(255, 252, 245, 0.9);
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(140, 28, 19, 0.08);
    padding: 5px;
}

/* 卡片样式统一 */
.card {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: none;
    overflow: hidden;
}

.card-header {
    background-color: rgba(140, 28, 19, 0.03);
    border-bottom: 1px solid rgba(140, 28, 19, 0.08);
    font-weight: 600;
    color: #8C1C13;
}

/* 信息面板样式 */
.info-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(140, 28, 19, 0.1);
    background-color: rgba(255, 252, 245, 0.95);
}

.character-image {
    width: 100%;
    height: 150px;
    background-color: #f0ebe0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    border: 1px solid rgba(140, 28, 19, 0.08);
}

/* 节点和连线样式 */
.node {
    cursor: pointer;
}

.node circle {
    stroke: #fff;
    stroke-width: 2px;
}

.node text {
    font-size: 12px;
    fill: #333;
}

.link {
    stroke-opacity: 0.6;
    cursor: pointer;
    stroke-width: 1px;
}

/* 节点悬停提示样式 */
.tooltip {
    position: absolute;
    background-color: rgba(255, 252, 245, 0.95);
    border: 1px solid rgba(140, 28, 19, 0.1);
    border-radius: 4px;
    padding: 10px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    max-width: 200px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    color: #3a3a3a;
}

/* 关系类型颜色 - 更新为与JS中定义一致的颜色 */
.family-link {
    stroke: #f7b55c; /* 温暖的橙色 - 亲属关系 */
}

.romance-link {
    stroke: #de2f44; /* 粉红色 - 婚姻关系 */
}

.social-link {
    stroke: #1154b2; /* 蓝色 - 社交关系 */
}
.master-servant-link {
    stroke: #98d606; /* 绿色 - 主仆关系 */
}

.特殊-link {
    stroke: #d900ff; /* 紫色 - 特殊关系 */
}
/* 图例样式 */
.legend-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 12px;
    background-color: rgba(255, 252, 245, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(140, 28, 19, 0.05);
}

.legend-group {
    display: flex;
    flex-direction: row;
    background-color: rgba(255, 252, 245, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    margin: 0 10px;
    border: 1px solid rgba(140, 28, 19, 0.03);
}

.legend-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 1em;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 4px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background-color: rgba(255, 252, 245, 0.9);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    margin-right: 8px;
    margin-bottom: 4px;
    min-width: 100px;
    border: 1px solid rgba(140, 28, 19, 0.03);
}

.color-box {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

/* 人物组别颜色 - 更新为与JS中定义一致的颜色 */
.main-character {
    fill: #E63946; /* 主角 */
}

.jinling-twelve-primary {
    fill: #9D4EDD; /* 金陵十二钗正册 */
}

.jinling-twelve-secondary {
    fill: #C77DFF; /* 金陵十二钗副册 */
}

.jia-family {
    fill: #457B9D; /* 贾府 */
}

.lin-family {
    fill: #1D3557; /* 林府 */
}

.xue-family {
    fill: #F1C453; /* 薛府 */
}

.minor-character {
    fill: #A8DADC; /* 次要角色 */
}

/* 响应式调整 */
@media (max-width: 768px) {
    .col-md-3, .col-md-9 {
        width: 100%;
    }
    
    .info-panel {
        width: 90%;
        left: 5%;
        right: 5%;
    }
    
    #graph-container {
        height: 60vh;
    }
}