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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.2);
    color: white;
    position: relative;
    overflow: hidden;
}

/* 头部装饰元素 */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 添加标题图标 */
.header h1::before {
    content: '⚙️';
    font-size: 32px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.current-user {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.current-user:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 登录容器样式 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #444;
    font-size: 16px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

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

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

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

.btn-primary:hover {
    background-color: #0056b3;
}

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

.btn-secondary:hover {
    background-color: #545b62;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

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

.btn-success:hover {
    background-color: #1e7e34;
}

/* 应用容器样式 */
.app-container {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Tab样式 */
.tab-container {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 25px;
}

.tab-btn {
    padding: 15px 25px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.tab-btn:hover {
    color: #007bff;
    background-color: #f8f9fa;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background-color: #f8f9fa;
}

/* Tab内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 搜索和操作栏 */
.search-add-area {
    margin-bottom: 25px;
}

.search-container {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* 表格样式 */
.user-table,
.family-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

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

.user-table th,
.family-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.user-table tr:hover,
.family-table tr:hover {
    background-color: #f8f9fa;
}

/* 用户表格列宽设置 */
.user-table th:nth-child(1),
.user-table td:nth-child(1) {
    width: 20%;
}

.user-table th:nth-child(2),
.user-table td:nth-child(2) {
    width: 15%;
}

.user-table th:nth-child(3),
.user-table td:nth-child(3) {
    width: 15%;
}

.user-table th:nth-child(4),
.user-table td:nth-child(4) {
    width: 40%;
}

.user-table th:nth-child(5),
.user-table td:nth-child(5) {
    width: 10%;
    text-align: center;
}

/* 家庭表格列宽设置 */
.family-table th:nth-child(1),
.family-table td:nth-child(1) {
    width: 30%;
}

.family-table th:nth-child(2),
.family-table td:nth-child(2) {
    width: 60%;
}

.family-table th:nth-child(3),
.family-table td:nth-child(3) {
    width: 10%;
    text-align: center;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.action-buttons button {
    padding: 8px 16px;
    font-size: 14px;
}

/* 卡片容器 */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* 用户卡片样式 */
.user-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 4px solid #007bff;
    position: relative;
    overflow: hidden;
}

.user-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(0, 123, 255, 0.05);
    border-radius: 50%;
    transform: translate(30%, -30%);
    transition: all 0.3s ease;
}

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

.user-card:hover::before {
    transform: translate(20%, -20%);
    background: rgba(0, 123, 255, 0.1);
}

.user-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-card-info {
    margin-bottom: 15px;
    line-height: 1.8;
}

.user-card-info p {
    margin-bottom: 8px;
    color: #666;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.user-card-info p strong {
    color: #495057;
    min-width: 80px;
}

/* 家庭卡片样式 */
.family-card {
    background: linear-gradient(135deg, #fff9f0 0%, #fff3e0 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 4px solid #ff9800;
    position: relative;
    overflow: hidden;
}

.family-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 152, 0, 0.05);
    border-radius: 50%;
    transform: translate(30%, -30%);
    transition: all 0.3s ease;
}

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

.family-card:hover::before {
    transform: translate(20%, -20%);
    background: rgba(255, 152, 0, 0.1);
}

.family-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
}

.family-card-description {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
    padding-left: 8px;
    border-left: 2px solid rgba(255, 152, 0, 0.3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 角色标签样式 */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
}

.role-badge.admin {
    background-color: #28a745;
    color: white;
}

.role-badge.user {
    background-color: #6c757d;
    color: white;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #495057;
}

.empty-state p {
    font-size: 16px;
    max-width: 400px;
    margin: 0 auto;
}

/* 分页控件样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #f8f9fa;
    border-color: #007bff;
}

.pagination-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.modal-content {
    background-color: white;
    margin: 5vh auto;
    padding: 30px;
    border-radius: 10px;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

/* 模态框底部按钮组 */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* 错误消息样式 */
.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 10px;
    min-height: 20px;
}

/* 高亮文本 */
.highlight {
    font-weight: bold;
    color: #dc3545;
}

/* 响应式设计 - 优化移动端和PC端布局 */
@media (max-width: 768px) {
    /* 容器调整 */
    .container {
        padding: 10px;
    }
    
    /* 头部布局调整 */
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    .header h1 {
        font-size: 24px;
        line-height: 1.2;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    /* 操作栏和搜索框调整 */
    .filter-actions {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .search-input {
        padding: 12px 15px;
        font-size: 16px;
        max-width: 100%;
    }
    
    /* 表格样式调整 */
    .user-table {
        font-size: 14px;
        width: 100%;
        display: block;
        overflow-x: auto;
        border-collapse: collapse;
        margin-bottom: 15px;
        -webkit-overflow-scrolling: touch;
    }
    
    .user-table th,
    .user-table td {
        padding: 10px 8px;
        min-width: 80px;
        word-break: break-word;
    }
    
    /* 操作按钮组调整 */
    .action-buttons {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .action-buttons button {
        width: 100%;
        padding: 10px;
        font-size: 16px;
    }
    
    /* 模态框优化 */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        margin: 5vh auto;
        width: 100%;
        max-width: 100%;
        padding: 20px;
        border-radius: 12px;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-header {
        margin-bottom: 15px;
        padding-bottom: 15px;
    }
    
    .modal-header h2 {
        font-size: 20px;
        line-height: 1.3;
    }
    
    /* 表单元素调整 */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 16px;
    }
    
    .form-group input[type="text"],
    .form-group input[type="password"] {
        padding: 12px 15px;
        font-size: 16px;
        min-height: 48px;
    }
    
    /* 按钮样式调整 */
    .btn {
        padding: 12px 20px;
        font-size: 16px;
        min-height: 48px;
        width: 100%;
    }
    
    /* 分页按钮响应式样式 - 增加优先级确保与编辑/删除按钮样式一致 */
    .pagination .pagination-btn {
      width: auto !important;
      min-width: 80px !important;
      padding: 6px 16px !important;
      font-size: 16px !important;
      min-height: 36px !important;
      margin: 0 5px !important;
      display: inline-flex !important;
      align-items: center !important;
      justify-content: center !important;
      box-sizing: border-box !important;
    }

    /* 分页信息文本响应式样式 */
    .pagination span {
      height: 36px !important;
      font-size: 16px !important;
      padding: 0 15px !important;
      display: inline-flex !important;
      align-items: center !important;
      white-space: nowrap !important;
    }
    
    /* 响应式调整编辑和删除按钮 - 增加优先级 */
    button.edit-btn,
    .action-buttons button.edit-btn,
    .user-table button.edit-btn,
    .family-table button.edit-btn {
        padding: 10px 16px !important;
        font-size: 16px !important;
        min-height: 44px;
        width: 100%;
    }
    
    button.delete-btn,
    .action-buttons button.delete-btn,
    .user-table button.delete-btn,
    .family-table button.delete-btn {
        padding: 10px 16px !important;
        font-size: 16px !important;
        min-height: 44px;
        width: 100%;
    }
    
    .action-buttons button.edit-btn,
    .action-buttons button.delete-btn {
        padding: 10px 16px !important;
        font-size: 16px !important;
        min-width: 100%;
    }
    
    /* 模态框底部按钮组调整 */
    .modal-footer {
        flex-direction: column;
        gap: 10px;
        padding-top: 15px;
        margin-top: 15px;
    }
    
    /* 自定义Toast提示样式（移动端） */
    #custom-toast {
        font-size: 18px !important;
        padding: 16px 24px !important;
        bottom: 20px !important;
        max-width: 90% !important;
        font-weight: bold !important;
    }
}