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

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

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

.site-header {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: #fff;
    padding: 25px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.site-header h1 {
    font-size: 2.2em;
    margin-bottom: 12px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 25px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(255,255,255,0.25);
    transform: translateY(-2px);
}

.site-footer {
    background: #5c3a21;
    color: #ddd;
    text-align: center;
    padding: 25px 0;
    margin-top: 60px;
}

.tree-page {
    background: #fff;
    border-radius: 12px;
    padding: 35px;
    margin: 35px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.tree-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.tree-toolbar h2 {
    color: #8B4513;
    font-size: 1.8em;
}

.toolbar-buttons {
    display: flex;
    gap: 12px;
}

.toolbar-buttons .btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: #fff;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.toolbar-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139,69,19,0.3);
}

.generation-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.legend-title {
    font-weight: bold;
    color: #8B4513;
    margin-right: 10px;
}

.legend-item {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.family-tree-container {
    padding: 20px 0;
}

.tree-item {
    margin: 8px 0;
}

.tree-member {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.tree-member:hover {
    border-color: #8B4513;
    box-shadow: 0 2px 8px rgba(139,69,19,0.15);
}

.toggle-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #8B4513;
    font-size: 12px;
    transition: all 0.3s ease;
}

.toggle-icon:hover {
    background: #f0e6dc;
    border-radius: 50%;
}

.toggle-icon.empty {
    color: #ccc;
    cursor: default;
}

.toggle-icon.empty:hover {
    background: transparent;
}

.member-name {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 0.95em;
    padding-left: 8px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.member-name:hover {
    color: #8B4513;
}

.children-badge {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    color: #fff;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
}

.children-container {
    margin-left: 30px;
    padding-left: 15px;
    border-left: 2px solid #e0e0e0;
}

/* Detail Page */
.member-detail {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.member-detail h2 {
    color: #8B4513;
    font-size: 2em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.detail-item {
    padding: 15px;
    background: #faf8f5;
    border-radius: 6px;
}

.detail-item label {
    display: block;
    color: #8B4513;
    font-size: 0.85em;
    margin-bottom: 5px;
}

.detail-item .value {
    font-size: 1.2em;
    font-weight: bold;
}

.detail-item .value a {
    color: #8B4513;
    text-decoration: none;
}

.detail-item .value a:hover {
    text-decoration: underline;
}

.children-section {
    margin-top: 30px;
}

.children-section h3 {
    color: #8B4513;
    margin-bottom: 15px;
}

.members-list {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.generation-group {
    margin-bottom: 25px;
}

.generation-group h3 {
    color: #8B4513;
    padding: 10px;
    background: #faf8f5;
    border-radius: 5px;
    margin-bottom: 10px;
}

.generation-group ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.generation-group li a {
    display: inline-block;
    padding: 8px 15px;
    background: #f5f5f0;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.generation-group li a:hover {
    background: #8B4513;
    color: #fff;
    border-color: #8B4513;
}

.search-form {
    background: #fff;
    border-radius: 10px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.search-form input[type="text"] {
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 25px;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-form input[type="text"]:focus {
    border-color: #8B4513;
}

.search-results {
    margin-top: 20px;
}

.search-results .result-item {
    padding: 15px;
    background: #faf8f5;
    border-radius: 6px;
    margin-bottom: 10px;
}

.search-results .result-item a {
    color: #8B4513;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1em;
}

.search-results .result-item a:hover {
    text-decoration: underline;
}

.search-results .result-item .meta {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

@media (max-width: 768px) {
    .site-header h1 {
        font-size: 1.5em;
    }
    
    .main-nav {
        gap: 10px;
    }
    
    .main-nav a {
        padding: 6px 12px;
        font-size: 0.9em;
    }
    
    .tree-page {
        padding: 20px;
    }
    
    .tree-toolbar {
        flex-direction: column;
        gap: 15px;
    }
    
    .children-container {
        margin-left: 20px;
        padding-left: 10px;
    }
    
    .member-name {
        font-size: 0.9em;
    }
}
