/* 登录页面样式 */
#login-page {
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

#login-form input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#login-form button {
    padding: 10px;
    background-color: #4a6fa5;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* 仪表盘样式 */
#dashboard-page {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#logout-btn {
    padding: 8px 15px;
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.crud-interface {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.action-btn {
    padding: 8px 15px;
    background-color: #4a6fa5;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#member-list {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
    overflow-x: auto;
}

.member-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.member-table th,
.member-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.member-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.member-table tr:hover {
    background-color: #f5f5f5;
}

.pagination {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.pagination button {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
}

.pagination button.active {
    background-color: #4a6fa5;
    color: white;
    border-color: #4a6fa5;
}

.pagination button:hover:not(.active) {
    background-color: #f2f2f2;
}

.pagination-ellipsis {
    padding: 5px 10px;
    color: #666;
    font-weight: bold;
}

.pagination-input {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.pagination-input input {
    width: 50px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
}

.pagination-input button {
    padding: 5px 8px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 3px;
}

.pagination-input button:hover {
    background-color: #f2f2f2;
}

/* 父辈搜索相关样式 */
.parent-search-container {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
    display: none;
}

.search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:hover {
    background-color: #f5f5f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item .member-id {
    font-weight: bold;
    color: #4a6fa5;
}

.search-result-item .member-name {
    margin-left: 8px;
}

.search-result-item .generation {
    font-size: 0.8em;
    color: #666;
    margin-left: 8px;
}

.search-result-item .parent-name {
    margin-left: 8px;
    color: #555;
}

.parent-search-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.parent-search-container input[type="text"] {
    flex: 1;
}

.clear-btn {
    padding: 5px 10px;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
}

.clear-btn:hover {
    background-color: #e1e1e1;
}

.selected-member-info {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.warning-message {
    margin: 15px 0;
    padding: 10px;
    background-color: #ffebee;
    border-left: 4px solid #f44336;
    color: #d32f2f;
}

.delete-btn {
    padding: 8px 15px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.delete-btn:hover {
    background-color: #d32f2f;
}

.member-detail-item {
    margin-bottom: 10px;
    padding: 8px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

/* 成员行点击菜单样式 */
.member-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.member-row:hover {
    background-color: #f0f8ff;
}

.context-menu {
    position: fixed;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
}

.menu-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background-color: #f5f5f5;
}

.menu-item.delete {
    color: #d32f2f;
}

/* 祖辈信息模态框样式 */
.ancestors-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.ancestors-content {
    background-color: white;
    margin: 50px auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.ancestors-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.ancestors-close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.ancestor-item {
    padding: 10px;
    margin-bottom: 5px;
    border-left: 3px solid #4a6fa5;
    background-color: #f9f9f9;
}

.ancestor-generation {
    font-weight: bold;
    color: #4a6fa5;
    margin-bottom: 5px;
}

.ancestor-info {
    display: flex;
    justify-content: space-between;
}

.ancestor-name {
    font-weight: bold;
}

.ancestor-details {
    font-size: 0.9em;
    color: #666;
}

/* 查询成员相关样式 */
.search-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.year-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-range input {
    flex: 1;
}

.search-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.reset-btn {
    padding: 8px 15px;
    background-color: #f1f1f1;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.reset-btn:hover {
    background-color: #e1e1e1;
}

#search-results-container {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
}

#search-results-table {
    overflow-x: auto;
}

#search-results-table table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#search-results-table th,
#search-results-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#search-results-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

#search-results-table tr:hover {
    background-color: #f5f5f5;
}

.action-btn-small {
    padding: 5px 10px;
    background-color: #4a6fa5;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
}

.action-btn-small:hover {
    background-color: #3a5a85;
}

.member-details {
    padding: 20px;
}

.detail-row {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.detail-label {
    font-weight: bold;
    width: 100px;
    flex-shrink: 0;
}

.detail-value {
    flex-grow: 1;
}

.close-details-btn {
    margin-top: 15px;
    padding: 8px 15px;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

.close-details-btn:hover {
    background-color: #e1e1e1;
}

/* 成员详情模态框样式 */
.member-details h3 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.member-details .close-details-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    background: none;
    border: none;
}

.member-details .close-details-btn:hover {
    color: #000;
}

/* 管理员页面样式 */
#admin-page {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

#permission-page {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

/* 管理员表格样式 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table th, 
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background-color: #4a6fa5;
    color: white;
    font-weight: bold;
}

.data-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.data-table tr:hover {
    background-color: #f5f5f5;
}

/* 权限管理页面样式 */
.permission-forms {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.input-with-button {
    display: flex;
    gap: 10px;
}

.input-with-button input {
    flex: 1;
}

.permission-list-container {
    background-color: white;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.permission-list-container h3 {
    margin-top: 0;
    color: #4a6fa5;
}

#permission-list {
    list-style-type: none;
    padding: 0;
}

#permission-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background-color: #f0f8ff;
    border-radius: 4px;
}

#permission-list li button {
    padding: 5px 10px;
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
}

#permission-list li button:hover {
    background-color: #e60000;
}

/* 树状族谱样式 */
.family-tree-content {
    width: 98vw;
    height: 98vh;
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.family-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.close-tree {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close-tree:hover {
    color: #000;
}

.family-tree-container {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

/* 树状族谱列表样式 */
.family-tree {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.family-tree ul {
    list-style-type: none;
    padding-left: 20px;
    margin: 5px 0 0 0;
    border-left: 1px dashed #ccc;
    position: relative;
}

.family-tree > li {
    margin-bottom: 10px;
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-radius: 5px;
    border-left: 3px solid #4a6fa5;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.family-tree > li:hover {
    background-color: #e6f3ff;
}

.family-tree li {
    margin: 8px 0;
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-radius: 5px;
    border-left: 3px solid #4a6fa5;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
    display: flex;
    align-items: center;
}

.family-tree li:hover {
    background-color: #e6f3ff;
}

.family-tree li.selected {
    background-color: #e6f3ff;
    border-left: 3px solid #2a5085;
}

/* 展开/折叠图标 */
.tree-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    background-color: #4a6fa5;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
}

.tree-toggle:hover {
    background-color: #3a5a85;
}

.member-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.member-generation {
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* 水平滚动条 */
.family-tree-container {
    overflow-x: auto;
    min-height: 100%;
    padding-bottom: 20px;
}

/* 深层嵌套优化 */
.family-tree ul ul ul {
    padding-left: 30px;
}

.family-tree ul ul ul ul {
    padding-left: 40px;
}

.family-tree ul ul ul ul ul {
    padding-left: 50px;
}

/* 节点连接线 */
.family-tree ul::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 1px;
    background-color: #ccc;
}

/* 减少深层次的缩进 */
.family-tree {
    min-width: 800px;
    padding: 20px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.submit-btn {
    background-color: #4CAF50;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.submit-btn:hover {
    background-color: #45a049;
}