/**
 * Master-Detail 布局公共样式
 * 用于用户管理和组管理页面
 */

/* 页面头部 */
.page-header {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.page-header h1 {
    font-size: 1.5em;
    margin: 0;
}

/* 统计栏 */
.stats-bar {
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.85em;
}

/* Master-Detail 主布局 */
.master-detail {
    display: flex;
    gap: 15px;
    height: calc(100vh - 200px);
    min-height: 400px;
}

/* 左侧 Master 面板 */
.master-panel {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
}
.master-header {
    padding: 10px 12px;
    background: #343a40;
    color: #fff;
    font-weight: 500;
    border-radius: 5px 5px 0 0;
    font-size: 0.9em;
}
.master-search {
    padding: 8px;
    border-bottom: 1px solid #eee;
}
.master-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
}
.master-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}
.master-item {
    padding: 10px 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.15s;
}
.master-item:hover {
    background: #f8f9fa;
}
.master-item.active {
    background: #e3f2fd;
    border-left-color: #007bff;
}
.master-item.core {
    border-left-color: #007bff;
}
.master-item.active.core {
    border-left-color: #0056b3;
}

/* 头像/图标 基础样式 */
.item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
    color: #fff;
    background: #6c757d;
    flex-shrink: 0;
}
.item-icon.round {
    border-radius: 50%;
}
.item-icon.square {
    border-radius: 6px;
}
.item-icon.admin {
    background: #dc3545;
}
.item-icon.manager {
    background: #fd7e14;
}
.item-icon.user {
    background: #28a745;
}

/* 信息区域 */
.item-info {
    flex: 1;
    min-width: 0;
}
.item-name {
    font-weight: 500;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-meta {
    font-size: 0.75em;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 计数徽章 */
.item-count {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    color: #495057;
}
.item-count.has-items {
    background: #d4edda;
    color: #155724;
}
.item-count.no-items {
    background: #fff3cd;
    color: #856404;
}

/* 右侧 Detail 面板 */
.detail-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
}
.detail-header {
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    border-radius: 5px 5px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.detail-title {
    font-weight: 600;
    font-size: 1em;
}
.detail-title .highlight {
    color: #007bff;
}
.detail-actions {
    display: flex;
    gap: 6px;
}
.detail-actions .btn {
    padding: 4px 10px;
    font-size: 0.8em;
}
.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.detail-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #888;
    font-size: 0.9em;
}
.detail-desc {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.85em;
    color: #666;
}

/* 详情信息行 */
.detail-info {
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.85em;
}
.detail-info .info-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.detail-info .info-item {
    color: #666;
}
.detail-info .info-item strong {
    color: #333;
}

/* 详情筛选栏 */
.detail-filter {
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
    border-radius: 4px;
}
.detail-filter input {
    flex: 1;
    min-width: 150px;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
}
.detail-filter .filter-btns {
    display: flex;
    gap: 4px;
}
.detail-filter .btn {
    padding: 4px 8px;
    font-size: 0.75em;
}
.filter-count {
    font-size: 0.8em;
    color: #666;
}

/* 选择列表 */
.select-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px;
}
.select-item {
    padding: 8px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.85em;
}
.select-item:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}
.select-item.selected {
    background: #d4edda;
    border-color: #28a745;
}
.select-item.hidden {
    display: none;
}
.select-item.core {
    border-color: #007bff;
}
.select-item.core.selected {
    border-color: #28a745;
    background: #d4edda;
}
.select-item input {
    margin: 0;
    flex-shrink: 0;
}
.select-item label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 角色徽章 */
.role-badge {
    font-size: 0.7em;
    padding: 1px 5px;
    border-radius: 3px;
    color: #fff;
}
.role-badge.admin {
    background: #dc3545;
}
.role-badge.manager {
    background: #fd7e14;
}
.role-badge.user {
    background: #28a745;
}

/* 底部保存栏 */
.detail-footer {
    padding: 10px 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 0 0 5px 5px;
}
.save-status {
    font-size: 0.85em;
    color: #6c757d;
}
.save-status.modified {
    color: #ffc107;
}
.save-status.saving {
    color: #17a2b8;
}
.save-status.saved {
    color: #28a745;
}
