/* ===== CSS变量定义 - 颜色主题系统 ===== */
:root {
  /* 浅色主题 */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-accent: #e2e8f0;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  
  --border-primary: #e2e8f0;
  --border-secondary: #cbd5e1;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  /* 品牌颜色 */
  --brand-primary: #3b82f6;
  --brand-primary-hover: #2563eb;
  --brand-success: #10b981;
  --brand-success-hover: #059669;
  --brand-warning: #f59e0b;
  --brand-danger: #ef4444;
  
  /* 性别颜色 */
  --male-color: #3b82f6;
  --male-bg: #eff6ff;
  --female-color: #ec4899;
  --female-bg: #fdf2f8;
  --highlight-color: #f59e0b;
  --highlight-bg: #fffbeb;
}

/* 深色主题 */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-accent: #475569;
  
  --text-primary: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-tertiary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --border-primary: #334155;
  --border-secondary: #475569;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  
  --male-bg: rgba(59, 130, 246, 0.1);
  --female-bg: rgba(236, 72, 153, 0.1);
  --highlight-bg: rgba(245, 158, 11, 0.1);
}

/* ===== 基础重置和全局样式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* ===== 工具类 ===== */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== 加载动画 ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-secondary);
}

.loading i {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  color: var(--brand-primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== 登录界面 ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.login-container {
  background: var(--bg-primary);
  padding: 3rem;
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  text-align: center;
  max-width: 420px;
  width: 90%;
  border: 1px solid var(--border-primary);
  animation: slideUp 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-header {
  margin-bottom: 2rem;
}

.login-header i {
  font-size: 3.5rem;
  color: var(--brand-primary);
  margin-bottom: 1.5rem;
  display: block;
}

.login-header h1 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.login-header p {
  color: var(--text-secondary);
  margin-bottom: 0;
  font-size: 1rem;
}

.input-group {
  position: relative;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.input-group[style*="display: none"] {
  margin-bottom: 0;
  height: 0;
  overflow: hidden;
}

.input-group i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  z-index: 2;
}

.input-group input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 2px solid var(--border-primary);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.3s ease;
  outline: none;
}

.input-group input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: var(--bg-primary);
}

.login-btn {
  width: 100%;
  padding: 16px 24px;
  background: var(--brand-primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.login-btn:active {
  transform: translateY(0);
}

.error-message {
  color: var(--brand-danger);
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ===== 主界面布局 ===== */
#main-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

/* ===== 顶部导航栏 ===== */
.header {
  background: var(--bg-primary);
  padding: 1rem 2rem;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-left h1 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-left i {
  color: var(--brand-primary);
  font-size: 1.75rem;
}

.search-container {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 4px;
  min-width: 320px;
  transition: all 0.3s ease;
}

.search-container:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-container input {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.search-container input::placeholder {
  color: var(--text-muted);
}

.search-container button {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--brand-primary);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  margin: 0 2px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-container button:hover {
  background: var(--brand-primary-hover);
  transform: scale(1.05);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
}

.icon-btn:hover {
  background: var(--brand-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.theme-toggle {
  position: relative;
  overflow: hidden;
}

.theme-toggle i {
  transition: all 0.3s ease;
}

/* ===== 控制面板 ===== */
.control-panel {
  background: var(--bg-primary);
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.control-group label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
  white-space: nowrap;
}

.toggle-buttons {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  overflow: hidden;
}

.toggle-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-right: 1px solid var(--border-primary);
}

.toggle-btn:last-child {
  border-right: none;
}

.toggle-btn.active,
.toggle-btn:hover {
  background: var(--brand-primary);
  color: white;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-primary);
}

#zoom-level {
  min-width: 60px;
  text-align: center;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* ===== 主内容区域 ===== */
.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tree-container {
  width: 100%;
  height: calc(100vh - 160px);
  position: relative;
  overflow: auto;
  background: var(--bg-secondary);
  /* 确保滚动条样式美观 */
  scrollbar-width: thin;
  scrollbar-color: var(--border-secondary) var(--bg-secondary);
}

/* 自定义滚动条样式 (Webkit浏览器) */
.tree-container::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.tree-container::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.tree-container::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 6px;
  border: 2px solid var(--bg-secondary);
}

.tree-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.tree-canvas {
  position: relative;
  /* 移除固定尺寸限制，让内容决定大小 */
  width: fit-content;
  min-width: 100%;
  min-height: 100%;
  transform-origin: 0 0;
  transition: transform 0.3s ease;
  /* 增加padding确保边缘内容可见 */
  padding: 100px;
}

/* 中心轴指示线（可选显示） */
.tree-canvas::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, transparent 20%, var(--border-primary) 20%, var(--border-primary) 80%, transparent 80%);
  opacity: 0.3;
  pointer-events: none;
  z-index: 1;
  transform: translateX(-50%);
  transition: opacity 0.3s ease;
}

/* 隐藏中心轴线 */
.tree-canvas.hide-centerline::before {
  opacity: 0;
}

/* ===== 连接线样式 ===== */
.connection-line {
  position: absolute;
  z-index: 1;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.connection-line:hover {
  opacity: 1;
}

.connection-line.parent-child {
  background: #45b7d1;
}

.connection-line.marriage {
  background: #ff6b9d;
}

.connection-line.sibling {
  background: #4ecdc4;
}

/* 现代化连接线样式 */
.connection-line.modern {
  opacity: 0.9;
}

/* ===== 家族连接线样式 ===== */
.family-connection-line {
  position: absolute;
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 2px;
  transform-origin: center;
}

.family-connection-line:hover {
  opacity: 1 !important;
  transform: scale(1.1) !important;
  z-index: 10 !important;
}

/* 连接线在深色主题下的优化 */
[data-theme="dark"] .family-connection-line {
  filter: brightness(1.1);
}

[data-theme="dark"] .family-connection-line:hover {
  filter: brightness(1.3) saturate(1.2);
}

.connection-line.modern:hover {
  opacity: 1;
  transform: scale(1.02);
  filter: saturate(1.4) brightness(1.1);
}

/* 夫妻连接线样式 */
.couple-connection {
  position: absolute;
  background: linear-gradient(90deg, #ff6b9d, #ff8fab, #ff6b9d);
  border-radius: 2px;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.3);
  transition: all 0.3s ease;
}

.couple-connection:hover {
  box-shadow: 0 4px 12px rgba(255, 107, 157, 0.5);
  transform: scaleY(1.2);
}

/* 爱心动画 */
.couple-heart {
  position: absolute;
  font-size: 20px;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  cursor: pointer;
  transition: all 0.3s ease;
}

.couple-heart:hover {
  transform: scale(1.2) rotate(5deg);
  filter: drop-shadow(0 4px 8px rgba(255, 107, 157, 0.4));
}

@keyframes heartBeat {
  0% { 
    transform: scale(1); 
  }
  14% { 
    transform: scale(1.15) rotate(2deg); 
  }
  28% { 
    transform: scale(1) rotate(-1deg); 
  }
  42% { 
    transform: scale(1.15) rotate(1deg); 
  }
  70% { 
    transform: scale(1) rotate(0deg); 
  }
  100% { 
    transform: scale(1); 
  }
}

/* 关系箭头样式 */
.relationship-arrow {
  position: absolute;
  font-size: 12px;
  font-weight: bold;
  z-index: 10;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  animation: arrowPulse 3s infinite;
}

@keyframes arrowPulse {
  0%, 100% { 
    opacity: 0.7; 
    transform: translateY(0); 
  }
  50% { 
    opacity: 1; 
    transform: translateY(2px); 
  }
}

/* 兄弟姐妹标识样式 */
.sibling-label {
  position: absolute;
  font-size: 14px;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  animation: siblingFloat 4s ease-in-out infinite;
}

@keyframes siblingFloat {
  0%, 100% { 
    transform: translateY(0); 
  }
  50% { 
    transform: translateY(-3px); 
  }
}

/* 关系图标 */
.relationship-icon {
  position: absolute;
  font-size: 14px;
  z-index: 10;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.marriage-icon {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* ===== 增强的族谱节点样式 ===== */
.family-node {
  position: absolute;
  background: var(--bg-primary);
  border: 2px solid var(--border-primary);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-base);
  backdrop-filter: blur(8px);
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* 移除min-width和max-width，让JavaScript完全控制尺寸 */
}

.family-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.family-node:hover::before {
  transform: translateX(100%);
}

.family-node:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-xl);
  border-color: var(--brand-primary);
}

.family-node.male {
  border-color: var(--male-color);
  background: linear-gradient(135deg, var(--male-bg), var(--bg-primary));
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15), var(--shadow-base);
}

.family-node.female {
  border-color: var(--female-color);
  background: linear-gradient(135deg, var(--female-bg), var(--bg-primary));
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.15), var(--shadow-base);
}

.family-node.highlighted {
  border-color: var(--highlight-color);
  background: linear-gradient(135deg, var(--highlight-bg), var(--bg-primary));
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2), 
              0 8px 32px rgba(245, 158, 11, 0.3),
              var(--shadow-xl);
  animation: highlightGlow 2s ease-in-out infinite alternate;
}

@keyframes highlightGlow {
  from {
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2), 
                0 8px 32px rgba(245, 158, 11, 0.3),
                var(--shadow-xl);
  }
  to {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.4), 
                0 12px 40px rgba(245, 158, 11, 0.5),
                var(--shadow-xl);
  }
}

.node-name {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-size: 0.9rem;
  letter-spacing: -0.025em;
  position: relative;
  z-index: 2;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.node-dates {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  line-height: 1.3;
  font-weight: 500;
  position: relative;
  z-index: 2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.node-gender {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  z-index: 3;
  transition: all 0.3s ease;
}

.node-gender:hover {
  transform: scale(1.1) rotate(5deg);
}

.node-gender.male {
  background: linear-gradient(135deg, var(--male-color), #1976D2);
}

.node-gender.female {
  background: linear-gradient(135deg, var(--female-color), #C2185B);
}

.node-gender.unknown {
  background: linear-gradient(135deg, #6b7280, #4b5563);
}

.family-node.unknown {
  border-color: #6b7280;
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.1), var(--bg-primary));
  box-shadow: 0 4px 20px rgba(107, 114, 128, 0.15), var(--shadow-base);
}

.member-card.unknown::before {
  background: #6b7280;
}

/* ===== 关系图例样式 ===== */
.relationship-legend {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.3s ease;
}

.relationship-legend.hidden {
  display: none;
}

.legend-items {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.legend-line {
  width: 30px;
  height: 3px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.legend-line.parent-child {
  background: #45b7d1;
}

.legend-line.marriage {
  background: #ff6b9d;
  height: 20px;
  border-radius: 10px;
  width: 40px;
}

.legend-line.sibling {
  background: linear-gradient(90deg, #4ecdc4 50%, transparent 50%);
  background-size: 8px 3px;
}

/* ===== 层级列表样式 ===== */
.list-container {
  height: calc(100vh - 160px);
  overflow-y: auto;
  padding: 2rem;
  background: var(--bg-secondary);
}

.generation {
  margin-bottom: 2rem;
  background: var(--bg-primary);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-base);
  border: 1px solid var(--border-primary);
}

.generation-header {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-hover));
  color: white;
  padding: 1.25rem 1.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.025em;
}

.generation-members {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.member-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.member-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--brand-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.member-card:hover::before {
  transform: scaleX(1);
}

.member-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-primary);
}

.member-card.male::before {
  background: var(--male-color);
}

.member-card.female::before {
  background: var(--female-color);
}

.member-card.highlighted {
  border-color: var(--highlight-color);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2), var(--shadow-md);
}

.member-name {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.05rem;
}

.member-details {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.member-details > div {
  margin-bottom: 0.25rem;
}

/* 夫妻成员卡片样式 */
.member-card.couple-member {
  position: relative;
}

.member-card.couple-member::after {
  content: '💕';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 14px;
  opacity: 0.7;
  animation: coupleIconFloat 3s ease-in-out infinite;
}

@keyframes coupleIconFloat {
  0%, 100% { 
    transform: translateY(0) rotate(0deg); 
    opacity: 0.7;
  }
  50% { 
    transform: translateY(-2px) rotate(5deg); 
    opacity: 1;
  }
}

.member-card.couple-member:hover::after {
  animation-duration: 1s;
  transform: scale(1.2);
}

/* ===== 模态弹窗样式 ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: 20px;
  max-width: 640px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalSlide 0.4s ease-out;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-primary);
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  color: var(--text-primary);
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.025em;
}

.close-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: var(--brand-danger);
  color: white;
  transform: scale(1.1);
}

.modal-body {
  padding: 1rem 2rem 2rem;
}

.person-info {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.person-avatar {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-hover));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-lg);
}

.person-details {
  flex: 1;
}

.person-details h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.person-meta {
  margin-bottom: 2rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  font-size: 1rem;
  padding: 0.5rem 0;
}

.meta-item i {
  width: 20px;
  color: var(--brand-primary);
  font-size: 1.1rem;
}

.person-description h4 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.person-description p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 1rem;
}

/* ===== 搜索结果样式 ===== */
.search-results {
  position: fixed;
  top: 90px;
  right: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  box-shadow: var(--shadow-xl);
  max-width: 320px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.search-results.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-result-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.search-result-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--brand-primary);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.search-result-item:hover::before {
  transform: scaleY(1);
}

.search-result-item:hover {
  background: var(--bg-secondary);
  transform: translateX(8px);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-name {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.search-result-info {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.no-results {
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .header-left,
  .header-center,
  .header-right {
    justify-content: center;
  }
  
  .search-container {
    min-width: auto;
    width: 100%;
  }
  
  .control-panel {
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .control-group {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  
  .tree-container,
  .list-container {
    height: calc(100vh - 220px);
  }
  
  .list-container {
    padding: 1rem;
  }
  
  .generation-members {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .person-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
  }
  
  .modal-content {
    margin: 1rem;
    width: calc(100% - 2rem);
  }
  
  .search-results {
    left: 20px;
    right: 20px;
    max-width: none;
  }
  
  .family-node {
    min-width: 120px;
    max-width: 140px;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: 2rem 1.5rem;
    margin: 1rem;
  }
  
  .header {
    padding: 0.75rem;
  }
  
  .control-panel {
    padding: 0.75rem;
  }
  
  .family-node {
    min-width: 100px;
    max-width: 120px;
    padding: 10px;
  }
  
  .node-name {
    font-size: 0.9rem;
  }
  
  .node-dates {
    font-size: 0.7rem;
  }
  
  .modal-header,
  .modal-body {
    padding: 1.5rem 1rem;
  }
}

/* ===== 动画和效果增强 ===== */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

.slide-down {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 主题切换动画 ===== */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===== 滚动条样式 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== 打印样式 ===== */
@media print {
  .header,
  .control-panel,
  .search-results {
    display: none !important;
  }
  
  .main-content {
    height: auto !important;
  }
  
  .tree-container,
  .list-container {
    height: auto !important;
    overflow: visible !important;
  }
  
  .family-node {
    box-shadow: none !important;
    border: 2px solid #000 !important;
  }
}

/* ===== 可访问性增强 ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  :root {
    --shadow-sm: none;
    --shadow-base: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-xl: none;
  }
  
  .family-node,
  .member-card,
  .modal-content {
    border-width: 3px !important;
  }
}

/* 焦点可见性 */
button:focus-visible,
input:focus-visible,
.family-node:focus-visible,
.member-card:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
} 

/* 搜索高亮效果 */
.search-highlight {
  animation: searchHighlight 3s ease-in-out;
}

@keyframes searchHighlight {
  0% {
    background: var(--highlight-bg);
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.6);
    transform: scale(1.1);
  }
  50% {
    background: var(--highlight-bg);
    box-shadow: 0 0 0 16px rgba(245, 158, 11, 0.4);
    transform: scale(1.05);
  }
  100% {
    background: transparent;
    box-shadow: none;
    transform: scale(1);
  }
}

.family-node.search-highlight {
  border-color: var(--highlight-color) !important;
  z-index: 100;
}

.member-card.search-highlight {
  border-color: var(--highlight-color) !important;
  z-index: 100;
} 

/* 家族连接线样式 */
.family-connection-line {
  position: absolute;
  background-color: #45b7d1;
  border-radius: 1px;
  z-index: 3;
  opacity: 0.8;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(69, 183, 209, 0.3);
}

.family-connection-line:hover {
  opacity: 1;
  background-color: #2563eb;
  box-shadow: 0 2px 6px rgba(69, 183, 209, 0.5);
}

/* ===== 使用提示样式 ===== */
.usage-tips {
  color: var(--text-tertiary);
  line-height: 1.4;
  margin-top: 4px;
}

.usage-tips small {
  font-size: 11px;
  opacity: 0.8;
}

.usage-tips i {
  font-size: 10px;
  margin: 0 1px;
  color: var(--text-secondary);
} 