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

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 头部样式 ===== */
.header {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.announcement-board {
    flex: 1;
}

.announcement-board h3 {
    color: #333;
    margin-bottom: 10px;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 5px;
}

.announcements {
    max-height: 150px;
    overflow-y: auto;
}

.announcement-item {
    padding: 8px 0;
    border-bottom: 1px dashed #ddd;
    cursor: pointer;
    transition: background 0.2s;
}

.announcement-item:hover {
    background: #f5f5f5;
}

.announcement-date {
    color: #666;
    font-size: 0.9em;
    margin-right: 15px;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
}

.announcement-title {
    color: #333;
}

/* ===== 族谱树样式 ===== */
.main-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    min-height: 500px;
    border: 1px solid #e0e0e0;
}

.family-tree {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 20px 0;
    min-width: 800px;
}

/* 每一代的行 */
.generation-row {
    display: flex;
    align-items: flex-start;
    position: relative;
}

/* 代数标签 */
.generation-label {
    width: 80px;
    font-weight: bold;
    color: #4CAF50;
    padding: 10px;
    background: #f0f8f0;
    border-radius: 4px;
    text-align: center;
    margin-right: 20px;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    left: 0;
    z-index: 2;
}

/* 人员行 */
.persons-row {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding: 10px 0;
    position: relative;
}

/* 连接线容器 */
.connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    position: absolute;
    background: #999;
    transform-origin: 0 0;
}

/* 人员卡片 */
.person-card {
    background: white;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 15px;
    min-width: 200px;
    max-width: 250px;
    position: relative;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    z-index: 2;
    transition: transform 0.2s;
}

.person-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.15);
}

/* 本人信息区域 */
.person-main {
    text-align: center;
    border-bottom: 1px dashed #eee;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.person-name {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    display: inline-block;
}

.person-gender {
    font-size: 0.9em;
    color: #666;
    margin-left: 5px;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 12px;
    display: inline-block;
}

.person-birth {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    background: #e8f4f8;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.person-former {
    font-size: 0.8em;
    color: #888;
    margin-top: 3px;
    font-style: italic;
}

/* 配偶信息区域 */
.person-spouse {
    text-align: center;
    position: relative;
}

.spouse-line {
    width: 80%;
    height: 1px;
    background: #999;
    margin: 10px auto;
    position: relative;
}

.spouse-line::before,
.spouse-line::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    top: -3px;
}

.spouse-line::before {
    left: -3px;
}

.spouse-line::after {
    right: -3px;
}

.spouse-info {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #4CAF50;
}

.spouse-name {
    font-weight: bold;
    color: #2e7d32;
    font-size: 1.1em;
    display: inline-block;
}

.spouse-gender {
    font-size: 0.8em;
    color: #666;
    margin-left: 5px;
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 12px;
    display: inline-block;
}

.spouse-birth {
    font-size: 0.85em;
    color: #666;
    margin-top: 3px;
    background: #e8f4f8;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.spouse-former {
    font-size: 0.8em;
    color: #888;
    margin-top: 2px;
    font-style: italic;
}

/* 空数据提示 */
.empty-tree {
    text-align: center;
    padding: 80px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #666;
    font-size: 1.2em;
}

.empty-tree p {
    margin-bottom: 20px;
}

.empty-tree .btn {
    display: inline-block;
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

/* ===== 底部表单样式 ===== */
.footer {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.submit-form h3 {
    color: #333;
    margin-bottom: 20px;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 10px;
}

.form-tip {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 15px;
    padding: 8px;
    background: #e8f4f8;
    border-radius: 4px;
    border-left: 3px solid #4CAF50;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input[type="checkbox"] {
    margin-right: 5px;
}

/* 配偶信息区域 */
#spouseInfo, #adminSpouseInfo {
    grid-column: 1 / -1;
    border: 1px solid #e0e0e0;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    background: #f9f9f9;
}

#spouseInfo h4, #adminSpouseInfo h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

/* 验证码区域 */
.captcha {
    display: flex;
    gap: 10px;
    align-items: center;
}

.captcha span {
    background: #4CAF50;
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
}

.form-actions {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 20px;
}

.btn {
    background: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    display: inline-block;
    margin: 0 5px;
    transition: background 0.3s;
}

.btn:hover {
    background: #45a049;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-primary {
    background: #007bff;
}

.btn-primary:hover {
    background: #0069d9;
}

/* ===== 模态框样式 ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

/* ===== 后台管理样式 ===== */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar h2 {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #4a5a6a;
    padding-bottom: 10px;
}

.admin-sidebar ul {
    list-style: none;
}

.admin-sidebar li {
    margin-bottom: 5px;
}

.admin-sidebar a {
    color: #bdc3c7;
    text-decoration: none;
    display: block;
    padding: 10px 15px;
    border-radius: 4px;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: #34495e;
    color: white;
    border-left: 3px solid #4CAF50;
}

.admin-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
    background: #f5f5f5;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 表格样式 */
.table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background: #4CAF50;
    color: white;
    font-weight: 600;
}

.table tr:hover {
    background: #f5f5f5;
}

.action-btn {
    padding: 5px 10px;
    margin: 0 3px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-edit {
    background: #ffc107;
    color: #333;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-approve {
    background: #28a745;
    color: white;
}

/* 消息提示 */
.message {
    padding: 10px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .generation-row {
        flex-direction: column;
    }
    
    .generation-label {
        width: auto;
        margin-bottom: 10px;
    }
    
    .admin-sidebar {
        width: 200px;
    }
    
    .admin-content {
        margin-left: 200px;
    }
}