/* Role Management Styles */

.role-management {
  padding: 20px;
}

.role-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.role-stats .stat-box {
  background: white;
  padding: 20px 30px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  text-align: center;
}

.role-stats .stat-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: #1e40af;
}

.role-stats .stat-label {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.roles-section {
  margin-bottom: 40px;
}

.roles-section h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #111827;
}

.section-description {
  color: #6b7280;
  margin-bottom: 16px;
  font-size: 14px;
}

.role-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.role-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.role-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.role-card.system-role {
  background: #f8fafc;
}

.role-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.role-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.system-badge {
  background: #e5e7eb;
  color: #374151;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 600;
}

.role-description {
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.role-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 12px;
}

.role-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.role-actions .btn-icon {
  padding: 6px 10px;
  background: #f3f4f6;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.role-actions .btn-icon:hover {
  background: #e5e7eb;
}

.role-actions .btn-danger:hover {
  background: #fee2e2;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
  background: #f9fafb;
  border-radius: 8px;
  border: 2px dashed #e5e7eb;
}

/* Role Modal */
.modal-large .modal-content {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.permissions-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.permissions-section h4 {
  margin-bottom: 16px;
  font-size: 16px;
  color: #374151;
}

.permission-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.permission-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
}

.module-icon {
  font-size: 20px;
}

.module-name {
  flex: 1;
  font-weight: 500;
  color: #111827;
}

.access-select {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  cursor: pointer;
}

.permission-details {
  padding: 12px 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.permission-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.permission-checkboxes label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}

.permission-checkboxes input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.custom-permissions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #d1d5db;
}

.custom-permissions h5 {
  font-size: 12px;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 10px;
}

.custom-permissions label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #374151;
  margin-bottom: 8px;
  cursor: pointer;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.modal-footer .btn-danger {
  margin-right: auto;
}

/* User Roles in User Management */
.user-roles-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: white;
}

.user-role-badge .remove-role {
  cursor: pointer;
  opacity: 0.7;
  margin-left: 2px;
}

.user-role-badge .remove-role:hover {
  opacity: 1;
}

/* Role Assignment in User Edit */
.role-assignment-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.available-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.role-chip:hover {
  border-color: #3b82f6;
}

.role-chip.selected {
  border-color: #3b82f6;
  background: #eff6ff;
}

.role-chip .role-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .role-cards {
    grid-template-columns: 1fr;
  }
  
  .permission-checkboxes {
    flex-direction: column;
    gap: 10px;
  }
  
  .role-stats {
    flex-direction: column;
    gap: 12px;
  }
}
