/* permission.css — 权限管理页样式 */

.perm-loading { text-align: center; padding: 40px; color: #666; }
.perm-error { text-align: center; padding: 40px; color: #F44336; }
.perm-empty { padding: 16px; color: #999; text-align: center; }

.perm-section { margin-bottom: 24px; padding: 16px; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.perm-section h4 { margin: 0 0 12px; font-size: 16px; color: #333; }
.perm-section h5 { margin: 8px 0; font-size: 14px; color: #555; }

.perm-direct-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.perm-direct-item { padding: 12px; border: 1px solid #e0e0e0; border-radius: 6px; }
.perm-direct-item__name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.perm-direct-item__desc { font-size: 12px; color: #666; margin-bottom: 8px; }
.perm-direct-item__status { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.perm-direct-item__mode { font-size: 12px; color: #888; margin-bottom: 8px; }
.perm-direct-item__actions { display: flex; gap: 6px; }

.perm-aux-subject { margin-bottom: 12px; padding: 10px; background: #f9f9f9; border-radius: 6px; }
.perm-aux-subject__header { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.perm-aux-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12px; }
.perm-aux-item span:first-child { flex: 1; }

.perm-notif-freq { margin-bottom: 12px; }
.perm-notif-freq select { padding: 6px 12px; border: 1px solid #d0d0d0; border-radius: 4px; }

.perm-alerts { margin-top: 12px; }
.perm-alert-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 4px 0; background: #fff3e0; border-radius: 4px; font-size: 12px; }
.perm-alert-item span { flex: 1; }

.perm-btn { padding: 4px 12px; border: 1px solid #d0d0d0; border-radius: 4px; background: #fff; cursor: pointer; font-size: 12px; color: #555; transition: all 100ms; }
.perm-btn:hover { background: #f0f0f0; }
.perm-btn--grant { background: #4CAF50; border-color: #4CAF50; color: #fff; }
.perm-btn--grant:hover { background: #43A047; }
.perm-btn--revoke { background: #F44336; border-color: #F44336; color: #fff; }
.perm-btn--revoke:hover { background: #E53935; }

@media (max-width: 768px) {
  .perm-direct-list { grid-template-columns: 1fr; }
  .perm-section { padding: 12px; }
}

/* ====== 授权粒度矩阵样式（v1.1 新增）====== */

.matrix-loading { text-align: center; padding: 40px; color: #666; }
.matrix-error { text-align: center; padding: 40px; color: #F44336; }
.matrix-empty { padding: 16px; color: #999; text-align: center; }
.matrix-empty-hint { color: #9E9E9E; font-size: 12px; font-style: italic; }

/* 工具授权面板 */
.matrix-tool-panel { padding: 16px; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.matrix-tool-panel__header { margin-bottom: 16px; }
.matrix-tool-panel__header h4 { margin: 0 0 4px; font-size: 16px; color: #333; }
.matrix-tool-panel__hint { margin: 0; font-size: 12px; color: #888; }

/* 仓库勾选清单 */
.matrix-repo-list { margin-bottom: 16px; }
.matrix-repo-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 4px 0;
  border: 1px solid #E0E0E0; border-radius: 6px; transition: background 150ms, border-left-color 150ms;
}
.matrix-repo-row:hover { background: #F5F5F5; }
.matrix-repo-row--granted { border-left: 3px solid #4CAF50; }
.matrix-repo-row__label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; }
.matrix-repo-row__name { font-size: 13px; color: #333; }
.matrix-repo-row__status { min-width: 60px; }
.matrix-repo-row__ops { min-width: 100px; }
.matrix-repo-row__other { font-size: 11px; color: #888; }
.matrix-other-tools { font-size: 11px; color: #888; margin-top: 4px; }
.matrix-op-select { padding: 4px 8px; border: 1px solid #d0d0d0; border-radius: 4px; font-size: 12px; }

/* 状态徽章 */
.matrix-status-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; color: #fff; }
.matrix-op-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 11px; color: #fff; margin-right: 4px; }
.matrix-row-summary { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; color: #fff; }

/* 工具面板操作按钮 */
.matrix-tool-panel__actions { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid #E0E0E0; }
.matrix-btn { padding: 6px 16px; border: 1px solid #d0d0d0; border-radius: 4px; background: #fff; cursor: pointer; font-size: 13px; color: #555; transition: all 100ms; }
.matrix-btn:hover { background: #f0f0f0; }
.matrix-btn--grant { background: #4CAF50; border-color: #4CAF50; color: #fff; }
.matrix-btn--grant:hover { background: #43A047; }
.matrix-btn--revoke { background: #F44336; border-color: #F44336; color: #fff; }
.matrix-btn--revoke:hover { background: #E53935; }
.matrix-btn--small { padding: 3px 10px; font-size: 12px; }

/* 禁止全选（防御性，配合服务层 FORBID_BULK_GRANT 双重保险）*/
.bulk-select-all { display: none !important; }

/* 授权总览 */
.matrix-overview { padding: 16px; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.matrix-overview__tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid #E0E0E0; }
.matrix-tab { padding: 8px 20px; border: none; background: transparent; cursor: pointer; font-size: 14px; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 150ms; }
.matrix-tab:hover { color: #333; }
.matrix-tab--active { color: #4CAF50; border-bottom-color: #4CAF50; font-weight: 600; }

/* 授权总览表格 */
.matrix-overview-table { width: 100%; border-collapse: collapse; border: 1px solid #E0E0E0; border-radius: 6px; overflow: hidden; }
.matrix-overview-table th { padding: 10px 12px; background: #FAFAFA; text-align: left; font-size: 13px; color: #555; border-bottom: 1px solid #E0E0E0; }
.matrix-overview-table td { padding: 10px 12px; font-size: 13px; color: #333; border-bottom: 1px solid #E0E0E0; vertical-align: top; }
.matrix-overview-row:nth-child(odd) { background: #FFFFFF; }
.matrix-overview-row:nth-child(even) { background: #F9F9F9; }
.matrix-overview-row__repo, .matrix-overview-row__tool { font-weight: 600; min-width: 120px; }
.matrix-overview-row__tools, .matrix-overview-row__repos { min-width: 200px; }
.matrix-overview-row__summary { text-align: center; min-width: 100px; }
.matrix-granted-tool, .matrix-granted-repo { padding: 2px 0; font-size: 12px; }

/* 展开/折叠动画 */
.matrix-repo-row__other { max-height: 0; overflow: hidden; transition: max-height 200ms ease; }
.matrix-repo-row--expanded .matrix-repo-row__other { max-height: 100px; }

@media (max-width: 768px) {
  .matrix-repo-row { flex-wrap: wrap; }
  .matrix-overview-table { font-size: 12px; }
  .matrix-overview-table th, .matrix-overview-table td { padding: 6px 8px; }
}